Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
200f1b52
提交
200f1b52
编写于
8月 12, 2022
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
aipvo
上级
f463a037
变更
15
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
594 行增加
和
6 行删除
+594
-6
AppEntityModel.java
...rc/main/java/cn/ibizlab/codegen/model/AppEntityModel.java
+9
-3
AppModel.java
...core/src/main/java/cn/ibizlab/codegen/model/AppModel.java
+67
-0
Catalog.java
...-core/src/main/java/cn/ibizlab/codegen/model/Catalog.java
+82
-0
CtrlModel.java
...ore/src/main/java/cn/ibizlab/codegen/model/CtrlModel.java
+45
-0
ModelStorage.java
.../src/main/java/cn/ibizlab/codegen/model/ModelStorage.java
+12
-1
Option.java
...r-core/src/main/java/cn/ibizlab/codegen/model/Option.java
+75
-0
VoFieldModel.java
.../src/main/java/cn/ibizlab/codegen/model/VoFieldModel.java
+113
-0
TemplateDefinition.java
...ava/cn/ibizlab/codegen/templating/TemplateDefinition.java
+2
-2
TemplateFileType.java
.../java/cn/ibizlab/codegen/templating/TemplateFileType.java
+2
-0
pom.xml
modules/ibizlab-template/ibizlab-template-apivo/pom.xml
+16
-0
package-info.java
.../java/cn/ibizlab/codegen/template/apivo/package-info.java
+1
-0
pom.xml.hbs
.../src/main/resources/templ/{{projectName}}-api/pom.xml.hbs
+58
-0
{{dicts}}.java.hbs
...java/{{packageName}}/api/{{apps}}/dict/{{dicts}}.java.hbs
+59
-0
{{pascalCase ctrls@FORM}}Dto.java.hbs
...lCase appEntities}}/{{pascalCase ctrls@FORM}}Dto.java.hbs
+52
-0
pom.xml
modules/ibizlab-template/pom.xml
+1
-0
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/AppEntityModel.java
浏览文件 @
200f1b52
...
...
@@ -140,11 +140,17 @@ public class AppEntityModel extends BaseModel{
return
this
;
}
private
EntityModel
entity
;
public
EntityModel
getEntity
()
{
if
(
entity
==
null
)
{
if
(
getAppDataEntity
().
getPSDataEntity
()==
null
)
return
null
;
return
app
.
getSystem
().
getEntity
(
getAppDataEntity
().
getPSDataEntity
().
getCodeName
());
entity
=
app
.
getSystem
().
getEntity
(
getAppDataEntity
().
getCodeName
());
else
entity
=
app
.
getSystem
().
getEntity
(
getAppDataEntity
().
getPSDataEntity
().
getCodeName
());
}
return
entity
;
}
private
String
serviceId
;
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/AppModel.java
浏览文件 @
200f1b52
package
cn
.
ibizlab
.
codegen
.
model
;
import
cn.ibizlab.codegen.utils.Inflector
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Charsets
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
net.ibizsys.model.app.IPSApplication
;
import
net.ibizsys.model.app.codelist.IPSAppCodeList
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.*
;
@Getter
...
...
@@ -142,4 +149,64 @@ public class AppModel extends BaseModel{
}
private
Map
<
String
,
Catalog
>
dictMaps
;
public
Map
<
String
,
Catalog
>
getDictMaps
()
{
return
getDictMaps
(
""
);
}
public
Collection
<
Catalog
>
getDicts
()
{
return
getDictMaps
().
values
();
}
public
Map
<
String
,
Catalog
>
getDictMaps
(
String
rootPath
)
{
if
(
dictMaps
==
null
)
{
dictMaps
=
new
LinkedHashMap
<>();
Map
<
String
,
Catalog
>
catalogs
=
new
LinkedHashMap
<>();
if
(!
ObjectUtils
.
isEmpty
(
rootPath
))
{
java
.
nio
.
file
.
Path
path
=
Paths
.
get
(
rootPath
,
getApplication
().
getDynaModelFilePath
().
replace
(
"/PSSYSAPP.json"
,
"/ALLCODELIST.json"
));
if
(
Files
.
exists
(
path
))
{
try
{
JSON
.
parseArray
(
new
String
(
Files
.
readAllBytes
(
path
),
Charsets
.
UTF_8
),
Catalog
.
class
).
forEach
(
catalog
->
{
if
(
StringUtils
.
isEmpty
(
catalog
.
getName
()))
{
IPSAppCodeList
codeList
=
getApplication
().
getPSAppCodeList
(
catalog
.
getCode
(),
true
);
if
(
codeList
!=
null
)
catalog
.
setName
(
codeList
.
getLogicName
());
catalogs
.
put
(
catalog
.
getCode
(),
catalog
);
}
});
}
catch
(
IOException
e
)
{
//e.printStackTrace();
}
}
}
if
(
this
.
getApplication
().
getAllPSAppCodeLists
()!=
null
)
{
this
.
getApplication
().
getAllPSAppCodeLists
().
forEach
(
codeList
->{
Catalog
catalog
=
catalogs
.
get
(
codeList
.
getCodeName
());
if
(
catalog
!=
null
)
{
catalog
.
setName
(
codeList
.
getName
());
catalog
.
setCodeName
(
codeList
.
getCodeName
());
}
else
{
catalog
=
new
Catalog
().
setCode
(
codeList
.
getCodeName
()).
setName
(
codeList
.
getName
());
catalog
.
setCodeName
(
codeList
.
getCodeName
());
if
(!
ObjectUtils
.
isEmpty
(
codeList
.
getPSCodeItems
()))
{
catalog
.
setCodeItem
(
codeList
.
getPSCodeItems
());
}
}
dictMaps
.
put
(
catalog
.
getCodeName
(),
catalog
);
});
}
}
return
dictMaps
;
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/Catalog.java
0 → 100644
浏览文件 @
200f1b52
package
cn
.
ibizlab
.
codegen
.
model
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
net.ibizsys.model.codelist.IPSCodeItem
;
import
org.springframework.util.ObjectUtils
;
import
java.util.*
;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors
(
chain
=
true
)
public
class
Catalog
extends
BaseModel
{
private
String
code
;
private
String
name
;
@JSONField
(
name
=
"items"
)
@JsonProperty
(
"items"
)
private
List
<
Option
>
options
=
new
ArrayList
<>();
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
String
getValueType
()
{
return
ObjectUtils
.
isEmpty
(
options
)?
"String"
:
options
.
get
(
0
).
getValueType
();
}
public
Option
findCodeItem
(
Object
value
)
{
return
findCodeItem
(
value
,
this
.
options
);
}
public
Option
findCodeItem
(
Object
value
,
List
<
Option
>
options
){
for
(
Option
codeItem
:
options
){
if
(
value
!=
null
&&
codeItem
.
getValue
()
!=
null
&&
value
.
equals
(
codeItem
.
getValue
()))
return
codeItem
;
else
if
(!
ObjectUtils
.
isEmpty
(
codeItem
.
getChildren
()))
{
Option
rt
=
findCodeItem
(
value
,
codeItem
.
getChildren
());
if
(
rt
!=
null
)
return
rt
;
}
}
return
null
;
}
public
List
<
Option
>
loop
(
Map
<
String
,
List
<
Option
>>
listCodeItem
,
Object
parentValue
)
{
List
<
Option
>
trees
=
new
ArrayList
<
Option
>();
if
(
listCodeItem
.
containsKey
(
parentValue
))
{
for
(
Option
codeItem
:
listCodeItem
.
get
(
parentValue
))
{
List
<
Option
>
childCodeItem
=
loop
(
listCodeItem
,
codeItem
.
getValue
());
if
(
childCodeItem
.
size
()
>
0
)
codeItem
.
setChildren
(
childCodeItem
);
trees
.
add
(
codeItem
);
}
}
return
trees
;
}
public
Catalog
setCodeItem
(
List
<
IPSCodeItem
>
items
)
{
items
.
forEach
(
item
->{
options
.
add
(
new
Option
().
setItem
(
item
));
});
return
this
;
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/CtrlModel.java
浏览文件 @
200f1b52
...
...
@@ -13,6 +13,7 @@ import net.ibizsys.model.control.IPSControlContainer;
import
net.ibizsys.model.control.dashboard.IPSDBContainerPortletPart
;
import
net.ibizsys.model.control.dashboard.IPSDBPortletPart
;
import
net.ibizsys.model.control.dataview.IPSDEDataView
;
import
net.ibizsys.model.control.form.*
;
import
net.ibizsys.model.control.grid.IPSDEGrid
;
import
net.ibizsys.model.control.grid.IPSDEGridColumn
;
import
net.ibizsys.model.control.list.IPSList
;
...
...
@@ -20,6 +21,7 @@ import net.ibizsys.model.control.panel.IPSLayoutPanel;
import
net.ibizsys.model.control.toolbar.IPSDETBUIActionItem
;
import
net.ibizsys.model.control.toolbar.IPSDEToolbar
;
import
net.ibizsys.model.view.IPSUIAction
;
import
org.springframework.util.ObjectUtils
;
import
java.util.*
;
...
...
@@ -301,4 +303,47 @@ public class CtrlModel extends BaseModel{
return
false
;
}
private
List
<
VoFieldModel
>
voItems
;
public
List
<
VoFieldModel
>
getVoItems
()
{
if
(
voItems
==
null
&&
this
.
getControl
()
instanceof
IPSDEEditForm
)
{
IPSDEEditForm
editForm
=(
IPSDEEditForm
)
this
.
getControl
();
if
(
editForm
.
getPSDEFormItems
()!=
null
)
{
voItems
=
new
ArrayList
<>();
editForm
.
getPSDEFormPages
().
forEach
(
page
->{
loopItem
(
page
.
getPSDEFormDetails
()).
forEach
(
item
->{
VoFieldModel
field
=
new
VoFieldModel
(
this
,
item
);
voItems
.
add
(
field
);
});
});
}
}
return
voItems
;
}
public
List
<
IPSDEFormItem
>
loopItem
(
List
<
IPSDEFormDetail
>
items
)
{
List
<
IPSDEFormItem
>
list
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
items
))
{
for
(
IPSDEFormDetail
item:
items
)
{
if
(
item
instanceof
IPSDEFormItem
)
{
list
.
add
((
IPSDEFormItem
)
item
);
}
else
if
(
item
instanceof
IPSDEFormGroupBase
)
{
list
.
addAll
(
loopItem
(((
IPSDEFormGroupBase
)
item
).
getPSDEFormDetails
()));
}
}
}
return
list
;
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/ModelStorage.java
浏览文件 @
200f1b52
...
...
@@ -39,10 +39,12 @@ public class ModelStorage {
private
SystemModel
systemModel
=
null
;
private
String
strPSModelFolderPath
=
null
;
public
SystemModel
getSystemModel
()
{
if
(
systemModel
==
null
)
{
String
modelPath
=
config
.
getInputSpec
();
String
strPSModelFolderPath
=
null
;
if
(
Files
.
exists
(
Paths
.
get
(
modelPath
,
"PSSYSTEM.json"
)))
{
strPSModelFolderPath
=
Paths
.
get
(
modelPath
).
toString
();
}
else
if
(
Files
.
exists
(
Paths
.
get
(
modelPath
,
"model"
,
"PSSYSTEM.json"
)))
{
...
...
@@ -135,6 +137,15 @@ public class ModelStorage {
});
});
}
else
if
(
type
.
equals
(
TemplateFileType
.
dict
))
{
getSystemModel
().
getApps
().
forEach
(
app
->{
app
.
getDictMaps
(
strPSModelFolderPath
).
values
().
forEach
(
item
->{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
dict
).
baseData
(
item
,
StringAdvUtils
.
pascalcase
(
item
.
getCodeName
())).
set
(
"apps"
,
app
.
getCodeName
().
toLowerCase
());
rt
.
addOption
(
opt
);
});
});
}
else
if
(
type
.
equals
(
TemplateFileType
.
entity
))
{
getSystemModel
().
getEntities
().
forEach
(
item
->
{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
entity
).
setCliSubType
(
item
.
getStorage
()).
setModule
(
item
.
getModule
())
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/Option.java
0 → 100644
浏览文件 @
200f1b52
package
cn
.
ibizlab
.
codegen
.
model
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
net.ibizsys.model.codelist.IPSCodeItem
;
import
org.springframework.util.ObjectUtils
;
import
java.util.*
;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors
(
chain
=
true
)
public
class
Option
{
private
String
id
;
private
Object
value
;
private
String
label
;
private
List
<
Option
>
children
;
private
String
iconClass
;
private
String
filter
;
private
Boolean
disabled
;
private
String
parent
;
private
Map
<
String
,
Object
>
extension
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
Set
<
String
>
getFilterSet
()
{
Set
<
String
>
set
=
new
HashSet
<>();
if
(!
ObjectUtils
.
isEmpty
(
filter
))
for
(
String
str:
filter
.
split
(
";|,"
))
set
.
add
(
str
);
return
set
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
String
getValueType
()
{
if
(
value
==
null
||
value
instanceof
CharSequence
)
return
"String"
;
else
return
"Integer"
;
}
public
Option
addChildren
(
Option
item
)
{
if
(
children
==
null
)
children
=
new
ArrayList
<
Option
>();
children
.
add
(
item
);
item
.
setParent
(
this
.
getValue
().
toString
());
return
this
;
}
public
Option
setItem
(
IPSCodeItem
item
)
{
this
.
setId
(
item
.
getValue
()).
setValue
(
item
.
getValue
()).
setLabel
(
item
.
getText
()).
setIconClass
(
item
.
getIconCls
());
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPSCodeItems
()))
{
item
.
getPSCodeItems
().
forEach
(
child
->{
this
.
addChildren
(
new
Option
().
setItem
(
child
));
});
}
return
this
;
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/VoFieldModel.java
0 → 100644
浏览文件 @
200f1b52
package
cn
.
ibizlab
.
codegen
.
model
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
net.ibizsys.model.app.dataentity.IPSAppDEField
;
import
net.ibizsys.model.control.IPSEditor
;
import
net.ibizsys.model.control.form.IPSDEForm
;
import
net.ibizsys.model.control.form.IPSDEFormItem
;
import
net.ibizsys.model.dataentity.service.IPSDEMethodDTOField
;
import
org.springframework.util.StringUtils
;
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
public
class
VoFieldModel
extends
BaseModel
{
private
CtrlModel
voModel
;
private
PropType
type
;
public
VoFieldModel
(
CtrlModel
voModel
,
IPSDEFormItem
formItem
)
{
this
.
opt
=
formItem
;
this
.
voModel
=
voModel
;
this
.
setCodeName
(
StringUtils
.
isEmpty
(
formItem
.
getCodeName
())?
formItem
.
getName
():
formItem
.
getCodeName
());
this
.
setName
(
formItem
.
getName
());
}
public
IPSDEFormItem
getPSDEFormItem
()
{
return
(
IPSDEFormItem
)
opt
;
}
public
IPSEditor
getPSEditor
()
{
return
getPSDEFormItem
().
getPSEditor
();
}
public
IPSDEForm
getPSDEForm
()
{
return
(
IPSDEForm
)
getVoModel
().
getControl
();
}
private
FieldModel
appDEField
;
public
FieldModel
getAppDEField
()
{
if
(
appDEField
==
null
)
{
appDEField
=
getVoModel
().
getAppEntity
().
getEntity
().
getFieldMap
().
get
(
this
.
getName
().
toUpperCase
());
}
return
appDEField
;
}
public
PropType
getType
()
{
type
=
PropType
.
findType
(
this
.
getPSDEFormItem
().
getDataType
());
return
type
;
}
public
String
getLogicName
()
{
String
logicName
=
this
.
getPSDEFormItem
().
getCaption
();
if
(
StringUtils
.
isEmpty
(
logicName
)&&
this
.
getPSEditor
()!=
null
)
{
logicName
=
this
.
getPSEditor
().
getLogicName
();
}
if
(
StringUtils
.
isEmpty
(
logicName
)&&
this
.
getAppDEField
()!=
null
)
{
logicName
=
this
.
getAppDEField
().
getLogicName
();
}
return
logicName
;
}
public
String
javaType
()
{
return
getType
().
getJava
();
}
private
String
format
;
private
String
timeType
;
public
String
getTimeType
()
{
getFormat
();
return
timeType
;
}
public
String
getFormat
(){
if
(
"Timestamp"
.
equals
(
getType
().
getJava
()))
{
if
(
this
.
getPSDEFormItem
().
getDataType
()==
PropType
.
DATE
.
getCode
()||
"%1$tY-%1$tm-%1$td"
.
equalsIgnoreCase
(
this
.
getPSDEFormItem
().
getValueFormat
())){
timeType
=
"DATE"
;
format
=
"yyyy-MM-dd"
;
}
else
if
(
this
.
getPSDEFormItem
().
getDataType
()==
PropType
.
TIME
.
getCode
()||
"%1$tH:%1$tM:%1$tS"
.
equalsIgnoreCase
(
this
.
getPSDEFormItem
().
getValueFormat
())){
timeType
=
"TIME"
;
format
=
"HH:mm:ss"
;
}
else
{
timeType
=
"DATETIME"
;
format
=
"yyyy-MM-dd HH:mm:ss"
;
}
}
return
format
;
}
public
String
getJsonName
()
{
return
getCodeName
().
toLowerCase
();
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/templating/TemplateDefinition.java
浏览文件 @
200f1b52
...
...
@@ -68,8 +68,8 @@ public class TemplateDefinition {
String
[]
pairs
=
m
.
group
(
1
).
split
(
"@"
);
if
(
type
.
name
().
equalsIgnoreCase
(
pairs
[
0
])
||
type
.
value
().
equalsIgnoreCase
(
pairs
[
0
])
||
type
.
name
().
endsWith
(
" "
+
pairs
[
0
]
)
||
type
.
value
().
endsWith
(
" "
+
pairs
[
0
]
)
||
pairs
[
0
].
endsWith
(
" "
+
type
.
name
()
)
||
pairs
[
0
].
endsWith
(
" "
+
type
.
value
()
)
||
type
.
name
().
startsWith
(
pairs
[
0
]+
"."
)
||
type
.
value
().
startsWith
(
pairs
[
0
]+
"."
)
)
{
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/templating/TemplateFileType.java
浏览文件 @
200f1b52
...
...
@@ -15,6 +15,7 @@ public enum TemplateFileType {
subEntity
(
Constants
.
SUB_ENTITIES
),
api
(
Constants
.
APIS
),
app
(
Constants
.
APPS
),
dict
(
Constants
.
DICTS
),
supportingFiles
(
Constants
.
SUPPORTING_FILES
);
private
final
String
templateType
;
...
...
@@ -51,6 +52,7 @@ public enum TemplateFileType {
public
static
class
Constants
{
public
static
final
String
APIS
=
"apis"
;
public
static
final
String
APPS
=
"apps"
;
public
static
final
String
DICTS
=
"dicts"
;
public
static
final
String
ENTITIES
=
"entities"
;
public
static
final
String
WORKFLOWS
=
"workflows"
;
public
static
final
String
SYSUTILS
=
"syUtils"
;
...
...
modules/ibizlab-template/ibizlab-template-apivo/pom.xml
0 → 100644
浏览文件 @
200f1b52
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
ibizlab-template
</artifactId>
<groupId>
cn.ibizlab
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
ibizlab-template-apivo
</artifactId>
<groupId>
cn.ibizlab
</groupId>
<version>
1.0-SNAPSHOT
</version>
</project>
\ No newline at end of file
modules/ibizlab-template/ibizlab-template-apivo/src/main/java/cn/ibizlab/codegen/template/apivo/package-info.java
0 → 100644
浏览文件 @
200f1b52
package
cn
.
ibizlab
.
codegen
.
template
.
apivo
;
\ No newline at end of file
modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-api/pom.xml.hbs
0 → 100644
浏览文件 @
200f1b52
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<artifactId>
{{
projectName
}}
</artifactId>
<groupId>
{{
packageName
}}
</groupId>
<version>
{{
system
.
pub
.
versionString
}}
</version>
</parent>
<artifactId>
{{
projectName
}}
-api
</artifactId>
<name>
{{
projectDesc
}}
Api
</name>
<description>
{{
projectDesc
}}
Api
</description>
<build>
<resources>
<resource>
<directory>
${basedir}/src/main/resources
</directory>
<includes>
<include>
**/**
</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>
cn.ibizlab
</groupId>
<artifactId>
ibizlab-generator-plugin
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<configuration>
<output>
../
</output>
<inputSpec>
</inputSpec>
<templateDirs>
${basedir}/src/main/resources/templ
</templateDirs>
<packageName>
${project.groupId}
</packageName>
<name>
${parent.artifactId}
</name>
</configuration>
<dependencies>
<dependency>
<groupId>
cn.ibizlab
</groupId>
<artifactId>
ibizlab-template-apivo
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-api/src/main/java/{{packageName}}/api/{{apps}}/dict/{{dicts}}.java.hbs
0 → 100644
浏览文件 @
200f1b52
package
{{
packageName
}}
.api.
{{
apps
}}
.dict.
{{
pascalCase
dict
.
codeName
}}
;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
*
{{
dict
.
name
}}
*/
public class
{{
pascalCase
dict
.
codeName
}}
{
{{#
each
dict
.
options
}}
{{#
eq
dict
.
valueType
"String"
}}
V_
{{
value
}}
_N_
{{
label
}}
("
{{
value
}}
","
{{
label
}}
",
{{#if
parent
}}
"
{{
parent
}}
"
{{else}}
null
{{/if}}
)
{{#if
@last
}}
;
{{else}}
,
{{/if}}
{{/
eq
}}
{{#
eq
dict
.
valueType
"Integer"
}}
V_
{{
value
}}
_N_
{{
label
}}
(
{{
value
}}
,"
{{
label
}}
",
{{#if
parent
}}{{
parent
}}{{else}}
null
{{/if}}
)
{{#if
@last
}}
;
{{else}}
,
{{/if}}
{{/
eq
}}
{{/
each
}}
private
{{
dict
.
valueType
}}
value;
@JsonValue
@JSONField
public
{{
dict
.
valueType
}}
getValue() {
return value;
}
private String label;
public String getLabel() {
return label;
}
private
{{
dict
.
valueType
}}
parent;
public
{{
dict
.
valueType
}}
getParent() {
return parent;
}
{{
pascalCase
dict
.
codeName
}}
(
{{
dict
.
valueType
}}
value, String label,
{{
dict
.
valueType
}}
parent) {
this.value = value;
this.label = label;
this.parent = parent;
}
@JsonCreator
@JSONCreator
public static
{{
pascalCase
dict
.
codeName
}}
valueOf(Object tag) {
if(tag==null)
return null;
for (
{{
pascalCase
dict
.
codeName
}}
item : values())
if (item.getValue().equals(tag)
{{#
eq
dict
.
valueType
"Integer"
}}
||item.getValue().toString().equals(tag)
{{/
eq
}}
)
return item;
Sjjcy ret =null;
for (
{{
pascalCase
dict
.
codeName
}}
item : values())
if (item.getLabel().equals(tag))
ret = item;
return ret;
}
}
\ No newline at end of file
modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-api/src/main/java/{{packageName}}/api/{{apps}}/dto/{{pascalCase appEntities}}/{{pascalCase ctrls@FORM}}Dto.java.hbs
0 → 100644
浏览文件 @
200f1b52
package
{{
packageName
}}
.api.
{{
apps
}}
.dto.
{{
pascalCase
appEntity
.
codeName
}}
;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.math.BigInteger;
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.alibaba.fastjson.annotation.JSONField;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.*;
import lombok.experimental.Accessors;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
{{
ctrl
.
appEntity
.
entity
.
logicName
}}
DTO对象[
{{
ctrl
.
codeName
}}
]
{{
replace
ctrl
.
logicName
"编辑"
""
}}
*/
@Getter
@Setter
@NoArgsConstructor
@ApiModel("
{{
ctrl
.
appEntity
.
entity
.
logicName
}}
DTO对象[
{{
ctrl
.
codeName
}}
]")
public class
{{
ctrl
.
codeName
}}
Dto implements Serializable {
private static final long serialVersionUID = 1L;
{{#
each
ctrl
.
voItems
}}
/**
*
{{
logicName
}}
*/
@JsonProperty("
{{
camelCase
codeName
}}
")
{{#
timeType
}}
@JsonFormat(pattern = "
{{
format
}}
", locale = "zh", timezone = "GMT+8")
{{/
timeType
}}
@JSONField(name = "
{{
jsonName
}}
"
{{#
timeType
}}
, format = "
{{
format
}}
"
{{/
timeType
}}
)
{{#
eq
javaType
"Long"
}}
@JsonSerialize(using = ToStringSerializer.class)
{{/
eq
}}
@ApiModelProperty("
{{
logicName
}}
")
private
{{
javaType
}}
{{
camelCase
codeName
}}
;
{{/
each
}}
}
\ No newline at end of file
modules/ibizlab-template/pom.xml
浏览文件 @
200f1b52
...
...
@@ -18,6 +18,7 @@
<module>
ibizlab-template-doc
</module>
<module>
ibizlab-template-r7
</module>
<module>
ibizlab-template-r8
</module>
<module>
ibizlab-template-apivo
</module>
</modules>
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录