Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
abb0a44c
提交
abb0a44c
编写于
1月 14, 2022
作者:
xignzi006
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:Resource父关系计算bug
上级
cf83eadb
变更
3
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
41 行增加
和
9 行删除
+41
-9
ApiEntityModel.java
...rc/main/java/cn/ibizlab/codegen/model/ApiEntityModel.java
+7
-1
ApiMethodModel.java
...rc/main/java/cn/ibizlab/codegen/model/ApiMethodModel.java
+6
-0
{{apiEntities}}Resource.java.hbs
...kageName}}/{{apis}}/rest/{{apiEntities}}Resource.java.hbs
+28
-8
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/ApiEntityModel.java
浏览文件 @
abb0a44c
...
...
@@ -70,6 +70,8 @@ public class ApiEntityModel extends BaseModel {
//主接口方法
if
(
getApiDataEntity
().
isMajor
()
&&
getApiDataEntity
().
getPSDEServiceAPIMethods
()
!=
null
)
{
for
(
IPSDEServiceAPIMethod
iPSDEServiceAPIMethod
:
getApiDataEntity
().
getPSDEServiceAPIMethods
())
{
if
(
iPSDEServiceAPIMethod
.
getPSDEDataSet
()!=
null
&&
iPSDEServiceAPIMethod
.
getPSDEDataSet
().
getPSDEDataQueries
()==
null
)
continue
;
methods
.
add
(
new
ApiMethodModel
(
this
,
null
,
iPSDEServiceAPIMethod
));
}
}
...
...
@@ -83,6 +85,8 @@ public class ApiEntityModel extends BaseModel {
fillDEAPIRSPath
(
parentApiEntityList
,
apiEntityRSModel
,
null
);
for
(
List
<
ApiEntityRSModel
>
parentApiEntities
:
parentApiEntityList
)
{
for
(
IPSDEServiceAPIMethod
iPSDEServiceAPIMethod
:
iPSDEServiceAPIRS
.
getPSDEServiceAPIMethods
())
{
if
(
iPSDEServiceAPIMethod
.
getPSDEDataSet
()!=
null
&&
iPSDEServiceAPIMethod
.
getPSDEDataSet
().
getPSDEDataQueries
()==
null
)
continue
;
methods
.
add
(
new
ApiMethodModel
(
this
,
parentApiEntities
,
iPSDEServiceAPIMethod
));
}
}
...
...
@@ -118,7 +122,9 @@ public class ApiEntityModel extends BaseModel {
List
<
ApiEntityRSModel
>
parents
=
api
.
getApiEntityParentRSes
(
apiEntityRSModel
.
getMajorEntityCodeName
());
if
(!
CollectionUtils
.
isEmpty
(
parents
))
{
for
(
ApiEntityRSModel
parentRs
:
parents
)
{
fillDEAPIRSPath
(
parentApiEntityList
,
parentRs
,
parentApiEntities
);
List
<
ApiEntityRSModel
>
tempParentApiEntities
=
new
ArrayList
<>();
tempParentApiEntities
.
addAll
(
parentApiEntities
);
fillDEAPIRSPath
(
parentApiEntityList
,
parentRs
,
tempParentApiEntities
);
}
}
}
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/ApiMethodModel.java
浏览文件 @
abb0a44c
...
...
@@ -107,6 +107,12 @@ public class ApiMethodModel extends BaseModel {
return
iPSDEServiceAPIMethodInput
.
getPSDEMethodDTO
().
getName
();
else
if
(
"DEFILTER"
.
equals
(
iPSDEServiceAPIMethodInput
.
getPSDEMethodDTO
().
getType
()))
return
iPSDEServiceAPIMethodInput
.
getPSDEMethodDTO
().
getName
().
replace
(
"FilterDTO"
,
"SearchContext"
);
}
else
if
(
"DTOS"
.
equals
(
iPSDEServiceAPIMethodInput
.
getType
()))
{
return
iPSDEServiceAPIMethodInput
.
getPSDEMethodDTO
().
getName
();
}
else
if
(
"KEYFIELD"
.
equals
(
iPSDEServiceAPIMethodInput
.
getType
())
&&
getPSDEServiceAPIMethod
().
getPSDEAction
()!=
null
&&
getPSDEServiceAPIMethod
().
getPSDEAction
().
getActionType
().
equals
(
"USERCUSTOM"
))
{
return
apiEntity
.
getCodeName
()
+
"DTO"
;
}
}
return
null
;
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-provider/{{projectName}}-provider-{{apis}}/src/main/java/{{packageName}}/{{apis}}/rest/{{apiEntities}}Resource.java.hbs
浏览文件 @
abb0a44c
...
...
@@ -57,12 +57,12 @@ public class {{apiEntity.codeName}}Resource {
{{#
each
apiEntity
.
methods
}}
@ApiOperation(value = "
{{
apiEntity
.
entity
.
logicName
}}
", tags = {"
{{
apiEntity
.
entity
.
logicName
}}
" }, notes = "
{{
apiEntity
.
entity
.
logicName
}}
")
@RequestMapping(method = RequestMethod.
{{
requestMethod
}}
, value = "
{{
requestPath
}}
")
public ResponseEntity
{{
camelCase
methodName
}}
(
{{#
each
pathVariables
}}{{#
unless
@first
}}
,
{{/
unless
}}
@PathVariable("
{{
camelCase
name
}}
")
{{
type
.
java
}}
{{
camelCase
name
}}{{/
each
}}{{#if
body
}}{{#if
pathVariables
}}
,
{{/if}}
@Validated @RequestBody
{{
body
}}
{{
camelCase
body
}}{{/if}}
) {
public ResponseEntity
{{
camelCase
name
}}{{#
each
pathVariables
}}{{#if
@first
}}
By
{{else}}
And
{{/if}}{{
pascalCase
name
}}{{/
each
}}
(
{{#
each
pathVariables
}}{{#
unless
@first
}}
,
{{/
unless
}}
@PathVariable("
{{
camelCase
name
}}
")
{{
type
.
java
}}
{{
camelCase
name
}}{{/
each
}}{{#if
body
}}{{#if
pathVariables
}}
,
{{/if}}
@Validated @RequestBody
{{#
eq
input
.
type
"DTO"
}}{{
body
}}{{/
eq
}}{{#
eq
input
.
type
"KEYFIELD"
}}{{#
eq
pSDEAction
.
actionType
"USERCUSTOM"
}}{{
body
}}{{/
eq
}}{{/
eq
}}{{#
eq
input
.
type
"DTOS"
}}
List
<
{{
body
}}
>
{{/
eq
}}
{{#
eq
input
.
type
"DTO"
}}{{
camelCase
body
}}{{/
eq
}}{{#
eq
input
.
type
"KEYFIELD"
}}{{#
eq
pSDEAction
.
actionType
"USERCUSTOM"
}}{{
camelCase
body
}}{{/
eq
}}{{/
eq
}}{{#
eq
input
.
type
"DTOS"
}}
list
{{/
eq
}}{{/if}}
) {
{{!行为}}
{{#
eq
methodType
"DEACTION"
}}
{{!行为参数准备}}
{{#
eq
input
.
type
"DTO"
}}
{{
apiEntity
.
entity
.
codeName
}}
{{
camelCase
apiEntity
.
entity
.
codeName
}}
=
{{
camelCase
input
.
p
S
DEMethodDTO
.
name
}}
Mapping.toDomain(
{{
camelCase
body
}}
);
{{
apiEntity
.
entity
.
codeName
}}
{{
camelCase
apiEntity
.
entity
.
codeName
}}
=
{{
camelCase
input
.
p
s
DEMethodDTO
.
name
}}
Mapping.toDomain(
{{
camelCase
body
}}
);
{{#
each
pathVariables
}}
{{#if
@last
}}
{{
camelCase
apiEntity
.
entity
.
codeName
}}
.set
{{
pascalCase
name
}}
(
{{
camelCase
name
}}
);
...
...
@@ -70,9 +70,23 @@ public class {{apiEntity.codeName}}Resource {
{{/
each
}}
{{
camelCase
apiEntity
.
entity
.
codeName
}}
Service.
{{
camelCase
name
}}
(
{{
camelCase
apiEntity
.
entity
.
codeName
}}
);
{{/
eq
}}
{{#
eq
input
.
type
"DTOS"
}}
{{
camelCase
apiEntity
.
entity
.
codeName
}}
Service.
{{
camelCase
name
}}
Batch(
{{
camelCase
input
.
psDEMethodDTO
.
name
}}
Mapping.toDomain(list));
{{/
eq
}}
{{#
eq
input
.
type
"KEYFIELD"
}}
{{#
eq
return
.
type
"DTO"
}}
{{#if
body
}}
{{
apiEntity
.
entity
.
codeName
}}
{{
camelCase
apiEntity
.
entity
.
codeName
}}
=
{{
camelCase
body
}}
Mapping.toDomain(
{{
camelCase
body
}}
);
{{#
each
pathVariables
}}
{{#if
@last
}}
{{
camelCase
apiEntity
.
entity
.
codeName
}}
.set
{{
pascalCase
name
}}
(
{{
camelCase
name
}}
);
{{/if}}
{{/
each
}}
{{
camelCase
apiEntity
.
entity
.
codeName
}}
Service.
{{
camelCase
name
}}
(
{{
camelCase
apiEntity
.
entity
.
codeName
}}
);
{{/if}}
{{#
unless
body
}}
{{
apiEntity
.
entity
.
codeName
}}
{{
camelCase
apiEntity
.
entity
.
codeName
}}
=
{{
camelCase
apiEntity
.
entity
.
codeName
}}
Service.
{{
camelCase
name
}}
(
{{
camelCase
apiEntity
.
entity
.
keyField
.
codeName
}}
);
{{/
unless
}}
{{/
eq
}}
{{#
neq
return
.
type
"DTO"
}}
{{
camelCase
apiEntity
.
entity
.
codeName
}}
Service.
{{
camelCase
name
}}
(
{{
camelCase
apiEntity
.
entity
.
keyField
.
codeName
}}
);
...
...
@@ -80,7 +94,10 @@ public class {{apiEntity.codeName}}Resource {
{{/
eq
}}
{{!返回处理}}
{{#
eq
return
.
type
"DTO"
}}
return ResponseEntity.status(HttpStatus.OK).body(
{{
camelCase
return
.
pSDEMethodDTO
.
name
}}
Mapping.toDto(
{{
camelCase
apiEntity
.
entity
.
codeName
}}
));
return ResponseEntity.status(HttpStatus.OK).body(
{{
camelCase
return
.
psDEMethodDTO
.
name
}}
Mapping.toDto(
{{
camelCase
apiEntity
.
entity
.
codeName
}}
));
{{/
eq
}}
{{#
eq
return
.
type
"DTOS"
}}
return ResponseEntity.status(HttpStatus.OK).body(true);
{{/
eq
}}
{{#
eq
return
.
type
"SIMPLE"
}}
return ResponseEntity.status(HttpStatus.OK).body(0);
...
...
@@ -91,6 +108,9 @@ public class {{apiEntity.codeName}}Resource {
{{#
eq
return
.
type
"VOID"
}}
return ResponseEntity.status(HttpStatus.OK).body(true);
{{/
eq
}}
{{#
eq
return
.
type
"USER"
}}
return ResponseEntity.status(HttpStatus.OK).body(
{{
camelCase
body
}}
Mapping.toDto(
{{
camelCase
apiEntity
.
entity
.
codeName
}}
));
{{/
eq
}}
{{/
eq
}}
{{!数据集}}
{{#
eq
methodType
"FETCH"
}}
...
...
@@ -100,7 +120,7 @@ public class {{apiEntity.codeName}}Resource {
{{/if}}
{{/
each
}}
Page
<
{{
apiEntity
.
entity
.
codeName
}}
>
domains =
{{
camelCase
apiEntity
.
entity
.
codeName
}}
Service.search
{{
pascalCase
pSDEDataSet
.
codeName
}}
(
{{
camelCase
body
}}
) ;
List
<
{{
return
.
p
SDEMethodDTO
.
name
}}
>
list =
{{
camelCase
return
.
pS
DEMethodDTO
.
name
}}
Mapping.toDto(domains.getContent());
List
<
{{
return
.
p
sDEMethodDTO
.
name
}}
>
list =
{{
camelCase
return
.
ps
DEMethodDTO
.
name
}}
Mapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(
{{
camelCase
body
}}
.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(
{{
camelCase
body
}}
.getPageable().getPageSize()))
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录