Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
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
曲欣亮
common
Commits
2fb94851
Commit
2fb94851
authored
Dec 28, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
fbee8f62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
ReverseUtil.java
src/main/java/com/egolm/common/jdbc/dialect/ReverseUtil.java
+3
-6
No files found.
src/main/java/com/egolm/common/jdbc/dialect/ReverseUtil.java
View file @
2fb94851
...
...
@@ -33,6 +33,7 @@ public class ReverseUtil {
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"package "
+
pkg_name
+
";"
+
"\n\n"
);
sb
.
append
(
"import javax.persistence.Entity;"
+
"\n\n"
);
sb
.
append
(
"import javax.persistence.Column;"
+
"\n\n"
);
if
(
paramyKeys
.
size
()
>
0
)
{
sb
.
append
(
"import javax.persistence.Id;"
+
"\n\n"
);
}
...
...
@@ -54,7 +55,7 @@ public class ReverseUtil {
sb
.
append
(
"@Entity(name=\""
+
name
+
"\")"
+
"\n"
);
sb
.
append
(
"public class "
+
StringUtil
.
upperFirst
(
name
)
+
" implements java.io.Serializable {"
+
"\n\n"
+
"\tprivate static final long serialVersionUID = 1L;"
+
"\n\n"
);
processAllAttrs
(
paramyKeys
,
columnNames
,
colTypes
,
colComments
,
sb
);
processAllConstructor
(
StringUtil
.
upperFirst
(
name
),
comment
,
columnNames
,
colTypes
,
colComments
,
sb
);
//
processAllConstructor(StringUtil.upperFirst(name), comment, columnNames, colTypes, colComments, sb);
processAllMethod
(
columnNames
,
colTypes
,
colComments
,
sb
);
sb
.
append
(
"}"
+
"\n"
);
String
outputPath
=
root
+
File
.
separator
+
pkg_name
.
replace
(
"."
,
File
.
separator
)
+
File
.
separator
+
StringUtil
.
upperFirst
(
name
)
+
".java"
;
...
...
@@ -74,14 +75,10 @@ public class ReverseUtil {
public
static
void
processAllAttrs
(
List
<
String
>
paramyKeys
,
List
<
String
>
columnNames
,
List
<
String
>
colTypes
,
List
<
String
>
columnComments
,
StringBuffer
sbuffer
)
{
for
(
int
i
=
0
;
i
<
columnNames
.
size
();
i
++)
{
String
columnName
=
columnNames
.
get
(
i
);
if
(
StringUtil
.
isNotBlank
(
columnComments
.
get
(
i
)))
{
sbuffer
.
append
(
"\t/**"
+
"\n"
);
sbuffer
.
append
(
"\t * "
+
columnComments
.
get
(
i
)
+
"\n"
);
sbuffer
.
append
(
"\t */"
+
"\n"
);
}
if
(
StringUtil
.
contains
(
paramyKeys
.
toArray
(
new
String
[
paramyKeys
.
size
()]),
columnName
))
{
sbuffer
.
append
(
"\t@Id"
+
"\n"
);
}
sbuffer
.
append
(
"\t@Column(columnDefinition=\""
+
colTypes
.
get
(
i
)
+
(
StringUtil
.
isNotBlank
(
columnComments
.
get
(
i
))
?
" COMMENT '"
+
columnComments
.
get
(
i
)
:
""
)
+
"'\")"
+
"\n"
);
sbuffer
.
append
(
"\tprivate "
+
sqlType2JavaType
(
colTypes
.
get
(
i
))
+
" "
+
columnName
+
";"
+
"\n\n"
);
}
sbuffer
.
append
(
"\n"
);
...
...
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