Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
04469c92
提交
04469c92
编写于
1月 15, 2022
作者:
ibiz4j
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fillParent
上级
42fcee83
变更
6
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
58 行增加
和
17 行删除
+58
-17
RelationshipModel.java
...main/java/cn/ibizlab/codegen/model/RelationshipModel.java
+6
-0
{{entities@NONE}}.java.hbs
...Name}}/core/{{modules}}/domain/{{entities@NONE}}.java.hbs
+5
-2
{{entities@SQL}}.java.hbs
...eName}}/core/{{modules}}/domain/{{entities@SQL}}.java.hbs
+6
-3
{{entities@ServiceAPI}}.java.hbs
.../core/{{modules}}/domain/{{entities@ServiceAPI}}.java.hbs
+5
-2
I{{entities@SQL}}Service.java.hbs
...ore/{{modules}}/service/I{{entities@SQL}}Service.java.hbs
+7
-1
{{entities@SQL}}ServiceImpl.java.hbs
...dules}}/service/impl/{{entities@SQL}}ServiceImpl.java.hbs
+29
-9
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/RelationshipModel.java
浏览文件 @
04469c92
...
...
@@ -8,6 +8,8 @@ import lombok.Setter;
import
lombok.experimental.Accessors
;
import
net.ibizsys.model.dataentity.defield.IPSDEField
;
import
net.ibizsys.model.dataentity.der.IPSDERBase
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
...
...
@@ -109,6 +111,10 @@ public class RelationshipModel extends BaseModel{
return
fkField
;
}
public
int
getRelFieldCount
()
{
return
ObjectUtils
.
isEmpty
(
fields
)?
1
:
fields
.
size
();
}
private
Map
<
String
,
LookupModel
>
lookup
;
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@NONE}}.java.hbs
浏览文件 @
04469c92
...
...
@@ -31,6 +31,9 @@ import org.springframework.data.annotation.Transient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
{{#
entity
.
relEntities
}}
import
{{
packageName
}}
.core.
{{
module
}}
.domain.
{{
codeName
}}
;
{{/
entity
.
relEntities
}}
@Getter
@Setter
...
...
@@ -70,7 +73,7 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
*/
@JSONField(name = "
{{
lowerCase
codeName
}}
")
@JsonProperty("
{{
lowerCase
codeName
}}
")
private
{{
packageName
}}
.core.
{{
module
}}
.domain.
{{
entityCodeName
}}
{{
camelCase
codeName
}}
;
private
{{
entityCodeName
}}
{{
camelCase
codeName
}}
;
{{/
each
}}
{{#
each
entity
.
nesteds
}}
...
...
@@ -84,7 +87,7 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
@JsonIgnore
@JSONField(serialize = false)
{{/if}}
private List
<
{{
packageName
}}
.
core
.
{{
module
}}
.
domain
.
{{
entityCodeName
}}
>
{{
camelCase
codeName
}}
;
private List
<
{{
entityCodeName
}}
>
{{
camelCase
codeName
}}
;
{{/
each
}}
{{#
each
entity
.
fields
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@SQL}}.java.hbs
浏览文件 @
04469c92
...
...
@@ -34,6 +34,9 @@ import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
{{#
entity
.
relEntities
}}
import
{{
packageName
}}
.core.
{{
module
}}
.domain.
{{
codeName
}}
;
{{/
entity
.
relEntities
}}
@Getter
@Setter
...
...
@@ -87,7 +90,7 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private
{{
packageName
}}
.core.
{{
module
}}
.domain.
{{
entityCodeName
}}
{{
camelCase
codeName
}}
;
private
{{
entityCodeName
}}
{{
camelCase
codeName
}}
;
{{/
each
}}
{{#
each
entity
.
nesteds
}}
...
...
@@ -106,7 +109,7 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
{{else}}
@TableField(exist = false)
{{/if}}
protected List
<
{{
packageName
}}
.
core
.
{{
module
}}
.
domain
.
{{
entityCodeName
}}
>
{{
camelCase
codeName
}}
;
protected List
<
{{
entityCodeName
}}
>
{{
camelCase
codeName
}}
;
{{/
each
}}
{{#
each
entity
.
fields
}}
...
...
@@ -144,7 +147,7 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
/**
* 设置 [
{{
entityLogicName
}}
]
*/
public
{{
entity
.
codeName
}}
set
{{
pascalCase
codeName
}}
(List
<
{{
packageName
}}
.
core
.
{{
module
}}
.
domain
.
{{
entityCodeName
}}
>
{{
camelCase
codeName
}}
) {
public
{{
entity
.
codeName
}}
set
{{
pascalCase
codeName
}}
(List
<
{{
entityCodeName
}}
>
{{
camelCase
codeName
}}
) {
this.
{{
camelCase
codeName
}}
=
{{
camelCase
codeName
}}
;
this.modify("
{{
columnName
}}
", (
{{
camelCase
codeName
}}
!=null)?
{{
camelCase
codeName
}}
:(new ArrayList()));
return this;
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@ServiceAPI}}.java.hbs
浏览文件 @
04469c92
...
...
@@ -33,6 +33,9 @@ import org.springframework.data.annotation.Transient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
{{#
entity
.
relEntities
}}
import
{{
packageName
}}
.core.
{{
module
}}
.domain.
{{
codeName
}}
;
{{/
entity
.
relEntities
}}
@Getter
@Setter
...
...
@@ -72,7 +75,7 @@ public class {{entity.codeName}} extends EntityClient implements Serializable
*/
@JSONField(name = "
{{
lowerCase
codeName
}}
")
@JsonProperty("
{{
lowerCase
codeName
}}
")
private
{{
packageName
}}
.core.
{{
module
}}
.domain.
{{
entityCodeName
}}
{{
camelCase
codeName
}}
;
private
{{
entityCodeName
}}
{{
camelCase
codeName
}}
;
{{/
each
}}
{{#
each
entity
.
nesteds
}}
...
...
@@ -86,7 +89,7 @@ public class {{entity.codeName}} extends EntityClient implements Serializable
@JsonIgnore
@JSONField(serialize = false)
{{/if}}
private List
<
{{
packageName
}}
.
core
.
{{
module
}}
.
domain
.
{{
entityCodeName
}}
>
{{
camelCase
codeName
}}
;
private List
<
{{
entityCodeName
}}
>
{{
camelCase
codeName
}}
;
{{/
each
}}
{{#
each
entity
.
fields
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/service/I{{entities@SQL}}Service.java.hbs
浏览文件 @
04469c92
...
...
@@ -92,7 +92,13 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName}
{{#
enableEntityCache
}}
@CacheEvict(value = "
{{
lowerCase
entity
.
codeName
}}
", allEntries = true)
{{/
enableEntityCache
}}
boolean saveBy
{{
pascalCase
fkField
.
codeName
}}
(
{{
fkField
.
type
.
java
}}
{{
camelCase
fkField
.
codeName
}}
,List
<
{{
entity
.
codeName
}}
>
list);
boolean saveBy
{{
pascalCase
fkField
.
codeName
}}
(
{{
packageName
}}
.core.
{{
module
}}
.domain.
{{
entityCodeName
}}
{{
camelCase
entityCodeName
}}
,List
<
{{
entity
.
codeName
}}
>
list);
{{#
enableEntityCache
}}
@CacheEvict(value = "
{{
lowerCase
entity
.
codeName
}}
", allEntries = true)
{{/
enableEntityCache
}}
default boolean saveBy
{{
pascalCase
fkField
.
codeName
}}
(
{{
fkField
.
type
.
java
}}
{{
camelCase
fkField
.
codeName
}}
,List
<
{{
entity
.
codeName
}}
>
list) {
return saveBy
{{
pascalCase
fkField
.
codeName
}}
(new
{{
packageName
}}
.core.
{{
module
}}
.domain.
{{
entityCodeName
}}
().set
{{
pascalCase
relEntity
.
keyField
.
codeName
}}
(
{{
camelCase
fkField
.
codeName
}}
),list);
}
{{/
entity
.
references
}}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/service/impl/{{entities@SQL}}ServiceImpl.java.hbs
浏览文件 @
04469c92
...
...
@@ -43,6 +43,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
{{#
entity
.
relEntities
}}
import
{{
packageName
}}
.core.
{{
module
}}
.domain.
{{
codeName
}}
;
{{#
neq
storage
"NONE"
}}
import
{{
packageName
}}
.core.
{{
module
}}
.service.I
{{
codeName
}}
Service;
{{/
neq
}}
{{/
entity
.
relEntities
}}
/**
...
...
@@ -60,7 +66,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{#
neq
storage
"NONE"
}}
@Autowired
@Lazy
protected
{{
packageName
}}
.core.
{{
module
}}
.service.
I
{{
codeName
}}
Service
{{
camelCase
codeName
}}
Service;
protected I
{{
codeName
}}
Service
{{
camelCase
codeName
}}
Service;
{{/
neq
}}
{{/
entity
.
relEntities
}}
...
...
@@ -93,7 +99,20 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{#
entity
.
hasReferences
}}
public void fillParentData(
{{
entity
.
codeName
}}
et) {
{{#
each
entity
.
references
as
|
reference
|
}}
{{#
gt
reference
.
relFieldCount
1
}}
if(!ObjectUtils.isEmpty(et.get
{{
pascalCase
reference
.
fkField
.
codeName
}}
())) {
{{
reference
.
entityCodeName
}}
{{
camelCase
reference
.
entityCodeName
}}
= et.get
{{
pascalCase
reference
.
codeName
}}
();
if(!ObjectUtils.isEmpty(
{{
camelCase
reference
.
entityCodeName
}}
)) {
{{#
each
reference
.
fields
as
|
field
|
}}
{{#
neq
field
.
dataType
'PICKUP'
}}
et.set
{{
pascalCase
field
.
codeName
}}
(
{{
camelCase
reference
.
entityCodeName
}}
.get
{{
pascalCase
field
.
refFieldCodeName
}}
());
{{/
neq
}}
{{/
each
}}
}
}
{{/
gt
}}
{{/
each
}}
}
{{/
entity
.
hasReferences
}}
...
...
@@ -117,7 +136,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{#
entity
.
isIndexSubDE
}}
if(ObjectUtils.isEmpty(et.get
{{
pascalCase
entity
.
keyField
.
codeName
}}
()))
et.set
{{
pascalCase
entity
.
keyField
.
codeName
}}
((
{{
entity
.
keyField
.
type
.
java
}}
)et.getDefaultKey(true));
{{
packageName
}}
.core.
{{
entity
.
indexRelation
.
module
}}
.domain.
{{
entity
.
indexRelation
.
entityCodeName
}}
{{
camelCase
entity
.
indexRelation
.
entityCodeName
}}
=
{{
camelCase
entity
.
codeName
}}
InheritMapping.to
{{
pascalCase
entity
.
indexRelation
.
entityCodeName
}}
(et);
{{
entity
.
indexRelation
.
entityCodeName
}}
{{
camelCase
entity
.
indexRelation
.
entityCodeName
}}
=
{{
camelCase
entity
.
codeName
}}
InheritMapping.to
{{
pascalCase
entity
.
indexRelation
.
entityCodeName
}}
(et);
{{#if
entity
.
indexRelation
.
indexTypePSDEField
}}
{{
camelCase
entity
.
indexRelation
.
entityCodeName
}}
.set("
{{
lowerCase
entity
.
indexRelation
.
indexTypePSDEField
.
codeName
}}
","
{{
entity
.
indexRelation
.
typeValue
}}
");
{{/if}}
...
...
@@ -134,7 +153,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{#
each
entity
.
nesteds
}}
{{#
unless
listCode
}}
{{#
unless
columnName
}}
{{
camelCase
entityCodeName
}}
Service.saveBy
{{
pascalCase
fkField
.
codeName
}}
(et
.get
{{
pascalCase
entity
.
keyField
.
codeName
}}
()
,et.get
{{
pascalCase
codeName
}}
());
{{
camelCase
entityCodeName
}}
Service.saveBy
{{
pascalCase
fkField
.
codeName
}}
(et,et.get
{{
pascalCase
codeName
}}
());
{{/
unless
}}
{{/
unless
}}
{{/
each
}}
...
...
@@ -176,7 +195,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
fillParentData(et);
{{/
entity
.
hasReferences
}}
{{#
entity
.
isIndexSubDE
}}
{{
packageName
}}
.core.
{{
entity
.
indexRelation
.
module
}}
.domain.
{{
entity
.
indexRelation
.
entityCodeName
}}
{{
camelCase
entity
.
indexRelation
.
entityCodeName
}}
=
{{
camelCase
entity
.
codeName
}}
InheritMapping.to
{{
pascalCase
entity
.
indexRelation
.
entityCodeName
}}
(et);
{{
entity
.
indexRelation
.
entityCodeName
}}
{{
camelCase
entity
.
indexRelation
.
entityCodeName
}}
=
{{
camelCase
entity
.
codeName
}}
InheritMapping.to
{{
pascalCase
entity
.
indexRelation
.
entityCodeName
}}
(et);
{{#if
entity
.
indexRelation
.
indexTypePSDEField
}}
{{
camelCase
entity
.
indexRelation
.
entityCodeName
}}
.set("
{{
lowerCase
entity
.
indexRelation
.
indexTypePSDEField
.
codeName
}}
","
{{
entity
.
indexRelation
.
typeValue
}}
");
{{/if}}
...
...
@@ -193,7 +212,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{#
each
entity
.
nesteds
}}
{{#
unless
listCode
}}
{{#
unless
columnName
}}
{{
camelCase
entityCodeName
}}
Service.saveBy
{{
pascalCase
fkField
.
codeName
}}
(et
.get
{{
pascalCase
entity
.
keyField
.
codeName
}}
()
,et.get
{{
pascalCase
codeName
}}
());
{{
camelCase
entityCodeName
}}
Service.saveBy
{{
pascalCase
fkField
.
codeName
}}
(et,et.get
{{
pascalCase
codeName
}}
());
{{/
unless
}}
{{/
unless
}}
{{/
each
}}
...
...
@@ -342,17 +361,18 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
return this.update(new UpdateWrapper
<
{{
entity
.
codeName
}}
>
().set("
{{
lowerCase
fkField
.
name
}}
",null).eq("
{{
lowerCase
fkField
.
name
}}
",
{{
camelCase
fkField
.
codeName
}}
));
}
public boolean saveBy
{{
pascalCase
fkField
.
codeName
}}
(
{{
fkField
.
type
.
java
}}
{{
camelCase
fkField
.
c
odeName
}}
,List
<
{{
entity
.
codeName
}}
>
list) {
public boolean saveBy
{{
pascalCase
fkField
.
codeName
}}
(
{{
entityCodeName
}}
{{
camelCase
entityC
odeName
}}
,List
<
{{
entity
.
codeName
}}
>
list) {
if(list==null)
return true;
Set
<
{{
entity
.
keyField
.
type
.
java
}}
>
delIds=new HashSet
<
{{
entity
.
keyField
.
type
.
java
}}
>
();
List
<
{{
entity
.
codeName
}}
>
_update=new ArrayList
<
{{
entity
.
codeName
}}
>
();
List
<
{{
entity
.
codeName
}}
>
_create=new ArrayList
<
{{
entity
.
codeName
}}
>
();
for(
{{
entity
.
codeName
}}
before:selectBy
{{
pascalCase
fkField
.
codeName
}}
(
{{
camelCase
fkField
.
codeName
}}
)){
for(
{{
entity
.
codeName
}}
before:selectBy
{{
pascalCase
fkField
.
codeName
}}
(
{{
camelCase
entityCodeName
}}
.get
{{
pascalCase
relEntity
.
keyField
.
codeName
}}
()
)){
delIds.add(before.get
{{
pascalCase
entity
.
keyField
.
codeName
}}
());
}
for(
{{
entity
.
codeName
}}
sub:list) {
sub.set
{{
pascalCase
fkField
.
codeName
}}
(
{{
camelCase
fkField
.
codeName
}}
);
sub.set
{{
pascalCase
fkField
.
codeName
}}
(
{{
camelCase
entityCodeName
}}
.get
{{
pascalCase
relEntity
.
keyField
.
codeName
}}
());
sub.set
{{
pascalCase
codeName
}}
(
{{
camelCase
entityCodeName
}}
);
if(ObjectUtils.isEmpty(sub.get
{{
pascalCase
entity
.
keyField
.
codeName
}}
()))
sub.set
{{
pascalCase
entity
.
keyField
.
codeName
}}
((
{{
entity
.
keyField
.
type
.
java
}}
)sub.getDefaultKey(true));
if(delIds.contains(sub.get
{{
pascalCase
entity
.
keyField
.
codeName
}}
())) {
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录