Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
497ba0e7
提交
497ba0e7
编写于
1月 13, 2022
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复部分bug
上级
1b4f4220
变更
6
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
43 行增加
和
42 行删除
+43
-42
ModelStorage.java
.../src/main/java/cn/ibizlab/codegen/model/ModelStorage.java
+32
-33
{{entities@SQL}}.java.hbs
...eName}}/core/{{modules}}/domain/{{entities@SQL}}.java.hbs
+1
-0
{{entities@SQL}}SearchContext.java.hbs
...{{modules}}/filter/{{entities@SQL}}SearchContext.java.hbs
+3
-2
I{{entities@SQL}}Service.java.hbs
...ore/{{modules}}/service/I{{entities@SQL}}Service.java.hbs
+2
-2
{{entities@SQL}}ServiceImpl.java.hbs
...dules}}/service/impl/{{entities@SQL}}ServiceImpl.java.hbs
+1
-1
{{apiEntities}}Resource.java.hbs
...kageName}}/{{apis}}/rest/{{apiEntities}}Resource.java.hbs
+4
-4
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/ModelStorage.java
浏览文件 @
497ba0e7
...
...
@@ -102,39 +102,38 @@ 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))
// {
// 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))
if
(
type
.
equals
(
TemplateFileType
.
app
))
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
());
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@SQL}}.java.hbs
浏览文件 @
497ba0e7
...
...
@@ -12,6 +12,7 @@ import com.alibaba.fastjson.annotation.JSONField;
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 org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/filter/{{entities@SQL}}SearchContext.java.hbs
浏览文件 @
497ba0e7
...
...
@@ -7,7 +7,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
...
...
@@ -156,7 +157,7 @@ public class {{entity.codeName}}SearchContext extends QueryWrapperContext<{{enti
this.getSearchCond().and( wrapper ->
wrapper.like("
{{
lowerCase
field
.
name
}}
", query)
{{else}}
.or.like("
{{
lowerCase
field
.
name
}}
", query)
.or
()
.like("
{{
lowerCase
field
.
name
}}
", query)
{{/if}}
{{#if
@last
}}
);
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/service/I{{entities@SQL}}Service.java.hbs
浏览文件 @
497ba0e7
...
...
@@ -75,8 +75,8 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName}
{{/
each
}}
{{#
entity
.
dataSets
}}
Page
<
{{#if
enableGroup
}}
Map
{{else}}{{
entity
.
codeName
}}{{/if}}
>
search
{{
codeName
}}
(
{{
entity
.
codeName
}}
SearchContext context);
List
<
{{#if
enableGroup
}}
Map
{{else}}{{
entity
.
codeName
}}{{/if}}
>
list
{{
codeName
}}
(
{{
entity
.
codeName
}}
SearchContext context);
Page
<
{{#if
enableGroup
}}
Map
{{else}}{{
entity
.
codeName
}}{{/if}}
>
search
{{
pascalCase
codeName
}}
(
{{
entity
.
codeName
}}
SearchContext context);
List
<
{{#if
enableGroup
}}
Map
{{else}}{{
entity
.
codeName
}}{{/if}}
>
list
{{
pascalCase
codeName
}}
(
{{
entity
.
codeName
}}
SearchContext context);
{{/
entity
.
dataSets
}}
{{#
entity
.
references
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/service/impl/{{entities@SQL}}ServiceImpl.java.hbs
浏览文件 @
497ba0e7
...
...
@@ -269,7 +269,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{
camelCase
entityCodeName
}}
Service.resetBy
{{
pascalCase
fkField
.
codeName
}}
(key);
{{/
eq
}}
{{#
eq
removeActionType
3
}}
if(!ObjectUtils.isEmpty(
{{
camelCase
entityCodeName
}}
Service.removeBy
{{
pascalCase
fkField
.
codeName
}}
(key))
if(!ObjectUtils.isEmpty(
{{
camelCase
entityCodeName
}}
Service.removeBy
{{
pascalCase
fkField
.
codeName
}}
(key))
)
throw new BadRequestAlertException("删除数据失败,当前数据存在关系实体[
{{
camelCase
entityCodeName
}}
]数据,无法删除!","","");
{{/
eq
}}
{{/
unless
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-provider/{{projectName}}-provider-{{apis}}/src/main/java/{{packageName}}/{{apis}}/rest/{{apiEntities}}Resource.java.hbs
浏览文件 @
497ba0e7
...
...
@@ -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
name
}}
(
{{#
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
{{
body
}}
{{
camelCase
body
}}{{/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
}}
);
...
...
@@ -80,7 +80,7 @@ public class {{apiEntity.codeName}}Resource {
{{/
eq
}}
{{!返回处理}}
{{#
eq
return
.
type
"DTO"
}}
return ResponseEntity.status(HttpStatus.OK).body(
{{
camelCase
return
.
p
S
DEMethodDTO
.
name
}}
Mapping.toDto(
{{
camelCase
apiEntity
.
entity
.
codeName
}}
));
return ResponseEntity.status(HttpStatus.OK).body(
{{
camelCase
return
.
p
s
DEMethodDTO
.
name
}}
Mapping.toDto(
{{
camelCase
apiEntity
.
entity
.
codeName
}}
));
{{/
eq
}}
{{#
eq
return
.
type
"SIMPLE"
}}
return ResponseEntity.status(HttpStatus.OK).body(0);
...
...
@@ -100,7 +100,7 @@ public class {{apiEntity.codeName}}Resource {
{{/if}}
{{/
each
}}
Page
<
{{
apiEntity
.
entity
.
codeName
}}
>
domains =
{{
camelCase
apiEntity
.
entity
.
codeName
}}
Service.search
{{
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
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录