Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
a03c6ef1
提交
a03c6ef1
编写于
1月 06, 2022
作者:
xignzi006
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resource发布
上级
d2544b9f
变更
8
展开全部
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
640 行增加
和
244 行删除
+640
-244
pom.xml
modules/ibizlab-generator-core/pom.xml
+1
-1
ApiEntityModel.java
...rc/main/java/cn/ibizlab/codegen/model/ApiEntityModel.java
+72
-4
ApiEntityRSModel.java
.../main/java/cn/ibizlab/codegen/model/ApiEntityRSModel.java
+59
-0
ApiMethodModel.java
...rc/main/java/cn/ibizlab/codegen/model/ApiMethodModel.java
+118
-0
ApiModel.java
...core/src/main/java/cn/ibizlab/codegen/model/ApiModel.java
+38
-14
ModelStorage.java
.../src/main/java/cn/ibizlab/codegen/model/ModelStorage.java
+92
-83
{{apiEntities}}Resource.java.hbs
...kageName}}/{{apis}}/rest/{{apiEntities}}Resource.java.hbs
+66
-142
{{apiEntities}}Resource_old.java.hbs
...Name}}/{{apis}}/rest/{{apiEntities}}Resource_old.java.hbs
+194
-0
未找到文件。
modules/ibizlab-generator-core/pom.xml
浏览文件 @
a03c6ef1
...
...
@@ -156,7 +156,7 @@
<dependency>
<groupId>
net.ibizsys.model
</groupId>
<artifactId>
ibiz-model
</artifactId>
<version>
0.2.
6
</version>
<version>
0.2.
8
</version>
<exclusions>
<exclusion>
<artifactId>
slf4j-simple
</artifactId>
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/ApiEntityModel.java
浏览文件 @
a03c6ef1
...
...
@@ -6,6 +6,9 @@ import lombok.Setter;
import
lombok.experimental.Accessors
;
import
net.ibizsys.model.dataentity.service.IPSDEMethodDTO
;
import
net.ibizsys.model.dataentity.service.IPSDEServiceAPI
;
import
net.ibizsys.model.dataentity.service.IPSDEServiceAPIMethod
;
import
net.ibizsys.model.dataentity.service.IPSDEServiceAPIRS
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.util.*
;
...
...
@@ -15,6 +18,8 @@ import java.util.*;
@Accessors
(
chain
=
true
)
public
class
ApiEntityModel
extends
BaseModel
{
private
List
<
ApiDtoModel
>
dtos
=
new
ArrayList
<>();
public
ApiEntityModel
(
ApiModel
apiModel
,
IPSDEServiceAPI
apiDataEntity
)
{
this
.
opt
=
apiDataEntity
;
this
.
api
=
apiModel
;
...
...
@@ -23,9 +28,10 @@ public class ApiEntityModel extends BaseModel {
this
.
setId
(
String
.
format
(
"%1$s-%2$s"
,
api
.
getCodeName
(),
apiDataEntity
.
getCodeName
()));
if
(
apiDataEntity
.
getPSDataEntity
()
!=
null
&&
apiDataEntity
.
getPSDataEntity
().
getAllPSDEMethodDTOs
()
!=
null
)
{
for
(
IPSDEMethodDTO
iPSDEMethodDTO
:
apiDataEntity
.
getPSDataEntity
().
getAllPSDEMethodDTOs
())
{
apiDtosMap
.
put
(
iPSDEMethodDTO
.
getName
(),
new
ApiDtoModel
(
this
,
iPSDEMethodDTO
));
dtos
.
add
(
new
ApiDtoModel
(
this
,
iPSDEMethodDTO
));
}
}
}
public
IPSDEServiceAPI
getApiDataEntity
()
{
...
...
@@ -50,10 +56,72 @@ public class ApiEntityModel extends BaseModel {
return
properties
;
}
private
Map
<
String
,
ApiDtoModel
>
apiDtosMap
=
new
LinkedHashMap
<>();
public
Collection
<
ApiDtoModel
>
getDtos
()
{
return
apiDtosMap
.
values
();
public
boolean
isMajor
()
{
return
getApiDataEntity
().
isMajor
();
}
public
List
<
ApiMethodModel
>
getMethods
()
{
if
(
this
.
getCodeName
().
equals
(
"District"
))
{
getApiDataEntity
().
isMajor
();
}
List
<
ApiMethodModel
>
methods
=
new
ArrayList
<>();
//主接口方法
if
(
getApiDataEntity
().
isMajor
()
&&
getApiDataEntity
().
getPSDEServiceAPIMethods
()
!=
null
)
{
for
(
IPSDEServiceAPIMethod
iPSDEServiceAPIMethod
:
getApiDataEntity
().
getPSDEServiceAPIMethods
())
{
methods
.
add
(
new
ApiMethodModel
(
this
,
null
,
iPSDEServiceAPIMethod
));
}
}
//接口关系方法
if
(
getApiDataEntity
().
getMinorPSDEServiceAPIRSs
()
!=
null
)
{
for
(
IPSDEServiceAPIRS
iPSDEServiceAPIRS
:
getApiDataEntity
().
getMinorPSDEServiceAPIRSs
())
{
if
(
iPSDEServiceAPIRS
.
getPSDEServiceAPIMethods
()
!=
null
)
{
ApiEntityRSModel
apiEntityRSModel
=
api
.
getApiEntityRS
(
iPSDEServiceAPIRS
.
getName
());
//计算父路径
List
<
List
<
ApiEntityRSModel
>>
parentApiEntityList
=
new
ArrayList
<>();
fillDEAPIRSPath
(
parentApiEntityList
,
apiEntityRSModel
,
null
);
for
(
List
<
ApiEntityRSModel
>
parentApiEntities
:
parentApiEntityList
)
{
for
(
IPSDEServiceAPIMethod
iPSDEServiceAPIMethod
:
iPSDEServiceAPIRS
.
getPSDEServiceAPIMethods
())
{
methods
.
add
(
new
ApiMethodModel
(
this
,
parentApiEntities
,
iPSDEServiceAPIMethod
));
}
}
}
}
}
return
methods
;
}
/**
* 递归计算接口关系path
* 注意自身关系
*
* @param parentApiEntityList
* @param apiEntityRSModel
* @param parentApiEntities
*/
private
void
fillDEAPIRSPath
(
List
<
List
<
ApiEntityRSModel
>>
parentApiEntityList
,
ApiEntityRSModel
apiEntityRSModel
,
List
<
ApiEntityRSModel
>
parentApiEntities
)
{
if
(
parentApiEntities
==
null
)
{
parentApiEntities
=
new
ArrayList
<>();
}
//防止递归
if
(
parentApiEntities
.
stream
().
anyMatch
(
rs
->
rs
.
getName
().
equals
(
apiEntityRSModel
.
getName
())))
{
return
;
}
parentApiEntities
.
add
(
apiEntityRSModel
);
if
(
apiEntityRSModel
.
isMajorEntityMajor
())
{
List
<
ApiEntityRSModel
>
temp
=
new
ArrayList
<>();
temp
.
addAll
(
parentApiEntities
);
parentApiEntityList
.
add
(
temp
);
}
//递归
List
<
ApiEntityRSModel
>
parents
=
api
.
getApiEntityParentRSes
(
apiEntityRSModel
.
getMajorEntityCodeName
());
if
(!
CollectionUtils
.
isEmpty
(
parents
))
{
for
(
ApiEntityRSModel
parentRs
:
parents
)
{
fillDEAPIRSPath
(
parentApiEntityList
,
parentRs
,
parentApiEntities
);
}
}
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/ApiEntityRSModel.java
0 → 100644
浏览文件 @
a03c6ef1
package
cn
.
ibizlab
.
codegen
.
model
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
net.ibizsys.model.dataentity.service.IPSDEMethodDTO
;
import
net.ibizsys.model.dataentity.service.IPSDEServiceAPI
;
import
net.ibizsys.model.dataentity.service.IPSDEServiceAPIMethod
;
import
net.ibizsys.model.dataentity.service.IPSDEServiceAPIRS
;
import
java.util.ArrayList
;
import
java.util.List
;
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
public
class
ApiEntityRSModel
extends
BaseModel
{
public
ApiEntityRSModel
(
ApiModel
apiModel
,
IPSDEServiceAPIRS
iPSDEServiceAPIRS
)
{
this
.
opt
=
iPSDEServiceAPIRS
;
this
.
api
=
apiModel
;
this
.
setCodeName
(
iPSDEServiceAPIRS
.
getCodeName
());
this
.
setName
(
iPSDEServiceAPIRS
.
getName
());
}
private
ApiModel
api
;
public
String
getParentIdFieldCodeName
()
{
if
(
getPSDEServiceAPIRS
().
getParentIdPSDEField
()
!=
null
)
return
getPSDEServiceAPIRS
().
getParentIdPSDEField
().
getCodeName
();
return
""
;
}
public
int
getParentIdFieldType
()
{
if
(
getPSDEServiceAPIRS
().
getParentIdPSDEField
()
!=
null
)
return
getPSDEServiceAPIRS
().
getParentIdPSDEField
().
getStdDataType
();
return
PropType
.
VARCHAR
.
code
;
}
public
String
getMajorEntityCodeName
()
{
return
getPSDEServiceAPIRS
().
getMajorPSDEServiceAPI
().
getCodeName
();
}
public
boolean
isMajorEntityMajor
()
{
return
getPSDEServiceAPIRS
().
getMajorPSDEServiceAPI
().
isMajor
();
}
public
String
getMinorEntityCodeName
()
{
return
getPSDEServiceAPIRS
().
getMinorPSDEServiceAPI
().
getCodeName
();
}
private
IPSDEServiceAPIRS
getPSDEServiceAPIRS
()
{
return
(
IPSDEServiceAPIRS
)
opt
;
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/ApiMethodModel.java
0 → 100644
浏览文件 @
a03c6ef1
package
cn
.
ibizlab
.
codegen
.
model
;
import
cn.ibizlab.codegen.utils.Inflector
;
import
cn.ibizlab.codegen.utils.StringAdvUtils
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
net.ibizsys.model.dataentity.IPSDataEntity
;
import
net.ibizsys.model.dataentity.service.*
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
public
class
ApiMethodModel
extends
BaseModel
{
private
String
[]
ignoreMethodNames
=
new
String
[]{
"GET"
,
"CREATE"
,
"UPDATE"
,
"REMOVE"
};
private
ApiModel
api
;
private
ApiEntityModel
apiEntity
;
private
List
<
ApiEntityRSModel
>
parentApiEntities
;
public
ApiMethodModel
(
ApiEntityModel
apiEntityModel
,
List
<
ApiEntityRSModel
>
parentApiEntities
,
IPSDEServiceAPIMethod
iPSDEServiceAPIMethod
)
{
this
.
opt
=
iPSDEServiceAPIMethod
;
this
.
apiEntity
=
apiEntityModel
;
this
.
api
=
apiEntityModel
.
getApi
();
this
.
parentApiEntities
=
parentApiEntities
;
this
.
setCodeName
(
iPSDEServiceAPIMethod
.
getCodeName
());
this
.
setName
(
iPSDEServiceAPIMethod
.
getName
());
}
public
IPSDEServiceAPIMethod
getPSDEServiceAPIMethod
()
{
return
(
IPSDEServiceAPIMethod
)
opt
;
}
public
String
getRequestPath
()
{
String
path
=
""
;
if
(!
CollectionUtils
.
isEmpty
(
parentApiEntities
))
{
for
(
ApiEntityRSModel
apiRs
:
parentApiEntities
)
{
String
strMajorEntityPlurlize
=
Inflector
.
getInstance
().
pluralize
(
StringAdvUtils
.
camelcase
(
apiRs
.
getMajorEntityCodeName
()).
toLowerCase
());
path
=
String
.
format
(
"/%s/{%s}"
,
strMajorEntityPlurlize
,
StringAdvUtils
.
camelcase
(
apiRs
.
getParentIdFieldCodeName
()))
+
path
;
}
}
//主键
String
strPlurlize
=
Inflector
.
getInstance
().
pluralize
(
StringAdvUtils
.
camelcase
(
apiEntity
.
getCodeName
()).
toLowerCase
());
if
(
getPSDEServiceAPIMethod
().
isNeedResourceKey
())
{
path
=
path
+
String
.
format
(
"/%s/{%s}"
,
strPlurlize
,
StringAdvUtils
.
camelcase
(
apiEntity
.
getEntity
().
getKeyField
().
getCodeName
()));
}
else
{
path
=
path
+
String
.
format
(
"/%s"
,
strPlurlize
);
}
//方法名
if
(!
ArrayUtils
.
contains
(
ignoreMethodNames
,
this
.
getName
().
toUpperCase
()))
{
path
=
path
+
String
.
format
(
"/%s"
,
this
.
getName
().
toLowerCase
());
}
return
path
;
}
public
List
getPathVariables
()
{
List
pathVariables
=
new
ArrayList
();
if
(!
CollectionUtils
.
isEmpty
(
parentApiEntities
))
{
for
(
ApiEntityRSModel
apiRs
:
parentApiEntities
)
{
String
strMajorEntityPlurlize
=
Inflector
.
getInstance
().
pluralize
(
StringAdvUtils
.
camelcase
(
apiRs
.
getMajorEntityCodeName
()).
toLowerCase
());
JSONObject
pathVariable
=
new
JSONObject
();
pathVariable
.
put
(
"name"
,
apiRs
.
getParentIdFieldCodeName
());
pathVariable
.
put
(
"type"
,
PropType
.
findType
(
apiRs
.
getParentIdFieldType
()));
pathVariables
.
add
(
pathVariable
);
}
}
if
(
getPSDEServiceAPIMethod
().
isNeedResourceKey
())
{
JSONObject
pathVariable
=
new
JSONObject
();
pathVariable
.
put
(
"name"
,
apiEntity
.
getEntity
().
getKeyField
().
getCodeName
());
pathVariable
.
put
(
"type"
,
apiEntity
.
getEntity
().
getKeyField
().
getType
());
pathVariables
.
add
(
pathVariable
);
}
return
pathVariables
;
}
public
String
getBody
()
{
IPSDEServiceAPIMethodInput
iPSDEServiceAPIMethodInput
=
getPSDEServiceAPIMethod
().
getPSDEServiceAPIMethodInput
();
if
(
iPSDEServiceAPIMethodInput
!=
null
)
{
if
(
"DTO"
.
equals
(
iPSDEServiceAPIMethodInput
.
getType
()))
{
try
{
iPSDEServiceAPIMethodInput
.
getPSDEMethodDTO
();
}
catch
(
Exception
e
)
{
int
i
=
0
;
}
if
(
"DEFAULT"
.
equals
(
iPSDEServiceAPIMethodInput
.
getPSDEMethodDTO
().
getType
()))
return
iPSDEServiceAPIMethodInput
.
getPSDEMethodDTO
().
getName
();
else
if
(
"DEFILTER"
.
equals
(
iPSDEServiceAPIMethodInput
.
getPSDEMethodDTO
().
getType
()))
return
iPSDEServiceAPIMethodInput
.
getPSDEMethodDTO
().
getName
().
replace
(
"FilterDTO"
,
"SearchContext"
);
}
}
return
null
;
}
public
IPSDEServiceAPIMethodInput
getInput
()
{
return
getPSDEServiceAPIMethod
().
getPSDEServiceAPIMethodInput
();
}
public
IPSDEServiceAPIMethodReturn
getReturn
()
{
return
getPSDEServiceAPIMethod
().
getPSDEServiceAPIMethodReturn
();
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/ApiModel.java
浏览文件 @
a03c6ef1
...
...
@@ -12,38 +12,62 @@ import java.util.*;
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
public
class
ApiModel
extends
BaseModel
{
public
class
ApiModel
extends
BaseModel
{
public
ApiModel
(
IPSSysServiceAPI
api
)
{
this
.
opt
=
api
;
public
ApiModel
(
IPSSysServiceAPI
api
)
{
this
.
opt
=
api
;
this
.
setCodeName
(
api
.
getCodeName
());
this
.
setName
(
api
.
getName
());
if
(
getSysServiceApi
().
getPSDEServiceAPIs
()!=
null
)
{
getSysServiceApi
().
getPSDEServiceAPIs
().
forEach
(
item
->{
apiEntitiesMap
.
put
(
item
.
getCodeName
(),
new
ApiEntityModel
(
this
,
item
));
if
(
getSysServiceApi
().
getPSDEServiceAPIs
()
!=
null
)
{
getSysServiceApi
().
getPSDEServiceAPIs
().
forEach
(
item
->
{
apiEntitiesMap
.
put
(
item
.
getCodeName
(),
new
ApiEntityModel
(
this
,
item
));
});
}
if
(
getSysServiceApi
().
getPSDEServiceAPIRSs
()
!=
null
)
{
getSysServiceApi
().
getPSDEServiceAPIRSs
().
forEach
(
item
->
{
ApiEntityRSModel
apiEntityRSModel
=
new
ApiEntityRSModel
(
this
,
item
);
apiEntityRSMap
.
put
(
item
.
getName
(),
apiEntityRSModel
);
if
(!
apiEntityParentRSMap
.
containsKey
(
apiEntityRSModel
.
getMinorEntityCodeName
()))
{
apiEntityParentRSMap
.
put
(
apiEntityRSModel
.
getMinorEntityCodeName
(),
new
ArrayList
<>());
}
apiEntityParentRSMap
.
get
(
apiEntityRSModel
.
getMinorEntityCodeName
()).
add
(
apiEntityRSModel
);
});
}
}
private
SystemModel
system
;
public
IPSSysServiceAPI
getSysServiceApi
()
{
return
(
IPSSysServiceAPI
)
opt
;
public
IPSSysServiceAPI
getSysServiceApi
()
{
return
(
IPSSysServiceAPI
)
opt
;
}
private
Map
<
String
,
ApiEntityModel
>
apiEntitiesMap
=
new
LinkedHashMap
<>();
private
Map
<
String
,
ApiEntityModel
>
apiEntitiesMap
=
new
LinkedHashMap
<>();
public
Collection
<
ApiEntityModel
>
getApiEntities
()
{
return
apiEntitiesMap
.
values
();
}
public
ApiEntityModel
getApiEntity
(
String
codeName
)
{
public
ApiEntityModel
getApiEntity
(
String
codeName
)
{
return
apiEntitiesMap
.
get
(
codeName
);
}
private
Map
<
String
,
ApiEntityRSModel
>
apiEntityRSMap
=
new
LinkedHashMap
<>();
public
Collection
<
ApiEntityRSModel
>
getapiEntityRSes
()
{
return
apiEntityRSMap
.
values
();
}
public
ApiEntityRSModel
getApiEntityRS
(
String
name
)
{
return
apiEntityRSMap
.
get
(
name
);
}
private
Map
<
String
,
List
<
ApiEntityRSModel
>>
apiEntityParentRSMap
=
new
LinkedHashMap
<>();
public
List
<
ApiEntityRSModel
>
getApiEntityParentRSes
(
String
name
)
{
return
apiEntityParentRSMap
.
get
(
name
);
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/ModelStorage.java
浏览文件 @
a03c6ef1
...
...
@@ -102,16 +102,7 @@ public class ModelStorage {
if
(!
templateData
.
containsKey
(
type
))
{
CliData
rt
=
new
CliData
();
if
(
type
.
equals
(
TemplateFileType
.
api
))
{
getSystemModel
().
getApis
().
forEach
(
item
->{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
api
).
baseData
(
item
,
item
.
getCodeName
().
toLowerCase
());
rt
.
addOption
(
opt
);
});
}
else
if
(
type
.
equals
(
TemplateFileType
.
apiEntity
))
if
(
type
.
equals
(
TemplateFileType
.
apiEntity
))
{
getSystemModel
().
getApis
().
forEach
(
api
->{
api
.
getApiEntities
().
forEach
(
item
->{
...
...
@@ -120,79 +111,97 @@ public class ModelStorage {
});
});
}
else
if
(
type
.
equals
(
TemplateFileType
.
apiDto
))
{
getSystemModel
().
getApis
().
forEach
(
api
->
{
api
.
getApiEntities
().
forEach
(
item
->
{
item
.
getDtos
().
forEach
(
dto
->
{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
apiDto
)
.
setCliSubType
(
dto
.
getType
())
.
baseData
(
dto
,
dto
.
getCodeName
())
.
set
(
"apiDtos"
,
dto
.
getCodeName
()).
set
(
"apis"
,
dto
.
getApi
().
getCodeName
().
toLowerCase
());
rt
.
addOption
(
opt
);
});
});
});
}
else
if
(
type
.
equals
(
TemplateFileType
.
app
))
{
getSystemModel
().
getApps
().
forEach
(
item
->{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
app
).
baseData
(
item
,
item
.
getCodeName
().
toLowerCase
());
rt
.
addOption
(
opt
);
});
}
else
if
(
type
.
equals
(
TemplateFileType
.
appEntity
))
{
getSystemModel
().
getApps
().
forEach
(
app
->{
app
.
getAppEntities
().
forEach
(
item
->{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
appEntity
).
baseData
(
item
,
StringAdvUtils
.
spinalcase
(
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
())
.
baseData
(
item
,
item
.
getCodeName
().
toString
());
rt
.
addOption
(
opt
);
});
}
else
if
(
type
.
equals
(
TemplateFileType
.
module
))
{
getSystemModel
().
getSystem
().
getAllPSSystemModules
().
forEach
(
item
->{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
module
)
.
baseData
(
item
,
item
.
getCodeName
());
rt
.
addOption
(
opt
);
});
}
else
if
(
type
.
equals
(
TemplateFileType
.
page
))
{
getSystemModel
().
getApps
().
forEach
(
app
->{
app
.
getPages
().
forEach
(
item
->{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
page
).
setCliSubType
(
item
.
getAppView
().
getViewType
()).
baseData
(
item
,
StringAdvUtils
.
spinalcase
(
item
.
getCodeName
())).
set
(
"apps"
,
app
.
getCodeName
().
toLowerCase
()).
set
(
"appModules"
,
item
.
getAppModule
().
toSpinalCase
());
rt
.
addOption
(
opt
);
});
});
}
else
if
(
type
.
equals
(
TemplateFileType
.
ctrl
))
{
getSystemModel
().
getApps
().
forEach
(
app
->{
app
.
getCtrls
().
forEach
(
item
->{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
ctrl
).
setCliSubType
(
item
.
getControl
().
getControlType
()).
baseData
(
item
,
StringAdvUtils
.
spinalcase
(
item
.
getCodeName
())).
set
(
"apps"
,
app
.
getCodeName
().
toLowerCase
()).
set
(
"appEntities"
,
item
.
getFolder
().
toSpinalCase
());
rt
.
addOption
(
opt
);
});
});
}
else
if
(
type
.
equals
(
TemplateFileType
.
supportingFiles
))
{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
supportingFiles
)
.
set
(
TemplateFileType
.
app
.
value
(),
getTemplateData
(
TemplateFileType
.
app
).
getOptions
())
.
set
(
TemplateFileType
.
api
.
value
(),
getTemplateData
(
TemplateFileType
.
api
).
getOptions
())
.
set
(
TemplateFileType
.
module
.
value
(),
getTemplateData
(
TemplateFileType
.
module
).
getOptions
());
rt
.
addOption
(
opt
);
}
// if(type.equals(TemplateFileType.api))
// {
//
// getSystemModel().getApis().forEach(item->{
// CliOption opt=newCliOption(TemplateFileType.api).baseData(item,item.getCodeName().toLowerCase());
// rt.addOption(opt);
// });
//
// }
// else if(type.equals(TemplateFileType.apiEntity))
// {
// getSystemModel().getApis().forEach(api->{
// api.getApiEntities().forEach(item->{
// CliOption opt=newCliOption(TemplateFileType.apiEntity).baseData(item,item.getCodeName().toString()).set("apis",api.getCodeName().toLowerCase());
// rt.addOption(opt);
// });
// });
// }
// else if (type.equals(TemplateFileType.apiDto)) {
// getSystemModel().getApis().forEach(api -> {
// api.getApiEntities().forEach(item -> {
// item.getDtos().forEach(dto -> {
// CliOption opt = newCliOption(TemplateFileType.apiDto)
// .setCliSubType(dto.getType())
// .baseData(dto, dto.getCodeName())
// .set("apiDtos",dto.getCodeName()).set("apis",dto.getApi().getCodeName().toLowerCase());
// rt.addOption(opt);
// });
// });
// });
// }
// else if(type.equals(TemplateFileType.app))
// {
// getSystemModel().getApps().forEach(item->{
// CliOption opt=newCliOption(TemplateFileType.app).baseData(item,item.getCodeName().toLowerCase());
// rt.addOption(opt);
// });
// }
// else if(type.equals(TemplateFileType.appEntity))
// {
// getSystemModel().getApps().forEach(app->{
// app.getAppEntities().forEach(item->{
// CliOption opt=newCliOption(TemplateFileType.appEntity).baseData(item, StringAdvUtils.spinalcase(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())
// .baseData(item,item.getCodeName().toString());
// rt.addOption(opt);
// });
// }
// else if(type.equals(TemplateFileType.module))
// {
// getSystemModel().getSystem().getAllPSSystemModules().forEach(item->{
// CliOption opt=newCliOption(TemplateFileType.module)
// .baseData(item,item.getCodeName());
// rt.addOption(opt);
// });
// }
// else if(type.equals(TemplateFileType.page))
// {
// getSystemModel().getApps().forEach(app->{
// app.getPages().forEach(item->{
// CliOption opt=newCliOption(TemplateFileType.page).setCliSubType(item.getAppView().getViewType()).baseData(item,StringAdvUtils.spinalcase(item.getCodeName())).set("apps",app.getCodeName().toLowerCase()).set("appModules",item.getAppModule().toSpinalCase());
//
// rt.addOption(opt);
// });
// });
// }
// else if(type.equals(TemplateFileType.ctrl))
// {
// getSystemModel().getApps().forEach(app->{
// app.getCtrls().forEach(item->{
// CliOption opt=newCliOption(TemplateFileType.ctrl).setCliSubType(item.getControl().getControlType()).baseData(item,StringAdvUtils.spinalcase(item.getCodeName())).set("apps",app.getCodeName().toLowerCase()).set("appEntities",item.getFolder().toSpinalCase());
// rt.addOption(opt);
// });
// });
// }
// else if(type.equals(TemplateFileType.supportingFiles))
// {
// CliOption opt=newCliOption(TemplateFileType.supportingFiles)
// .set(TemplateFileType.app.value(),getTemplateData(TemplateFileType.app).getOptions())
// .set(TemplateFileType.api.value(),getTemplateData(TemplateFileType.api).getOptions())
// .set(TemplateFileType.module.value(),getTemplateData(TemplateFileType.module).getOptions());
//
// rt.addOption(opt);
// }
templateData
.
put
(
type
,
rt
);
}
return
templateData
.
get
(
type
);
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-provider/{{projectName}}-provider-{{apis}}/src/main/java/{{packageName}}/{{apis}}/rest/{{apiEntities}}Resource.java.hbs
浏览文件 @
a03c6ef1
此差异已折叠。
点击以展开。
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-provider/{{projectName}}-provider-{{apis}}/src/main/java/{{packageName}}/{{apis}}/rest/{{apiEntities}}Resource_old.java.hbs
0 → 100644
浏览文件 @
a03c6ef1
此差异已折叠。
点击以展开。
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录