Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
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
yaru
fgqyxxlr
Commits
69cc7a41
Commit
69cc7a41
authored
Oct 15, 2019
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码生成实体根据模板区分不同父字段
parent
9f5067fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
+6
-0
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
+15
-0
ruoyi-generator/src/main/resources/vm/java/domain.java.vm
+2
-2
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
View file @
69cc7a41
...
...
@@ -44,6 +44,12 @@ public class GenConstants
public
static
final
String
[]
COLUMNNAME_NOT_QUERY
=
{
"id"
,
"create_by"
,
"create_time"
,
"del_flag"
,
"update_by"
,
"update_time"
,
"remark"
};
/** Entity基类字段 */
public
static
final
String
[]
BASE_ENTITY
=
{
"createBy"
,
"createTime"
,
"updateBy"
,
"updateTime"
,
"remark"
};
/** Tree基类字段 */
public
static
final
String
[]
TREE_ENTITY
=
{
"parentName"
,
"parentId"
,
"orderNum"
,
"ancestors"
};
/** 文本框 */
public
static
final
String
HTML_INPUT
=
"input"
;
...
...
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
View file @
69cc7a41
...
...
@@ -252,4 +252,18 @@ public class GenTable extends BaseEntity
{
return
tplCategory
!=
null
&&
StringUtils
.
equals
(
GenConstants
.
TPL_CRUD
,
tplCategory
);
}
public
boolean
isSuperColumn
(
String
javaField
)
{
return
isSuperColumn
(
this
.
tplCategory
,
javaField
);
}
public
static
boolean
isSuperColumn
(
String
tplCategory
,
String
javaField
)
{
if
(
isTree
(
tplCategory
))
{
StringUtils
.
equalsAnyIgnoreCase
(
javaField
,
GenConstants
.
TREE_ENTITY
);
}
return
StringUtils
.
equalsAnyIgnoreCase
(
javaField
,
GenConstants
.
BASE_ENTITY
);
}
}
\ No newline at end of file
ruoyi-generator/src/main/resources/vm/java/domain.java.vm
View file @
69cc7a41
...
...
@@ -28,7 +28,7 @@ public class ${ClassName} extends ${Entity}
private
static
final
long
serialVersionUID
=
1L
;
#
foreach
($
column
in
$
columns
)
#
if
(
!$
column.superColumn
)
#
if
(
!$
table.isSuperColumn($column.javaField)
)
/**
$
column
.
columnComment
*/
#
if
($
column
.
list
)
#
set
($
parentheseIndex
=$
column
.
columnComment
.
indexOf
(
"("
))
...
...
@@ -50,7 +50,7 @@ public class ${ClassName} extends ${Entity}
#
end
#
end
#
foreach
($
column
in
$
columns
)
#
if
(
!$
column.superColumn
)
#
if
(
!$
table.isSuperColumn($column.javaField)
)
#
set
($
AttrName
=$
column
.
javaField
.
substring
(
0
,
1
).
toUpperCase
()
+
${
column
.
javaField
.
substring
(
1
)})
public
void
set
${
AttrName
}($
column
.
javaType
$
column
.
javaField
)
{
...
...
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