Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl-generator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
余保谷
ydl-generator
Commits
22b7f356
Commit
22b7f356
authored
Apr 13, 2019
by
flying-cattle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
连接sql优化
parent
151e1ef3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
EntityInfoUtil.java
src/main/java/com/github/mybatis/fl/util/EntityInfoUtil.java
+19
-7
No files found.
src/main/java/com/github/mybatis/fl/util/EntityInfoUtil.java
View file @
22b7f356
...
@@ -39,11 +39,11 @@ public class EntityInfoUtil {
...
@@ -39,11 +39,11 @@ public class EntityInfoUtil {
try
{
try
{
con
=
DriverManager
.
getConnection
(
bi
.
getDbUrl
(),
bi
.
getDbName
(),
bi
.
getDbPassword
());
con
=
DriverManager
.
getConnection
(
bi
.
getDbUrl
(),
bi
.
getDbName
(),
bi
.
getDbPassword
());
pstemt
=
con
.
prepareStatement
(
sql
);
pstemt
=
con
.
prepareStatement
(
sql
);
ResultSet
executeQuery
=
pstemt
.
executeQuery
();
ResultSet
rs
=
pstemt
.
executeQuery
();
while
(
executeQuery
.
next
())
{
while
(
rs
.
next
())
{
String
column
=
executeQuery
.
getString
(
1
);
String
column
=
rs
.
getString
(
1
);
String
jdbcType
=
executeQuery
.
getString
(
2
);
String
jdbcType
=
rs
.
getString
(
2
);
String
comment
=
executeQuery
.
getString
(
3
);
String
comment
=
rs
.
getString
(
3
);
PropertyInfo
ci
=
new
PropertyInfo
();
PropertyInfo
ci
=
new
PropertyInfo
();
ci
.
setColumn
(
column
);
ci
.
setColumn
(
column
);
if
(
jdbcType
.
equalsIgnoreCase
(
"int"
))
{
if
(
jdbcType
.
equalsIgnoreCase
(
"int"
))
{
...
@@ -64,13 +64,25 @@ public class EntityInfoUtil {
...
@@ -64,13 +64,25 @@ public class EntityInfoUtil {
columns
.
add
(
ci
);
columns
.
add
(
ci
);
}
}
bi
.
setCis
(
columns
);
bi
.
setCis
(
columns
);
// 完成后关闭
rs
.
close
();
pstemt
.
close
();
con
.
close
();
return
bi
;
return
bi
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
RuntimeException
(
"自动生成实体类错误:"
+
e
.
getMessage
());
throw
new
RuntimeException
(
"自动生成实体类错误:"
+
e
.
getMessage
());
}
finally
{
}
finally
{
pstemt
.
close
();
// 关闭资源
con
.
close
();
try
{
if
(
pstemt
!=
null
)
pstemt
.
close
();
}
catch
(
SQLException
se2
){
}
// 什么都不做
try
{
if
(
con
!=
null
)
con
.
close
();
}
catch
(
SQLException
se
){
se
.
printStackTrace
();
}
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment