Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
53acf7a5
提交
53acf7a5
编写于
12月 20, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
24e16db1
变更
5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
82 行增加
和
4 行删除
+82
-4
EntityModel.java
...e/src/main/java/cn/ibizlab/codegen/model/EntityModel.java
+10
-1
FieldModel.java
...re/src/main/java/cn/ibizlab/codegen/model/FieldModel.java
+5
-0
LabelExt.java
...core/src/main/java/cn/ibizlab/codegen/model/LabelExt.java
+1
-1
RelationshipModel.java
...main/java/cn/ibizlab/codegen/model/RelationshipModel.java
+8
-1
{{entities#SQL}}.java
.../{{packageName}}/{{modules}}/domain/{{entities#SQL}}.java
+58
-1
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/EntityModel.java
浏览文件 @
53acf7a5
package
cn
.
ibizlab
.
codegen
.
model
;
import
cn.ibizlab.codegen.utils.DataObject
;
import
cn.ibizlab.codegen.utils.Inflector
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Getter
;
...
...
@@ -228,7 +229,9 @@ public class EntityModel extends BaseModel {
return
unionKeyFields
;
}
public
boolean
isUnionKeyMode
(){
return
!
ObjectUtils
.
isEmpty
(
getUnionKeyFields
());
}
public
List
<
FieldModel
>
getKeyFields
()
{
if
(
this
.
getKeyField
()!=
null
&&
this
.
getKeyField
().
isPhisicalDEField
())
{
...
...
@@ -437,6 +440,12 @@ public class EntityModel extends BaseModel {
if
(
der
.
getMinorPSDataEntity
().
getPSSystemModule
()!=
null
)
rel
.
setModule
(
der
.
getMinorPSDataEntity
().
getPSSystemModule
().
getCodeName
().
toLowerCase
());
if
(
der1n
.
getPSOne2ManyDataDEField
()!=
null
&&
der1n
.
getPSOne2ManyDataDEField
().
isPhisicalDEField
()&&
der1n
.
getMinorPSDataEntity
().
getStorageMode
()==
0
)
{
rel
.
setColumnName
(
der1n
.
getPSOne2ManyDataDEField
().
getName
().
toLowerCase
());
}
String
relfieldname
=
der1n
.
getPSPickupDEField
().
getObjectNode
().
get
(
"getRelatedPSDEField"
).
get
(
"name"
).
asText
();
LookupModel
lookupModel
=
new
LookupModel
().
setRelationid
(
der
.
getId
())
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/FieldModel.java
浏览文件 @
53acf7a5
...
...
@@ -77,6 +77,11 @@ public class FieldModel extends BaseModel {
return
format
;
}
public
boolean
isDeepStructure
()
{
return
"ONE2MANYDATA"
.
equalsIgnoreCase
(
getDataEntityField
().
getDataType
());
}
public
boolean
isEnableAudit
()
{
return
getDataEntityField
().
isEnableAudit
()&&
this
.
getEntity
().
getDataEntity
()!=
null
&&
this
.
getEntity
().
getDataEntity
().
getAuditMode
()!=
0
;
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/LabelExt.java
浏览文件 @
53acf7a5
...
...
@@ -45,7 +45,7 @@ public class LabelExt implements java.io.Serializable, Comparable<String>, CharS
}
public
String
toPluralize
()
{
return
Inflector
.
getInstance
().
pluralize
(
label
);
return
Inflector
.
getInstance
().
pluralize
(
toCamelCase
()
);
}
public
String
getLowerCase
()
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/RelationshipModel.java
浏览文件 @
53acf7a5
...
...
@@ -50,7 +50,14 @@ public class RelationshipModel extends BaseModel{
private
boolean
nested
;
private
String
listCode
;
public
String
getListCode
()
{
if
(
this
.
getDer
().
getMinorPSDataEntity
().
getStorageMode
()==
0
)
return
getCodeName
().
toPluralize
().
toLowerCase
();
return
null
;
}
private
String
columnName
;
public
IPSDERBase
getDer
()
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/{{modules}}/domain/{{entities#SQL}}.java
浏览文件 @
53acf7a5
...
...
@@ -40,7 +40,9 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@ApiModel
(
"{{entity.logicName}}"
)
public
class
{{
entity
.
codeName
}}
extends
EntityMP
implements
Serializable
{
{{
#
entity
.
fields
}}
{{^
deepStructure
}}
/**
* {{logicName}}
*/
...
...
@@ -67,11 +69,12 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
@ApiModelProperty
(
"{{logicName}}"
)
private
{{
type
.
java
}}
{{
codeName
.
camelCase
}};
{{/
deepStructure
}}
{{/
entity
.
fields
}}
{{
#
entity
.
references
}}
/**
* {{
l
ogicName}}
* {{
entityL
ogicName}}
*/
@JsonIgnore
@JSONField
(
serialize
=
false
)
...
...
@@ -79,9 +82,34 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
private
{{
packageName
}}.
core
.{{
module
}}.
domain
.{{
entityCodeName
}}
{{
codeName
.
camelCase
}};
{{/
entity
.
references
}}
{{
#
entity
.
nesteds
}}
/**
* {{entityLogicName}}
*/
{{
#
listCode
}}
@JSONField
(
name
=
"{{listCode}}"
)
@JsonProperty
(
"{{listCode}}"
)
{{/
listCode
}}
{{^
listCode
}}
@JsonIgnore
@JSONField
(
serialize
=
false
)
{{/
listCode
}}
{{
#
columnName
}}
@TableField
(
value
=
"{{columnName}}"
,
typeHandler
=
{{
packageName
}}.
core
.{{
module
}}.
domain
.
handlers
.{{
entityCodeName
}}
TypeHandler
.
class
)
{{/
columnName
}}
{{^
columnName
}}
@TableField
(
exist
=
false
)
{{/
columnName
}}
private
List
<{{
packageName
}}.
core
.{{
module
}}.
domain
.{{
entityCodeName
}}>
{{
codeName
.
camelCase
}};
{{/
entity
.
nesteds
}}
{{
#
entity
.
fields
}}
{{^
deepStructure
}}
{{^
keyDEField
}}
{{^
predefinedType
}}
/**
* 设置 [{{logicName}}]
*/
public
{{
entity
.
codeName
}}
set
{{
codeName
.
pascalCase
}}({{
type
.
java
}}
{{
codeName
.
camelCase
}})
{
this
.{{
codeName
.
camelCase
}}
=
{{
codeName
.
camelCase
}};
this
.
modify
(
"{{name.lowerCase}}"
,
{{
codeName
.
camelCase
}});
...
...
@@ -89,8 +117,37 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
}
{{/
predefinedType
}}
{{/
keyDEField
}}
{{
#
timeType
}}
/**
* 格式化日期 [{{logicName}}]
*/
public
String
format
{{
codeName
.
pascalCase
}}()
{
if
(
this
.{{
codeName
.
camelCase
}}
==
null
)
{
return
null
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"{{format}}"
);
return
sdf
.
format
({{
codeName
.
camelCase
}});
}
{{/
timeType
}}
{{/
deepStructure
}}
{{/
entity
.
fields
}}
{{
#
entity
.
nesteds
}}
{{
#
columnName
}}
/**
* 设置 [{{entityLogicName}}]
*/
public
{{
entity
.
codeName
}}
set
{{
codeName
.
pascalCase
}}(
List
<{{
packageName
}}.
core
.{{
module
}}.
domain
.{{
entityCodeName
}}>
{{
codeName
.
camelCase
}})
{
this
.{{
codeName
.
camelCase
}}
=
{{
codeName
.
camelCase
}};
this
.
modify
(
"{{columnName}}"
,
({{
codeName
.
camelCase
}}!=
null
)?{{
codeName
.
camelCase
}}:(
new
ArrayList
()));
return
this
;
}
{{/
columnName
}}
{{/
entity
.
nesteds
}}
{{
#
unionKeyMode
}}
{{/
unionKeyMode
}}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录