Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
7de1b0dd
提交
7de1b0dd
编写于
3月 17, 2021
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补充批处理调用处理逻辑
上级
09cf5c0f
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
136 行增加
和
12 行删除
+136
-12
%DE%ServiceImpl.java.ftl
.../core/%MOD_PKGPATH%/service/impl/%DE%ServiceImpl.java.ftl
+136
-12
未找到文件。
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/service/impl/%DE%ServiceImpl.java.ftl
浏览文件 @
7de1b0dd
...
@@ -70,6 +70,25 @@ TARGET=PSDATAENTITY
...
@@ -70,6 +70,25 @@ TARGET=PSDATAENTITY
<#
if
item
.
getDynaInstMode
()??
&&
(
item
.
getDynaInstMode
()?
c
==
'1'
||
item
.
getDynaInstMode
()?
c
==
'2'
)>
<#
if
item
.
getDynaInstMode
()??
&&
(
item
.
getDynaInstMode
()?
c
==
'1'
||
item
.
getDynaInstMode
()?
c
==
'2'
)>
<#
assign
isDynaSys
=
true
>
<#
assign
isDynaSys
=
true
>
</#
if
>
</#
if
>
<#
comment
>
create
.
update
.
remove
是否存在附加逻辑
</#
comment
>
<#
assign
hasCreateLogic
=
false
>
<#
assign
hasUpdateLogic
=
false
>
<#
assign
hasDeleteLogic
=
false
>
<#
comment
>
判断行为是否存在有附加逻辑
</#
comment
>
<#
if
de
.
getAllPSDEActions
()??>
<#
list
de
.
getAllPSDEActions
()
as
deAction
>
<#
if
deAction
.
getCodeName
()?
lower_case
==
'create'
&&
deAction
.
getPSDEActionLogics
()??>
<#
assign
hasCreateLogic
=
true
>
<#
elseif
deAction
.
getCodeName
()?
lower_case
==
'update'
&&
deAction
.
getPSDEActionLogics
()??>
<#
assign
hasUpdateLogic
=
true
>
<#
elseif
deAction
.
getCodeName
()?
lower_case
==
'remove'
&&
deAction
.
getPSDEActionLogics
()??>
<#
assign
hasDeleteLogic
=
true
>
</#
if
>
</#
list
>
</#
if
>
<#
assign
isDupCheck
=
isDupCheckEntity
(
de
)>
<#
assign
isDupCheck
=
isDupCheckEntity
(
de
)>
<#
assign
keyfield
=
de
.
getKeyPSDEField
()>
<#
assign
keyfield
=
de
.
getKeyPSDEField
()>
<#
assign
keyfieldPrivateCodeName
=
srfcaseformat
(
keyfield
.
getCodeName
(),
'l_u2lC'
)
>
<#
assign
keyfieldPrivateCodeName
=
srfcaseformat
(
keyfield
.
getCodeName
(),
'l_u2lC'
)
>
...
@@ -340,11 +359,22 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
...
@@ -340,11 +359,22 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
<#
if
hasMinorPSDERs
gt
0
>
<#
if
hasMinorPSDERs
gt
0
>
list
.
forEach
(
item
->
fillParentData
(
item
));
list
.
forEach
(
item
->
fillParentData
(
item
));
</#
if
>
</#
if
>
<#
comment
>
联合主键,走
SaveOrUpdateBatch
,防止因主键冲突导致后续数据无法保存
</#
comment
>
<#
comment
>
存在附加逻辑时,则
for
循环调用单行为,以实现批处理时触发处理逻辑
</#
comment
>
<#
if
item
.
getUnionKeyValuePSDEFields
()??>
<#
if
hasCreateLogic
>
this
.
saveOrUpdateBatch
(
list
,
batchSize
);
for
(${
item
.
getCodeName
()}
et
:
list
)
{
<#
if
item
.
getUnionKeyValuePSDEFields
()??>
getProxyService
().
saveOrUpdate
(
et
);
<#
else
>
getProxyService
().
save
(
et
);
}
</#
if
>
<#
else
>
<#
else
>
<#
comment
>
联合主键,走
SaveOrUpdateBatch
,防止因主键冲突导致后续数据无法保存
</#
comment
>
<#
if
item
.
getUnionKeyValuePSDEFields
()??>
this
.
saveOrUpdateBatch
(
list
,
batchSize
);
<#
else
>
this
.
saveBatch
(
list
,
batchSize
);
this
.
saveBatch
(
list
,
batchSize
);
</#
if
>
</#
if
>
</#
if
>
<#
comment
>
批量更新父数据(实体关系属性映射)
</#
comment
>
<#
comment
>
批量更新父数据(实体关系属性映射)
</#
comment
>
<#
if
hasPSDERsMapping
>
<#
if
hasPSDERsMapping
>
...
@@ -423,7 +453,14 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
...
@@ -423,7 +453,14 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
<#
if
hasMinorPSDERs
gt
0
>
<#
if
hasMinorPSDERs
gt
0
>
list
.
forEach
(
item
->
fillParentData
(
item
));
list
.
forEach
(
item
->
fillParentData
(
item
));
</#
if
>
</#
if
>
<#
comment
>
存在附加逻辑时,则
for
循环调用单行为,以实现批处理时触发处理逻辑
</#
comment
>
<#
if
hasUpdateLogic
>
for
(${
item
.
getCodeName
()}
et
:
list
)
{
getProxyService
().
update
(
et
);
}
<#
else
>
updateBatchById
(
list
,
batchSize
);
updateBatchById
(
list
,
batchSize
);
</#
if
>
<#
comment
>
批量更新父数据(实体关系属性映射)
</#
comment
>
<#
comment
>
批量更新父数据(实体关系属性映射)
</#
comment
>
<#
if
hasPSDERsMapping
>
<#
if
hasPSDERsMapping
>
updateParentDataBatch
(
list
);
updateParentDataBatch
(
list
);
...
@@ -523,11 +560,18 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
...
@@ -523,11 +560,18 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
<#
comment
>
输出测试行为
</#
comment
>
<#
comment
>
输出测试行为
</#
comment
>
<@
outputTestAction
deaction
"removeBatch"
/>
<@
outputTestAction
deaction
"removeBatch"
/>
<#
if
hasPSDERsMapping
>
<#
if
hasPSDERsMapping
>
List
<${
item
.
getCodeName
()}>
entities
=
baseMapper
.
selectBatchIds
(
idList
);
List
<${
item
.
getCodeName
()}>
entities
=
baseMapper
.
selectBatchIds
(
idList
);
</#
if
>
</#
if
>
<#
comment
>
主实体删除操作(同时删除、置空、限制删除)
</#
comment
>
<#
comment
>
主实体删除操作(同时删除、置空、限制删除)
</#
comment
>
<@
majorEntityRemoveBatch
/>
<@
majorEntityRemoveBatch
/>
<#
comment
>
存在附加逻辑时,则
for
循环调用单行为,以实现批处理时触发处理逻辑
</#
comment
>
<#
if
hasDeleteLogic
>
for
(${
srfr7javatype
(
keyfield
.
stdDataType
)}
id
:
idList
)
{
getProxyService
().
removeById
(
id
);
}
<#
else
>
removeByIds
(
idList
);
removeByIds
(
idList
);
</#
if
>
<#
comment
>
批量更新父数据(实体关系属性映射)
</#
comment
>
<#
comment
>
批量更新父数据(实体关系属性映射)
</#
comment
>
<#
if
hasPSDERsMapping
>
<#
if
hasPSDERsMapping
>
updateParentDataBatch
(
entities
);
updateParentDataBatch
(
entities
);
...
@@ -1223,10 +1267,21 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -1223,10 +1267,21 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
public
void
createBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
public
void
createBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
<@
outputTestAction
deaction
"createBatch"
/>
<@
outputTestAction
deaction
"createBatch"
/>
<#
comment
>
联合主键,走
SaveOrUpdateBatch
,防止因主键冲突导致后续数据无法保存
</#
comment
>
<#
comment
>
联合主键,走
SaveOrUpdateBatch
,防止因主键冲突导致后续数据无法保存
</#
comment
>
<#
if
item
.
getUnionKeyValuePSDEFields
()??>
<#
if
hasCreateLogic
>
<#
if
item
.
getUnionKeyValuePSDEFields
()??>
repository
.
saveAll
(
list
);
repository
.
saveAll
(
list
);
<#
else
>
for
(${
item
.
getCodeName
()}
et
:
list
)
{
getProxyService
().
create
(
et
);
}
</#
if
>
<#
else
>
<#
else
>
<#
comment
>
联合主键,走
SaveOrUpdateBatch
,防止因主键冲突导致后续数据无法保存
</#
comment
>
<#
if
item
.
getUnionKeyValuePSDEFields
()??>
repository
.
saveAll
(
list
);
<#
else
>
repository
.
insert
(
list
);
repository
.
insert
(
list
);
</#
if
>
</#
if
>
</#
if
>
}
}
...
@@ -1276,7 +1331,13 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -1276,7 +1331,13 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
@
Override
@
Override
public
void
updateBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
public
void
updateBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
<@
outputTestAction
deaction
"updateBatch"
/>
<@
outputTestAction
deaction
"updateBatch"
/>
<#
if
hasUpdateLogic
>
for
(${
item
.
getCodeName
()}
et
:
list
)
{
getProxyService
().
update
(
et
);
}
<#
else
>
repository
.
saveAll
(
list
);
repository
.
saveAll
(
list
);
</#
if
>
}
}
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"save"
>
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"save"
>
...
@@ -1355,7 +1416,13 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -1355,7 +1416,13 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
@
Override
@
Override
public
void
removeBatch
(
Collection
<${
srfr7javatype
(
keyfield
.
stdDataType
)}>
idList
)
{
public
void
removeBatch
(
Collection
<${
srfr7javatype
(
keyfield
.
stdDataType
)}>
idList
)
{
<@
outputTestAction
deaction
"removeBatch"
/>
<@
outputTestAction
deaction
"removeBatch"
/>
<#
if
hasDeleteLogic
>
for
(${
srfr7javatype
(
keyfield
.
stdDataType
)}
id
:
idList
)
{
getProxyService
().
remove
(
id
);
}
<#
else
>
repository
.
deleteAll
(
repository
.
findAllById
(
idList
));
repository
.
deleteAll
(
repository
.
findAllById
(
idList
));
</#
if
>
}
}
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"getdraft"
>
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"getdraft"
>
...
@@ -1539,6 +1606,10 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -1539,6 +1606,10 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
<@
outputSearchContext
/>
<@
outputSearchContext
/>
<#
comment
>
动态行为
</#
comment
>
<#
comment
>
动态行为
</#
comment
>
<@
dynamicCall
/>
<@
dynamicCall
/>
<#
comment
>
引入
proxyservice
</#
comment
>
<#
if
hasCreateLogic
||
hasUpdateLogic
||
hasDeleteLogic
>
<@
autowiredProxyService
/>
</#
if
>
}
}
...
@@ -1715,9 +1786,15 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -1715,9 +1786,15 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
public
void
createBatch
(
List
<${
item
.
codeName
}>
list
){
public
void
createBatch
(
List
<${
item
.
codeName
}>
list
){
<@
outputTestAction
deaction
"createBatch"
/>
<@
outputTestAction
deaction
"createBatch"
/>
<#
if
item
.
isEnableAPIStorage
()>
<#
if
item
.
isEnableAPIStorage
()>
<#
if
deaction
.
getPSSubSysServiceAPIDEMethod
()??
>
<#
if
deaction
.
getPSSubSysServiceAPIDEMethod
()??
>
<#
if
hasCreateLogic
>
for
(${
item
.
getCodeName
()}
et
:
list
)
{
getProxyService
().
create
(
et
);
}
<#
else
>
${
subSysServiceApiDECodeName
?
uncap_first
}
FeignClient
.
createBatch
(
list
)
;
${
subSysServiceApiDECodeName
?
uncap_first
}
FeignClient
.
createBatch
(
list
)
;
</#
if
>
</#
if
>
</#
if
>
</#
if
>
</#
if
>
}
}
...
@@ -1773,9 +1850,15 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -1773,9 +1850,15 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
public
void
updateBatch
(
List
<${
item
.
codeName
}>
list
){
public
void
updateBatch
(
List
<${
item
.
codeName
}>
list
){
<@
outputTestAction
deaction
"updateBatch"
/>
<@
outputTestAction
deaction
"updateBatch"
/>
<#
if
item
.
isEnableAPIStorage
()>
<#
if
item
.
isEnableAPIStorage
()>
<#
if
deaction
.
getPSSubSysServiceAPIDEMethod
()??
>
<#
if
deaction
.
getPSSubSysServiceAPIDEMethod
()??
>
<#
if
hasUpdateLogic
>
for
(${
item
.
getCodeName
()}
et
:
list
)
{
getProxyService
().
update
(
et
);
}
<#
else
>
${
subSysServiceApiDECodeName
?
uncap_first
}
FeignClient
.
updateBatch
(
list
)
;
${
subSysServiceApiDECodeName
?
uncap_first
}
FeignClient
.
updateBatch
(
list
)
;
</#
if
>
</#
if
>
</#
if
>
</#
if
>
</#
if
>
}
}
...
@@ -1884,7 +1967,13 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -1884,7 +1967,13 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
<@
outputTestAction
deaction
"removeBatch"
/>
<@
outputTestAction
deaction
"removeBatch"
/>
<#
if
item
.
isEnableAPIStorage
()>
<#
if
item
.
isEnableAPIStorage
()>
<#
if
deaction
.
getPSSubSysServiceAPIDEMethod
()??
>
<#
if
deaction
.
getPSSubSysServiceAPIDEMethod
()??
>
<#
if
hasDeleteLogic
>
for
(${
srfr7javatype
(
keyfield
.
stdDataType
)}
id
:
idList
)
{
getProxyService
().
remove
(
id
);
}
<#
else
>
${
subSysServiceApiDECodeName
?
uncap_first
}
FeignClient
.
removeBatch
(
idList
);
${
subSysServiceApiDECodeName
?
uncap_first
}
FeignClient
.
removeBatch
(
idList
);
</#
if
>
</#
if
>
</#
if
>
</#
if
>
</#
if
>
}
}
...
@@ -2070,6 +2159,10 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -2070,6 +2159,10 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
<@
dynamicCall
/>
<@
dynamicCall
/>
<#
comment
>
发布
es
服务对象
</#
comment
>
<#
comment
>
发布
es
服务对象
</#
comment
>
<@
esAnno
/>
<@
esAnno
/>
<#
comment
>
引入
proxyservice
</#
comment
>
<#
if
hasCreateLogic
||
hasUpdateLogic
||
hasDeleteLogic
>
<@
autowiredProxyService
/>
</#
if
>
}
}
<#
comment
>
无存储
</#
comment
>
<#
comment
>
无存储
</#
comment
>
...
@@ -2187,7 +2280,12 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -2187,7 +2280,12 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
}
}
public
void
createBatch
(
List
<${
item
.
codeName
}>
list
){
public
void
createBatch
(
List
<${
item
.
codeName
}>
list
){
<@
outputTestAction
deaction
"createBatch"
/>
<@
outputTestAction
deaction
"createBatch"
/>
<#
if
hasCreateLogic
>
for
(${
item
.
getCodeName
()}
et
:
list
)
{
getProxyService
().
create
(
et
);
}
</#
if
>
}
}
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"update"
>
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"update"
>
...
@@ -2203,7 +2301,12 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -2203,7 +2301,12 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
}
}
public
void
updateBatch
(
List
<${
item
.
codeName
}>
list
){
public
void
updateBatch
(
List
<${
item
.
codeName
}>
list
){
<@
outputTestAction
deaction
"updateBatch"
/>
<@
outputTestAction
deaction
"updateBatch"
/>
<#
if
hasUpdateLogic
>
for
(${
item
.
getCodeName
()}
et
:
list
)
{
getProxyService
().
update
(
et
);
}
</#
if
>
}
}
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"save"
>
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"save"
>
...
@@ -2237,7 +2340,12 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -2237,7 +2340,12 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
}
}
public
void
removeBatch
(
Collection
<${
srfr7javatype
(
keyfield
.
stdDataType
)}>
idList
){
public
void
removeBatch
(
Collection
<${
srfr7javatype
(
keyfield
.
stdDataType
)}>
idList
){
<@
outputTestAction
deaction
"removeBatch"
/>
<@
outputTestAction
deaction
"removeBatch"
/>
<#
if
hasDeleteLogic
>
for
(${
srfr7javatype
(
keyfield
.
stdDataType
)}
id
:
idList
)
{
getProxyService
().
remove
(
id
);
}
</#
if
>
}
}
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"getdraft"
>
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"getdraft"
>
...
@@ -2388,6 +2496,10 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -2388,6 +2496,10 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
<@
dynamicCall
/>
<@
dynamicCall
/>
<#
comment
>
发布
es
服务对象
</#
comment
>
<#
comment
>
发布
es
服务对象
</#
comment
>
<@
esAnno
/>
<@
esAnno
/>
<#
comment
>
引入
proxyservice
</#
comment
>
<#
if
hasCreateLogic
||
hasUpdateLogic
||
hasDeleteLogic
>
<@
autowiredProxyService
/>
</#
if
>
}
}
</#
if
>
</#
if
>
...
@@ -2910,10 +3022,22 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -2910,10 +3022,22 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
if
(
rs
.
getInteger
(
"rst"
)==
1
&&
!isIgnoreError) {
if
(
rs
.
getInteger
(
"rst"
)==
1
&&
!isIgnoreError) {
return
rs
;
return
rs
;
}
}
List
<${
de
.
codeName
}>
tempDEList
=
new
ArrayList
<>();
Set
tempIds
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
entities
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
entities
.
size
();
i
++)
{
${
de
.
codeName
}
entity
=
entities
.
get
(
i
);
${
de
.
codeName
}
entity
=
entities
.
get
(
i
);
getProxyService
().
save
(
entity
);
tempDEList
.
add
(
entity
);
}
Object
id
=
entity
.
get
${
keyfieldPublicCodeName
}();
if
(
!ObjectUtils.isEmpty(id)) {
tempIds
.
add
(
id
);
}
if
(
tempDEList
.
size
()>=
batchSize
||
(
tempDEList
.
size
()<
batchSize
&&
i
==
entities
.
size
()-
1
)){
commit
(
tempDEList
,
tempIds
);
tempDEList
.
clear
();
tempIds
.
clear
();
}
}
rs
.
put
(
"rst"
,
0
);
rs
.
put
(
"rst"
,
0
);
rs
.
put
(
"data"
,
entities
);
rs
.
put
(
"data"
,
entities
);
return
rs
;
return
rs
;
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录