Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
24e16db1
提交
24e16db1
编写于
12月 19, 2021
作者:
ibiz4j
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xiugai
上级
34a81fb9
变更
12
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
261 行增加
和
35 行删除
+261
-35
.gitignore
.gitignore
+1
-0
CodegenConfig.java
...-core/src/main/java/cn/ibizlab/codegen/CodegenConfig.java
+1
-0
EntityModel.java
...e/src/main/java/cn/ibizlab/codegen/model/EntityModel.java
+46
-21
FieldModel.java
...re/src/main/java/cn/ibizlab/codegen/model/FieldModel.java
+92
-0
LabelExt.java
...core/src/main/java/cn/ibizlab/codegen/model/LabelExt.java
+9
-2
RelationshipModel.java
...main/java/cn/ibizlab/codegen/model/RelationshipModel.java
+6
-0
TransUtils.java
...re/src/main/java/cn/ibizlab/codegen/model/TransUtils.java
+1
-1
MustacheEngineAdapter.java
.../cn/ibizlab/codegen/templating/MustacheEngineAdapter.java
+2
-0
PluralizeLambda.java
.../ibizlab/codegen/templating/mustache/PluralizeLambda.java
+60
-0
pom.xml
...bizlab-generator-core/src/main/resources/templ/r7/pom.xml
+1
-1
{{entities#SQL}}.java
.../{{packageName}}/{{modules}}/domain/{{entities#SQL}}.java
+40
-8
{{entities}}ServiceImpl.java
...e}}/{{modules}}/service/impl/{{entities}}ServiceImpl.java
+2
-2
未找到文件。
.gitignore
浏览文件 @
24e16db1
...
@@ -12,4 +12,5 @@
...
@@ -12,4 +12,5 @@
**.iml
**.iml
*.jar
*.jar
*.log
*.log
.model
.DS_Store
.DS_Store
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/CodegenConfig.java
浏览文件 @
24e16db1
...
@@ -115,6 +115,7 @@ public class CodegenConfig {
...
@@ -115,6 +115,7 @@ public class CodegenConfig {
additionalProperties
.
put
(
"snakecase"
,
new
SnakecaseLambda
());
additionalProperties
.
put
(
"snakecase"
,
new
SnakecaseLambda
());
additionalProperties
.
put
(
"spinalcase"
,
new
SpinalcaseLambda
());
additionalProperties
.
put
(
"spinalcase"
,
new
SpinalcaseLambda
());
additionalProperties
.
put
(
"titlecase"
,
new
TitlecaseLambda
());
additionalProperties
.
put
(
"titlecase"
,
new
TitlecaseLambda
());
additionalProperties
.
put
(
"pluralize"
,
new
PluralizeLambda
());
additionalProperties
.
put
(
"camelcase"
,
new
CamelCaseLambda
(
true
).
generator
(
this
));
additionalProperties
.
put
(
"camelcase"
,
new
CamelCaseLambda
(
true
).
generator
(
this
));
additionalProperties
.
put
(
"pascalcase"
,
new
CamelCaseLambda
(
false
).
generator
(
this
));
additionalProperties
.
put
(
"pascalcase"
,
new
CamelCaseLambda
(
false
).
generator
(
this
));
additionalProperties
.
put
(
"indented"
,
new
IndentedLambda
());
additionalProperties
.
put
(
"indented"
,
new
IndentedLambda
());
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/EntityModel.java
浏览文件 @
24e16db1
...
@@ -32,29 +32,29 @@ public class EntityModel extends BaseModel {
...
@@ -32,29 +32,29 @@ public class EntityModel extends BaseModel {
public
String
getEntityName
()
{
public
String
getEntityName
()
{
return
getEntity
().
getName
();
return
get
Data
Entity
().
getName
();
}
}
public
String
getTableName
()
{
public
String
getTableName
()
{
return
getEntity
().
getTableName
();
return
get
Data
Entity
().
getTableName
();
}
}
public
String
getLogicName
()
{
public
String
getLogicName
()
{
return
getEntity
().
getLogicName
();
return
get
Data
Entity
().
getLogicName
();
}
}
public
String
getModule
()
{
public
String
getModule
()
{
if
(
getEntity
().
getPSSystemModule
()!=
null
)
if
(
get
Data
Entity
().
getPSSystemModule
()!=
null
)
return
getEntity
().
getPSSystemModule
().
getCodeName
().
toLowerCase
();
return
get
Data
Entity
().
getPSSystemModule
().
getCodeName
().
toLowerCase
();
return
"ungroup"
;
return
"ungroup"
;
}
}
public
IPSDataEntity
getEntity
(){
public
IPSDataEntity
get
Data
Entity
(){
return
(
IPSDataEntity
)
opt
;
return
(
IPSDataEntity
)
opt
;
}
}
...
@@ -159,7 +159,7 @@ public class EntityModel extends BaseModel {
...
@@ -159,7 +159,7 @@ public class EntityModel extends BaseModel {
public
boolean
isLogicValid
()
public
boolean
isLogicValid
()
{
{
return
getEntity
().
isLogicValid
();
return
get
Data
Entity
().
isLogicValid
();
}
}
...
@@ -184,7 +184,7 @@ public class EntityModel extends BaseModel {
...
@@ -184,7 +184,7 @@ public class EntityModel extends BaseModel {
public
String
getValidLogicValue
()
public
String
getValidLogicValue
()
{
{
String
validLogicValue
=
this
.
getEntity
().
getValidLogicValue
();
String
validLogicValue
=
this
.
get
Data
Entity
().
getValidLogicValue
();
if
(
StringUtils
.
isEmpty
(
validLogicValue
))
if
(
StringUtils
.
isEmpty
(
validLogicValue
))
validLogicValue
=
"1"
;
validLogicValue
=
"1"
;
return
validLogicValue
;
return
validLogicValue
;
...
@@ -193,7 +193,7 @@ public class EntityModel extends BaseModel {
...
@@ -193,7 +193,7 @@ public class EntityModel extends BaseModel {
public
String
getInvalidLogicValue
()
public
String
getInvalidLogicValue
()
{
{
String
invalidLogicValue
=
this
.
getEntity
().
getInvalidLogicValue
();
String
invalidLogicValue
=
this
.
get
Data
Entity
().
getInvalidLogicValue
();
if
(
StringUtils
.
isEmpty
(
invalidLogicValue
))
if
(
StringUtils
.
isEmpty
(
invalidLogicValue
))
invalidLogicValue
=
"0"
;
invalidLogicValue
=
"0"
;
return
invalidLogicValue
;
return
invalidLogicValue
;
...
@@ -245,7 +245,7 @@ public class EntityModel extends BaseModel {
...
@@ -245,7 +245,7 @@ public class EntityModel extends BaseModel {
public
String
getDsName
()
public
String
getDsName
()
{
{
String
dsName
=
this
.
getEntity
().
getDSLink
();
String
dsName
=
this
.
get
Data
Entity
().
getDSLink
();
if
(
StringUtils
.
isEmpty
(
dsName
)||
"DEFAULT"
.
equalsIgnoreCase
(
dsName
))
if
(
StringUtils
.
isEmpty
(
dsName
)||
"DEFAULT"
.
equalsIgnoreCase
(
dsName
))
{
{
dsName
=
"master"
;
dsName
=
"master"
;
...
@@ -383,6 +383,8 @@ public class EntityModel extends BaseModel {
...
@@ -383,6 +383,8 @@ public class EntityModel extends BaseModel {
rel
.
setRelationType
(
der
.
getDERType
()).
setCodeName
(
der
.
getCodeName
()).
setEntityId
(
der
.
getMajorPSDataEntity
().
getId
())
rel
.
setRelationType
(
der
.
getDERType
()).
setCodeName
(
der
.
getCodeName
()).
setEntityId
(
der
.
getMajorPSDataEntity
().
getId
())
.
setEntityCodeName
(
der
.
getMajorPSDataEntity
().
getCodeName
()).
setEntityName
(
der
.
getMajorPSDataEntity
().
getName
())
.
setEntityCodeName
(
der
.
getMajorPSDataEntity
().
getCodeName
()).
setEntityName
(
der
.
getMajorPSDataEntity
().
getName
())
.
setEntityLogicName
(
der
.
getMajorPSDataEntity
().
getLogicName
()).
setTableName
(
der
.
getMajorPSDataEntity
().
getTableName
());
.
setEntityLogicName
(
der
.
getMajorPSDataEntity
().
getLogicName
()).
setTableName
(
der
.
getMajorPSDataEntity
().
getTableName
());
if
(
der
.
getMajorPSDataEntity
().
getPSSystemModule
()!=
null
)
rel
.
setModule
(
der
.
getMajorPSDataEntity
().
getPSSystemModule
().
getCodeName
().
toLowerCase
());
...
@@ -406,25 +408,45 @@ public class EntityModel extends BaseModel {
...
@@ -406,25 +408,45 @@ public class EntityModel extends BaseModel {
{
{
for
(
IPSDERBase
der
:
dataEntity
.
getMajorPSDERs
())
for
(
IPSDERBase
der
:
dataEntity
.
getMajorPSDERs
())
{
{
if
(
StringUtils
.
isEmpty
(
der
.
getMinorCodeName
()))
continue
;
RelationshipModel
rel
=
new
RelationshipModel
(
this
,
der
);
rel
.
setRelationType
(
der
.
getDERType
()).
setCodeName
(
der
.
getMinorCodeName
()).
setEntityId
(
der
.
getMinorPSDataEntity
().
getId
())
.
setEntityCodeName
(
der
.
getMinorPSDataEntity
().
getCodeName
()).
setEntityName
(
der
.
getMinorPSDataEntity
().
getName
())
.
setEntityLogicName
(
der
.
getMinorPSDataEntity
().
getLogicName
()).
setTableName
(
der
.
getMinorPSDataEntity
().
getTableName
());
if
(
der
instanceof
IPSDER1N
)
if
(
der
instanceof
IPSDER1N
)
{
{
IPSDER1N
der1n
=(
IPSDER1N
)
der
;
IPSDER1N
der1n
=(
IPSDER1N
)
der
;
String
codeName
=
der
.
getMinorCodeName
();
boolean
nestedRS
=
false
;
if
(
der1n
.
isNestedRS
())
nestedRS
=
true
;
else
if
(
der1n
.
getPSOne2ManyDataDEField
()!=
null
)
{
nestedRS
=
true
;
}
else
if
(
der1n
.
getMinorPSDataEntity
().
getPSSubSysServiceAPIDE
()!=
null
&&
der1n
.
getMinorPSDataEntity
().
getPSSubSysServiceAPIDE
().
isNested
())
{
nestedRS
=
true
;
}
if
(!
nestedRS
)
continue
;
if
(
StringUtils
.
isEmpty
(
codeName
))
codeName
=
der
.
getMinorPSDataEntity
().
getCodeName
();
RelationshipModel
rel
=
new
RelationshipModel
(
this
,
der
);
rel
.
setRelationType
(
der
.
getDERType
()).
setCodeName
(
codeName
).
setEntityId
(
der
.
getMinorPSDataEntity
().
getId
())
.
setEntityCodeName
(
der
.
getMinorPSDataEntity
().
getCodeName
()).
setEntityName
(
der
.
getMinorPSDataEntity
().
getName
())
.
setEntityLogicName
(
der
.
getMinorPSDataEntity
().
getLogicName
()).
setTableName
(
der
.
getMinorPSDataEntity
().
getTableName
());
if
(
der
.
getMinorPSDataEntity
().
getPSSystemModule
()!=
null
)
rel
.
setModule
(
der
.
getMinorPSDataEntity
().
getPSSystemModule
().
getCodeName
().
toLowerCase
());
String
relfieldname
=
der1n
.
getPSPickupDEField
().
getObjectNode
().
get
(
"getRelatedPSDEField"
).
get
(
"name"
).
asText
();
String
relfieldname
=
der1n
.
getPSPickupDEField
().
getObjectNode
().
get
(
"getRelatedPSDEField"
).
get
(
"name"
).
asText
();
LookupModel
lookupModel
=
new
LookupModel
().
setRelationid
(
der
.
getId
())
LookupModel
lookupModel
=
new
LookupModel
().
setRelationid
(
der
.
getId
())
.
setFieldname
(
der1n
.
getPickupDEFName
()).
setReffieldname
(
relfieldname
);
.
setFieldname
(
der1n
.
getPickupDEFName
()).
setReffieldname
(
relfieldname
);
rel
.
addLookup
(
lookupModel
);
rel
.
addLookup
(
lookupModel
);
this
.
addNested
(
rel
);
}
}
this
.
addNested
(
rel
);
}
}
}
}
...
@@ -432,14 +454,17 @@ public class EntityModel extends BaseModel {
...
@@ -432,14 +454,17 @@ public class EntityModel extends BaseModel {
for
(
IPSDEField
defield:
dataEntity
.
getAllPSDEFields
())
for
(
IPSDEField
defield:
dataEntity
.
getAllPSDEFields
())
{
{
String
dict
=
null
;
try
{
dict
=
defield
.
getPSCodeList
()!=
null
?
defield
.
getPSCodeList
().
getCodeName
():
null
;
}
catch
(
Exception
ex
){}
if
(
defield
.
isPasteReset
())
if
(
defield
.
isPasteReset
())
this
.
hasResetField
=
true
;
this
.
hasResetField
=
true
;
FieldModel
fieldModel
=
new
FieldModel
(
this
,
defield
);
FieldModel
fieldModel
=
new
FieldModel
(
this
,
defield
);
try
{
fieldModel
.
setDict
(
defield
.
getPSCodeList
()!=
null
?
defield
.
getPSCodeList
().
getCodeName
():
null
);
}
catch
(
Exception
ex
){}
if
(
defield
.
getAllPSDEFDTColumns
()!=
null
)
if
(
defield
.
getAllPSDEFDTColumns
()!=
null
)
{
{
defield
.
getAllPSDEFDTColumns
().
forEach
(
col
->{
defield
.
getAllPSDEFDTColumns
().
forEach
(
col
->{
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/FieldModel.java
浏览文件 @
24e16db1
...
@@ -8,9 +8,16 @@ import lombok.NoArgsConstructor;
...
@@ -8,9 +8,16 @@ import lombok.NoArgsConstructor;
import
lombok.Setter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
net.ibizsys.model.dataentity.defield.IPSDEField
;
import
net.ibizsys.model.dataentity.defield.IPSDEField
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
cn.ibizlab.codegen.utils.StringAdvUtils
;
import
java.security.Timestamp
;
import
java.util.ArrayList
;
import
java.util.LinkedHashSet
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
@Getter
@Getter
...
@@ -34,6 +41,85 @@ public class FieldModel extends BaseModel {
...
@@ -34,6 +41,85 @@ public class FieldModel extends BaseModel {
return
getDataEntityField
().
getName
();
return
getDataEntityField
().
getName
();
}
}
public
String
getColumnName
()
{
return
getFieldName
().
toLowerCase
();
}
public
String
getJsonName
()
{
return
getDataEntityField
().
getCodeName
().
toLowerCase
();
}
private
String
format
;
private
String
timeType
;
public
String
getTimeType
()
{
getFormat
();
return
timeType
;
}
public
String
getFormat
(){
if
(
"Timestamp"
.
equals
(
getType
().
getJava
())&&
StringUtils
.
isEmpty
(
format
))
{
if
(
getDataEntityField
().
getDataType
().
equals
(
"DATE"
)||
"%1$tY-%1$tm-%1$td"
.
equalsIgnoreCase
(
getDataEntityField
().
getValueFormat
())){
timeType
=
"DATE"
;
format
=
"yyyy-MM-dd"
;
}
else
if
(
getDataEntityField
().
getDataType
().
equals
(
"TIME"
)||
"%1$tH:%1$tM:%1$tS"
.
equalsIgnoreCase
(
getDataEntityField
().
getValueFormat
())){
timeType
=
"TIME"
;
format
=
"HH:mm:ss"
;
}
else
{
timeType
=
"DATETIME"
;
format
=
"yyyy-MM-dd HH:mm:ss"
;
}
}
return
format
;
}
public
boolean
isEnableAudit
()
{
return
getDataEntityField
().
isEnableAudit
()&&
this
.
getEntity
().
getDataEntity
()!=
null
&&
this
.
getEntity
().
getDataEntity
().
getAuditMode
()!=
0
;
}
public
String
getAnnotation
()
{
String
annotation
=
"name = \""
+
getFieldName
().
toLowerCase
()+
"\""
;
if
(!
StringUtils
.
isEmpty
(
getDataEntityField
().
getDefaultValue
()))
annotation
+=
" , defaultValue = \""
+
getDataEntityField
().
getDefaultValue
()+
"\""
;
if
(!
StringUtils
.
isEmpty
(
getDataEntityField
().
getDefaultValueType
()))
annotation
+=
" , defaultValueType = DEFieldDefaultValueType."
+
getDataEntityField
().
getDefaultValueType
().
toUpperCase
();
if
(
isKeyDEField
())
annotation
+=
" , isKeyField = true"
;
if
(!
StringUtils
.
isEmpty
(
getDataEntityField
().
getPredefinedType
()))
annotation
+=
" , preType = DEPredefinedFieldType."
+
getDataEntityField
().
getPredefinedType
().
toUpperCase
();
if
(
isLogicValidField
()){
annotation
+=
" , logicval = \""
+
getEntity
().
getValidLogicValue
()+
"\""
;
annotation
+=
" , logicdelval = \""
+
getEntity
().
getInvalidLogicValue
()+
"\""
;
}
if
(!
StringUtils
.
isEmpty
(
dict
))
annotation
+=
" , dict = \""
+
dict
+
"\""
;
if
(
"ALL"
.
equalsIgnoreCase
(
getDataEntityField
().
getDupCheckMode
()))
{
annotation
+=
" , dupCheck = DupCheck.ALL"
;
if
(!
ObjectUtils
.
isEmpty
(
getDataEntityField
().
getDupCheckPSDEFields
()))
{
List
<
String
>
dups
=
new
ArrayList
<>();
for
(
IPSDEField
dup:
getDataEntityField
().
getDupCheckPSDEFields
()){
dups
.
add
(
StringAdvUtils
.
camelcase
(
dup
.
getCodeName
()));
}
if
(
dups
.
size
()>
0
)
annotation
+=
" , dupCheckField = \""
+
String
.
join
(
","
,
dups
)+
"\""
;
}
}
if
(
isEnableAudit
()&&
getFormat
()!=
null
)
annotation
+=
" , fieldType = \""
+
timeType
+
"\", format = \""
+
format
+
"\""
;
if
(
getDataEntityField
().
isMultiFormDEField
()
&&
getEntity
().
getDataEntity
()!=
null
&&
(
getEntity
().
getDataEntity
().
getDynaInstMode
()==
1
||
getEntity
().
getDataEntity
().
getDynaInstMode
()==
1
))
annotation
+=
" , dynaInstTagField = true"
;
return
annotation
;
}
public
String
getLogicName
()
{
public
String
getLogicName
()
{
return
getDataEntityField
().
getLogicName
();
return
getDataEntityField
().
getLogicName
();
}
}
...
@@ -45,6 +131,7 @@ public class FieldModel extends BaseModel {
...
@@ -45,6 +131,7 @@ public class FieldModel extends BaseModel {
private
String
expression
;
private
String
expression
;
private
String
dict
;
public
IPSDEField
getDataEntityField
()
public
IPSDEField
getDataEntityField
()
{
{
...
@@ -84,6 +171,11 @@ public class FieldModel extends BaseModel {
...
@@ -84,6 +171,11 @@ public class FieldModel extends BaseModel {
return
"CREATEDATE"
.
equals
(
this
.
getDataEntityField
().
getPredefinedType
());
return
"CREATEDATE"
.
equals
(
this
.
getDataEntityField
().
getPredefinedType
());
}
}
public
boolean
isInsertOnly
()
{
return
"CREATEDATE"
.
equals
(
this
.
getDataEntityField
().
getPredefinedType
())||
"CREATEMAN"
.
equals
(
this
.
getDataEntityField
().
getPredefinedType
());
}
public
boolean
isUnionKeyField
()
public
boolean
isUnionKeyField
()
{
{
return
!
StringUtils
.
isEmpty
(
this
.
getDataEntityField
().
getUnionKeyValue
());
return
!
StringUtils
.
isEmpty
(
this
.
getDataEntityField
().
getUnionKeyValue
());
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/LabelExt.java
浏览文件 @
24e16db1
package
cn
.
ibizlab
.
codegen
.
model
;
package
cn
.
ibizlab
.
codegen
.
model
;
import
cn.ibizlab.codegen.utils.Inflector
;
import
cn.ibizlab.codegen.utils.StringAdvUtils
;
import
cn.ibizlab.codegen.utils.StringAdvUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -23,7 +24,6 @@ public class LabelExt implements java.io.Serializable, Comparable<String>, CharS
...
@@ -23,7 +24,6 @@ public class LabelExt implements java.io.Serializable, Comparable<String>, CharS
return
label
.
toUpperCase
();
return
label
.
toUpperCase
();
}
}
public
String
toPascalCase
()
{
public
String
toPascalCase
()
{
return
StringAdvUtils
.
pascalcase
(
label
);
return
StringAdvUtils
.
pascalcase
(
label
);
}
}
...
@@ -44,6 +44,10 @@ public class LabelExt implements java.io.Serializable, Comparable<String>, CharS
...
@@ -44,6 +44,10 @@ public class LabelExt implements java.io.Serializable, Comparable<String>, CharS
return
StringAdvUtils
.
snakecase
(
label
);
return
StringAdvUtils
.
snakecase
(
label
);
}
}
public
String
toPluralize
()
{
return
Inflector
.
getInstance
().
pluralize
(
label
);
}
public
String
getLowerCase
()
public
String
getLowerCase
()
{
{
return
toLowerCase
();
return
toLowerCase
();
...
@@ -54,7 +58,6 @@ public class LabelExt implements java.io.Serializable, Comparable<String>, CharS
...
@@ -54,7 +58,6 @@ public class LabelExt implements java.io.Serializable, Comparable<String>, CharS
return
toUpperCase
();
return
toUpperCase
();
}
}
public
String
getPascalCase
()
{
public
String
getPascalCase
()
{
return
toPascalCase
();
return
toPascalCase
();
}
}
...
@@ -75,6 +78,10 @@ public class LabelExt implements java.io.Serializable, Comparable<String>, CharS
...
@@ -75,6 +78,10 @@ public class LabelExt implements java.io.Serializable, Comparable<String>, CharS
return
toSnakeCase
();
return
toSnakeCase
();
}
}
public
String
getPluralize
()
{
return
toPluralize
();
}
@Override
@Override
public
int
length
()
{
public
int
length
()
{
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/RelationshipModel.java
浏览文件 @
24e16db1
...
@@ -41,11 +41,17 @@ public class RelationshipModel extends BaseModel{
...
@@ -41,11 +41,17 @@ public class RelationshipModel extends BaseModel{
private
String
entityId
;
private
String
entityId
;
private
String
module
;
private
String
tableName
;
private
String
tableName
;
private
String
relationType
;
private
String
relationType
;
private
boolean
nested
;
private
String
listCode
;
public
IPSDERBase
getDer
()
public
IPSDERBase
getDer
()
{
{
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/TransUtils.java
浏览文件 @
24e16db1
...
@@ -207,7 +207,7 @@ public class TransUtils {
...
@@ -207,7 +207,7 @@ public class TransUtils {
POSchema
poSchema
=
new
POSchema
().
setDsType
(
dataSourceType
).
setName
(
entityModel
.
getTableName
(
dataSourceType
)).
setDefaultDataSource
(
entityModel
.
getDsName
())
POSchema
poSchema
=
new
POSchema
().
setDsType
(
dataSourceType
).
setName
(
entityModel
.
getTableName
(
dataSourceType
)).
setDefaultDataSource
(
entityModel
.
getDsName
())
.
setRemarks
(
entityModel
.
getLogicName
()).
setLogicVal
(
entityModel
.
getValidLogicValue
()).
setLogicDelVal
(
entityModel
.
getInvalidLogicValue
());
.
setRemarks
(
entityModel
.
getLogicName
()).
setLogicVal
(
entityModel
.
getValidLogicValue
()).
setLogicDelVal
(
entityModel
.
getInvalidLogicValue
());
poSchema
.
setNode
(
entityModel
.
getEntity
());
poSchema
.
setNode
(
entityModel
.
get
Data
Entity
());
Map
<
String
,
FieldModel
>
keyMap
=
new
LinkedHashMap
<>();
Map
<
String
,
FieldModel
>
keyMap
=
new
LinkedHashMap
<>();
Map
<
String
,
RelationshipModel
>
relationshipModelMap
=
new
LinkedHashMap
<>();
Map
<
String
,
RelationshipModel
>
relationshipModelMap
=
new
LinkedHashMap
<>();
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/templating/MustacheEngineAdapter.java
浏览文件 @
24e16db1
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
cn
.
ibizlab
.
codegen
.
templating
;
package
cn
.
ibizlab
.
codegen
.
templating
;
import
com.samskivert.mustache.Escapers
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
import
com.samskivert.mustache.Template
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -56,6 +57,7 @@ public class MustacheEngineAdapter implements TemplatingEngineAdapter {
...
@@ -56,6 +57,7 @@ public class MustacheEngineAdapter implements TemplatingEngineAdapter {
public
String
compileTemplate
(
TemplatingExecutor
executor
,
Map
<
String
,
Object
>
bundle
,
String
templateFile
)
throws
IOException
{
public
String
compileTemplate
(
TemplatingExecutor
executor
,
Map
<
String
,
Object
>
bundle
,
String
templateFile
)
throws
IOException
{
Template
tmpl
=
compiler
Template
tmpl
=
compiler
.
withLoader
(
name
->
findTemplate
(
executor
,
name
))
.
withLoader
(
name
->
findTemplate
(
executor
,
name
))
.
withEscaper
(
Escapers
.
NONE
)
.
defaultValue
(
""
)
.
defaultValue
(
""
)
.
compile
(
executor
.
getFullTemplateContents
(
templateFile
));
.
compile
(
executor
.
getFullTemplateContents
(
templateFile
));
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/templating/mustache/PluralizeLambda.java
0 → 100644
浏览文件 @
24e16db1
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
cn
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
cn.ibizlab.codegen.CodegenConfig
;
import
cn.ibizlab.codegen.utils.Inflector
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
import
java.io.IOException
;
import
java.io.Writer
;
/**
* Converts text in a fragment to lowercase.
*
* Register:
* <pre>
* additionalProperties.put("lowercase", new LowercaseLambda());
* </pre>
*
* Use:
* <pre>
* {{#lowercase}}{{httpMethod}}{{/lowercase}}
* </pre>
*/
public
class
PluralizeLambda
implements
Mustache
.
Lambda
{
private
CodegenConfig
generator
=
null
;
public
PluralizeLambda
()
{
}
public
PluralizeLambda
generator
(
final
CodegenConfig
generator
)
{
this
.
generator
=
generator
;
return
this
;
}
@Override
public
void
execute
(
Template
.
Fragment
fragment
,
Writer
writer
)
throws
IOException
{
String
text
=
Inflector
.
getInstance
().
pluralize
(
fragment
.
execute
());
writer
.
write
(
text
);
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/pom.xml
浏览文件 @
24e16db1
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<name>
{{projectDesc}}
</name>
<name>
{{projectDesc}}
</name>
<description></description>
<description></description>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
{{>{{{{!}}projectName}}-util/pom.xml}}
<parent>
<parent>
<groupId>
{{packageName}}
</groupId>
<groupId>
{{packageName}}
</groupId>
<artifactId>
{{projectName}}-dependencies
</artifactId>
<artifactId>
{{projectName}}-dependencies
</artifactId>
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/{{modules}}/domain/{{entities#SQL}}.java
浏览文件 @
24e16db1
...
@@ -4,8 +4,8 @@ import java.sql.Timestamp;
...
@@ -4,8 +4,8 @@ import java.sql.Timestamp;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.math.BigInteger
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.alibaba.fastjson.annotation.JSONField
;
...
@@ -19,16 +19,16 @@ import {{packageName}}.util.annotation.DEField;
...
@@ -19,16 +19,16 @@ import {{packageName}}.util.annotation.DEField;
import
{{
packageName
}}.
util
.
enums
.
DEPredefinedFieldType
;
import
{{
packageName
}}.
util
.
enums
.
DEPredefinedFieldType
;
import
{{
packageName
}}.
util
.
enums
.
DEFieldDefaultValueType
;
import
{{
packageName
}}.
util
.
enums
.
DEFieldDefaultValueType
;
import
{{
packageName
}}.
util
.
helper
.
DataObject
;
import
{{
packageName
}}.
util
.
helper
.
DataObject
;
import
{{
packageName
}}.
util
.
annotation
.
Audit
;
import
{{
packageName
}}.
util
.
enums
.
DupCheck
;
import
{{
packageName
}}.
util
.
enums
.
DupCheck
;
import
{{
packageName
}}.
util
.
domain
.
EntityMP
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.*
;
import
org.springframework.data.annotation.Transient
;
import
org.springframework.data.annotation.Transient
;
import
{{
packageName
}}.
util
.
annotation
.
Audit
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.annotation.*
;
import
{{
packageName
}}.
util
.
domain
.
EntityMP
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
@Getter
@Getter
...
@@ -38,27 +38,59 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
...
@@ -38,27 +38,59 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@JsonIgnoreProperties
(
value
=
"handler"
)
@JsonIgnoreProperties
(
value
=
"handler"
)
@TableName
(
value
=
"{{entity.tableName}}"
,
resultMap
=
"{{entity.codeName}}ResultMap"
)
@TableName
(
value
=
"{{entity.tableName}}"
,
resultMap
=
"{{entity.codeName}}ResultMap"
)
@ApiModel
(
"{{entity.logicName}}"
)
@ApiModel
(
"{{entity.logicName}}"
)
public
class
{{
entity
.
codeName
}}
extends
EntityMP
implements
Serializable
public
class
{{
entity
.
codeName
}}
extends
EntityMP
implements
Serializable
{
{
{{
#
entity
.
fields
}}
{{
#
entity
.
fields
}}
/**
* {{logicName}}
*/
{{
#
keyDEField
}}
{{
#
keyDEField
}}
@TableId
(
value
=
"{{name.lowerCase}}"
{{
#
type
.
number
}}
,
type
=
IdType
.
ASSIGN_ID
{{/
type
.
number
}}{{
#
type
.
string
}}
,
type
=
IdType
.
ASSIGN_UUID
{{/
type
.
string
}})
{{
#
phisicalDEField
}}
@TableId
(
value
=
"{{columnName}}"
{{
#
type
.
number
}}
,
type
=
IdType
.
ASSIGN_ID
{{/
type
.
number
}}{{
#
type
.
string
}}
,
type
=
IdType
.
ASSIGN_UUID
{{/
type
.
string
}})
{{/
phisicalDEField
}}
{{/
keyDEField
}}
{{/
keyDEField
}}
{{^
keyDEField
}}
{{^
keyDEField
}}
@TableField
(
value
=
"{{name.lowerCase}}"
{{^
phisicalDEField
}}
,
exist
=
false
{{/
phisicalDEField
}})
@TableField
(
value
=
"{{columnName}}"
{{
#
insertOnly
}}
,
fill
=
FieldFill
.
INSERT
{{/
insertOnly
}}{{^
phisicalDEField
}}
,
exist
=
false
{{/
phisicalDEField
}})
{{
#
logicValidField
}}
@TableLogic
{{
#
validLogicValue
}}(
value
=
"{{validLogicValue}}"
{{
#
invalidLogicValue
}}
,
delval
=
"{{invalidLogicValue}}"
{{/
invalidLogicValue
}}){{/
validLogicValue
}}
{{/
logicValidField
}}
{{/
keyDEField
}}
{{/
keyDEField
}}
@JsonProperty
(
"{{codeName.lowerCase}}"
)
{{
#
enableAudit
}}
@JSONField
(
name
=
"{{codeName.lowerCase}}"
)
@Audit
{{/
enableAudit
}}
@Defield
({{
annotation
}})
@JsonProperty
(
"{{jsonName}}"
)
{{
#
timeType
}}
@JsonFormat
(
pattern
=
"{{format}}"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
{{/
timeType
}}
@JSONField
(
name
=
"{{jsonName}}"
{{
#
timeType
}}
,
format
=
"{{format}}"
{{/
timeType
}})
@ApiModelProperty
(
"{{logicName}}"
)
@ApiModelProperty
(
"{{logicName}}"
)
private
{{
type
.
java
}}
{{
codeName
.
camelCase
}};
private
{{
type
.
java
}}
{{
codeName
.
camelCase
}};
{{/
entity
.
fields
}}
{{/
entity
.
fields
}}
{{
#
entity
.
references
}}
/**
* {{logicName}}
*/
@JsonIgnore
@JSONField
(
serialize
=
false
)
@TableField
(
exist
=
false
)
private
{{
packageName
}}.
core
.{{
module
}}.
domain
.{{
entityCodeName
}}
{{
codeName
.
camelCase
}};
{{/
entity
.
references
}}
{{
#
entity
.
fields
}}
{{
#
entity
.
fields
}}
{{^
keyDEField
}}
{{^
predefinedType
}}
public
{{
entity
.
codeName
}}
set
{{
codeName
.
pascalCase
}}({{
type
.
java
}}
{{
codeName
.
camelCase
}})
{
public
{{
entity
.
codeName
}}
set
{{
codeName
.
pascalCase
}}({{
type
.
java
}}
{{
codeName
.
camelCase
}})
{
this
.{{
codeName
.
camelCase
}}
=
{{
codeName
.
camelCase
}};
this
.{{
codeName
.
camelCase
}}
=
{{
codeName
.
camelCase
}};
this
.
modify
(
"{{name.lowerCase}}"
,
{{
codeName
.
camelCase
}});
this
.
modify
(
"{{name.lowerCase}}"
,
{{
codeName
.
camelCase
}});
return
this
;
return
this
;
}
}
{{/
predefinedType
}}
{{/
keyDEField
}}
{{/
entity
.
fields
}}
{{/
entity
.
fields
}}
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/{{modules}}/service/impl/{{entities}}ServiceImpl.java
浏览文件 @
24e16db1
package
{{
packageName
}}.{{
entity
.
module
}}.
service
.
impl
;
package
{{
packageName
}}.
core
.
{{
entity
.
module
}}.
service
.
impl
;
import
{{
packageName
}}.{{
entity
.
module
}}.
service
.
I
{{
entity
.
codeName
}}
Service
;
import
{{
packageName
}}.
core
.
{{
entity
.
module
}}.
service
.
I
{{
entity
.
codeName
}}
Service
;
public
class
{{
entity
.
codeName
}}
ServiceImpl
implements
I
{{
entity
.
codeName
}}
Service
public
class
{{
entity
.
codeName
}}
ServiceImpl
implements
I
{{
entity
.
codeName
}}
Service
{
{
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录