Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
b33cb212
提交
b33cb212
编写于
9月 12, 2020
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
虚拟联合主键
上级
249c8e84
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
136 行增加
和
9 行删除
+136
-9
%DE%.java.ftl
...ava/%SYS_PKGPATH%/core/%MOD_PKGPATH%/domain/%DE%.java.ftl
+44
-2
%DE%ServiceImpl.java.ftl
.../core/%MOD_PKGPATH%/service/impl/%DE%ServiceImpl.java.ftl
+91
-6
DEFieldDefaultValueAspect.java.ftl
...S_PKGPATH%/util/aspect/DEFieldDefaultValueAspect.java.ftl
+1
-1
未找到文件。
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/domain/%DE%.java.ftl
浏览文件 @
b33cb212
...
@@ -120,11 +120,11 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
...
@@ -120,11 +120,11 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
@
Audit
@
Audit
</#
if
>
</#
if
>
<#
comment
>
属性默认值
</#
comment
>
<#
comment
>
属性默认值
</#
comment
>
<#
if
defieldano
??
&&
defieldano
!='' && defield.isPhisicalDEField()==true
>
<#
if
(
defieldano
??
&&
defieldano
!='' && defield.isPhisicalDEField()==true ) || defield.isKeyDEField()
>
@
DEField
(${
defieldano
})
@
DEField
(${
defieldano
})
</#
if
>
</#
if
>
<#
comment
>
主键
</#
comment
>
<#
comment
>
主键
</#
comment
>
<#
if
defield
.
isKeyDEField
()==
true
>
<#
if
defield
.
isKeyDEField
()==
true
&&
defield
.
isPhisicalDEField
()==
true
>
<#
if
defield
.
getDataType
()
==
"ACID"
>
<#
if
defield
.
getDataType
()
==
"ACID"
>
@
TableId
(
value
=
"${columnname}"
,
type
=
IdType
.
AUTO
)
@
TableId
(
value
=
"${columnname}"
,
type
=
IdType
.
AUTO
)
<#
elseif
defield
.
getDataType
()
==
"BIGINT"
>
<#
elseif
defield
.
getDataType
()
==
"BIGINT"
>
...
@@ -287,6 +287,47 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
...
@@ -287,6 +287,47 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
<#
if
item
.
getUnionKeyValuePSDEFields
()??>
<#
if
item
.
getUnionKeyValuePSDEFields
()??>
<#
assign
privateCodeName
=
srfcaseformat
(
keyField
.
getCodeName
(),
'l_u2lC'
)
>
<#
assign
privateCodeName
=
srfcaseformat
(
keyField
.
getCodeName
(),
'l_u2lC'
)
>
<#
assign
publicCodeName
=
privateCodeName
?
cap_first
>
<#
assign
publicCodeName
=
privateCodeName
?
cap_first
>
<#
if
keyField
.
isPhisicalDEField
==
false
>
<#
comment
>
虚拟联合主键
</#
comment
>
<#
assign
unionKeySize
=
0
>
<#
list
item
.
getUnionKeyValuePSDEFields
()
as
defield
>
<#
assign
unionKeySize
=
unionKeySize
+
1
>
</#
list
>
/**
*
获取
[${
defield
.
getLogicName
()}]
*/
public
${
srfr7javatype
(
keyField
.
getStdDataType
())}
get
${
publicCodeName
}(){
Object
id
=
getDefaultKey
(
true
);
return
ObjectUtils
.
isEmpty
(
id
)?
null
:(${
srfr7javatype
(
keyField
.
getStdDataType
())})
id
;
}
/**
*
设置
[${
defield
.
getLogicName
()}]
*/
public
void
set
${
publicCodeName
}(${
srfr7javatype
(
defield
.
getStdDataType
())}
${
prvateCodeName
})
{
if
(
!StringUtils.isEmpty(${prvateCodeName})){
String
[]
args
=${
prvateCodeName
}.
split
(
"
\\
|
\\
|"
);
if
(
args
.
length
==${
unionKeySize
}){
${
checkUnionKey
(
item
.
getUnionKeyValuePSDEFields
())}{
<#
list
item
.
getUnionKeyValuePSDEFields
()
as
defield
>
<#
assign
unionKeyPrivateCodeName
=
srfcaseformat
(
defield
.
getCodeName
(),
'l_u2lC'
)
>
<#
assign
unionKeyPublicCodeName
=
unionKeyPrivateCodeName
?
cap_first
>
this
.
set
${
unionKeyPublicCodeName
}(
args
[${
defield_index
}]);
</#
list
>
}
}
this
.${
prvateCodeName
}
=
${
prvateCodeName
}
;
}
}
@
Override
public
Serializable
getDefaultKey
(
boolean
gen
)
{
${
checkUnionKey
(
item
.
getUnionKeyValuePSDEFields
())}
return
${
getUnionKey
(
item
.
getUnionKeyValuePSDEFields
())};
return
null
;
}
<#
else
>
/**
/**
*
获取
[${
keyField
.
getLogicName
()}]
*
获取
[${
keyField
.
getLogicName
()}]
*/
*/
...
@@ -303,6 +344,7 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
...
@@ -303,6 +344,7 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
return
DigestUtils
.
md5DigestAsHex
(${
getUnionKey
(
item
.
getUnionKeyValuePSDEFields
())}.
getBytes
());
return
DigestUtils
.
md5DigestAsHex
(${
getUnionKey
(
item
.
getUnionKeyValuePSDEFields
())}.
getBytes
());
return
null
;
return
null
;
}
}
</#
if
>
<#
comment
>
Long
型主键
</#
comment
>
<#
comment
>
Long
型主键
</#
comment
>
<#
elseif
srfr7javatype
(
keyField
.
getStdDataType
())==
'Long'
>
<#
elseif
srfr7javatype
(
keyField
.
getStdDataType
())==
'Long'
>
@
Override
@
Override
...
...
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/service/impl/%DE%ServiceImpl.java.ftl
浏览文件 @
b33cb212
...
@@ -90,6 +90,7 @@ import org.springframework.data.domain.PageImpl;
...
@@ -90,6 +90,7 @@ import org.springframework.data.domain.PageImpl;
import
org
.
springframework
.
data
.
domain
.
Pageable
;
import
org
.
springframework
.
data
.
domain
.
Pageable
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Value
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Value
;
import
${
pub
.
getPKGCodeName
()}.
util
.
errors
.
BadRequestAlertException
;
<#
if
pub
.
isEnableGlobalTransaction
??
&&
pub
.
isEnableGlobalTransaction
()??
&&
pub
.
isEnableGlobalTransaction
()==
true
>
<#
if
pub
.
isEnableGlobalTransaction
??
&&
pub
.
isEnableGlobalTransaction
()??
&&
pub
.
isEnableGlobalTransaction
()==
true
>
import
io
.
seata
.
spring
.
annotation
.
GlobalTransactional
;
import
io
.
seata
.
spring
.
annotation
.
GlobalTransactional
;
</#
if
>
</#
if
>
...
@@ -108,6 +109,7 @@ import ${pub.getPKGCodeName()}.util.helper.DEFieldCacheMap;
...
@@ -108,6 +109,7 @@ import ${pub.getPKGCodeName()}.util.helper.DEFieldCacheMap;
import
com
.
baomidou
.
mybatisplus
.
extension
.
service
.
impl
.
ServiceImpl
;
import
com
.
baomidou
.
mybatisplus
.
extension
.
service
.
impl
.
ServiceImpl
;
import
${
pub
.
getPKGCodeName
()}.
core
.${
item
.
getPSSystemModule
().
getCodeName
()?
lower_case
}.
mapper
.${
item
.
getCodeName
()}
Mapper
;
import
${
pub
.
getPKGCodeName
()}.
core
.${
item
.
getPSSystemModule
().
getCodeName
()?
lower_case
}.
mapper
.${
item
.
getCodeName
()}
Mapper
;
import
com
.
baomidou
.
mybatisplus
.
core
.
conditions
.
query
.
QueryWrapper
;
import
com
.
baomidou
.
mybatisplus
.
core
.
conditions
.
query
.
QueryWrapper
;
import
com
.
baomidou
.
mybatisplus
.
core
.
conditions
.
update
.
UpdateWrapper
;
import
com
.
baomidou
.
mybatisplus
.
core
.
conditions
.
Wrapper
;
import
com
.
baomidou
.
mybatisplus
.
core
.
conditions
.
Wrapper
;
import
com
.
alibaba
.
fastjson
.
JSONObject
;
import
com
.
alibaba
.
fastjson
.
JSONObject
;
import
org
.
springframework
.
util
.
StringUtils
;
import
org
.
springframework
.
util
.
StringUtils
;
...
@@ -120,6 +122,8 @@ import org.springframework.util.StringUtils;
...
@@ -120,6 +122,8 @@ import org.springframework.util.StringUtils;
public
class
${
item
.
getCodeName
()}
ServiceImpl
extends
ServiceImpl
<${
de
.
getCodeName
()}
Mapper
,
${
de
.
getCodeName
()}>
implements
I
${
de
.
getCodeName
()}
Service
{
public
class
${
item
.
getCodeName
()}
ServiceImpl
extends
ServiceImpl
<${
de
.
getCodeName
()}
Mapper
,
${
de
.
getCodeName
()}>
implements
I
${
de
.
getCodeName
()}
Service
{
<#
assign
keyfield
=
de
.
getKeyPSDEField
()>
<#
assign
keyfield
=
de
.
getKeyPSDEField
()>
<#
assign
keyfieldPrivateCodeName
=
srfcaseformat
(
keyfield
.
getCodeName
(),
'l_u2lC'
)
>
<#
assign
keyfieldPublicCodeName
=
keyfieldPrivateCodeName
?
cap_first
>
<#
comment
>
引入关联依赖
-
从关系
</#
comment
>
<#
comment
>
引入关联依赖
-
从关系
</#
comment
>
<#
if
de
.
getMajorPSDERs
()??>
<#
if
de
.
getMajorPSDERs
()??>
...
@@ -317,6 +321,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
...
@@ -317,6 +321,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
}
}
@
Override
@
Override
<@
transactionalAnno
deaction
/>
public
void
createBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
public
void
createBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
<#
comment
>
输出测试行为
</#
comment
>
<#
comment
>
输出测试行为
</#
comment
>
<@
outputTestAction
deaction
"createBatch"
/>
<@
outputTestAction
deaction
"createBatch"
/>
...
@@ -351,8 +356,14 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
...
@@ -351,8 +356,14 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
${
srfcaseformat
(
majorIndexDECodeName
,
'l_u2lC'
)}
Service
.
update
(${
de
.
codeName
?
lower_case
}
InheritMapping
.
to
${
majorIndexDECodeNameCamel
}(
et
));
${
srfcaseformat
(
majorIndexDECodeName
,
'l_u2lC'
)}
Service
.
update
(${
de
.
codeName
?
lower_case
}
InheritMapping
.
to
${
majorIndexDECodeNameCamel
}(
et
));
</#
if
>
</#
if
>
<#
if
de
.
getKeyPSDEField
()??>
<#
if
de
.
getKeyPSDEField
()??>
if
(
!update(et,(Wrapper) et.getUpdateWrapper(true).eq("${keyfield.name?lower_case}",et.get${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}())))
<#
if
de
.
getKeyPSDEField
().
isPhisicalDEField
==
false
&&
de
.
getUnionKeyValuePSDEFields
()??>
<#
comment
>
虚拟联合主键
</#
comment
>
if
(
!updateById(et))
return
false
;
<#
else
>
if
(
!update(et,(Wrapper) et.getUpdateWrapper(true).eq("${keyfield.name?lower_case}",et.get${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}())))
return
false
;
return
false
;
</#
if
>
<#
comment
>
1
:
N
关系中,在父实体中创建子实体的
List
集合
</#
comment
>
<#
comment
>
1
:
N
关系中,在父实体中创建子实体的
List
集合
</#
comment
>
<#
if
de
.
getMajorPSDERs
??
&&
de
.
getMajorPSDERs
()??>
<#
if
de
.
getMajorPSDERs
??
&&
de
.
getMajorPSDERs
()??>
<#
list
de
.
getMajorPSDERs
()
as
MajorPSDER
>
<#
list
de
.
getMajorPSDERs
()
as
MajorPSDER
>
...
@@ -391,6 +402,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
...
@@ -391,6 +402,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
}
}
@
Override
@
Override
<@
transactionalAnno
deaction
/>
public
void
updateBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
public
void
updateBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
<#
comment
>
输出测试行为
</#
comment
>
<#
comment
>
输出测试行为
</#
comment
>
<@
outputTestAction
deaction
"updateBatch"
/>
<@
outputTestAction
deaction
"updateBatch"
/>
...
@@ -432,6 +444,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
...
@@ -432,6 +444,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
}
}
@
Override
@
Override
<@
transactionalAnno
deaction
/>
public
boolean
saveBatch
(
Collection
<${
item
.
getCodeName
()}>
list
)
{
public
boolean
saveBatch
(
Collection
<${
item
.
getCodeName
()}>
list
)
{
<#
comment
>
输出测试行为
</#
comment
>
<#
comment
>
输出测试行为
</#
comment
>
<@
outputTestAction
deaction
"saveBatch"
/>
<@
outputTestAction
deaction
"saveBatch"
/>
...
@@ -443,6 +456,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
...
@@ -443,6 +456,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
}
}
@
Override
@
Override
<@
transactionalAnno
deaction
/>
public
void
saveBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
public
void
saveBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
<#
comment
>
输出测试行为
</#
comment
>
<#
comment
>
输出测试行为
</#
comment
>
<@
outputTestAction
deaction
"saveBatch"
/>
<@
outputTestAction
deaction
"saveBatch"
/>
...
@@ -487,6 +501,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
...
@@ -487,6 +501,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
}
}
@
Override
@
Override
<@
transactionalAnno
deaction
/>
public
void
removeBatch
(
Collection
<${
srfr7javatype
(
keyfield
.
stdDataType
)}>
idList
)
{
public
void
removeBatch
(
Collection
<${
srfr7javatype
(
keyfield
.
stdDataType
)}>
idList
)
{
<#
comment
>
输出测试行为
</#
comment
>
<#
comment
>
输出测试行为
</#
comment
>
<@
outputTestAction
deaction
"removeBatch"
/>
<@
outputTestAction
deaction
"removeBatch"
/>
...
@@ -883,6 +898,55 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
...
@@ -883,6 +898,55 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
<#
comment
>
实体数据导入
</#
comment
>
<#
comment
>
实体数据导入
</#
comment
>
<@
deImportData
/>
<@
deImportData
/>
<#
comment
>
虚拟联合主键
</#
comment
>
<#
if
de
.
getKeyPSDEField
().
isPhisicalDEField
==
false
&&
de
.
getUnionKeyValuePSDEFields
()??>
private
${
item
.
getCodeName
()}
getById
(${
srfr7javatype
(
keyfield
.
getStdDataType
())}
id
){
${
item
.
getCodeName
()}
entity
=
new
${
item
.
getCodeName
()}();
entity
.
set
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}(
id
);
if
(
ObjectUtils
.
isEmpty
(
entity
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}())){
log
.
error
(
"获取数据失败,联合键值为空"
);
return
entity
;
}
entity
=
this
.
getOne
(
new
QueryWrapper
(
entity
));
return
entity
;
}
private
boolean
removeById
(${
srfr7javatype
(
keyfield
.
getStdDataType
())}
id
){
${
item
.
getCodeName
()}
entity
=
new
${
item
.
getCodeName
()}();
entity
.
set
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}(
id
);
if
(
ObjectUtils
.
isEmpty
(
entity
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}())){
log
.
error
(
"删除数据失败,联合键值为空"
);
return
false
;
}
return
this
.
remove
(
new
QueryWrapper
(
entity
));
}
public
boolean
updateById
(${
item
.
getCodeName
()}
et
){
UpdateWrapper
<${
item
.
getCodeName
()}>
wrapper
=
et
.
getUpdateWrapper
(
true
);
if
(
ObjectUtils
.
isEmpty
(
entity
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}())){
log
.
error
(
"更新数据失败,联合键值为空"
);
return
false
;
}
return
${
getUnionKeyUpdateCond
(
de
.
getUnionKeyValuePSDEFields
())};
}
private
boolean
updateBatchById
(
List
<${
item
.
getCodeName
()}>
ets
,
int
batchSize
){
for
(${
item
.
getCodeName
()}
et
:
ets
){
if
(
!updateById(et))
throw
new
BadRequestAlertException
(
String
.
format
(
"更新[{}]数据失败"
,
entity
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}()),
""
,
""
);
}
return
true
;
}
public
boolean
removeByIds
(
List
<${
srfr7javatype
(
keyfield
.
getStdDataType
())}>
ids
){
for
(${
srfr7javatype
(
keyfield
.
getStdDataType
())}
id
:
ids
){
if
(
!removeById(id))
throw
new
BadRequestAlertException
(
String
.
format
(
"删除[{}]数据失败"
,
id
),
""
,
""
);
}
return
true
;
}
</#
if
>
}
}
<#
comment
>
NOSQL
存储
</#
comment
>
<#
comment
>
NOSQL
存储
</#
comment
>
...
@@ -2487,10 +2551,18 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -2487,10 +2551,18 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
//
主键重复性判断
.
外键约束判断(上传数据自身的检查
/
数据库的检查)
//
主键重复性判断
.
外键约束判断(上传数据自身的检查
/
数据库的检查)
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
);
Object
id
=
entity
.
get
(
keyField
);
Object
id
=
entity
.
get
${
keyfieldPublicCodeName
}(
);
if
(
ObjectUtils
.
isEmpty
(
id
))
{
if
(
ObjectUtils
.
isEmpty
(
id
))
{
id
=
entity
.
getDefaultKey
(
true
);
id
=
entity
.
getDefaultKey
(
true
);
entity
.
set
(
keyField
,
id
);
if
(
ObjectUtils
.
isEmpty
(
id
)){
Integer
lineNum
=
i
+
1
;
errorLines
.
add
(
lineNum
);
errorMsgs
.
add
(
"第"
+
lineNum
+
"行:无法获取当前数据主键。"
);
continue
;
}
else
{
entity
.
set
${
keyfieldPublicCodeName
}((${
srfr7javatype
(
keyfield
.
getStdDataType
())})
id
);
}
}
}
if
(
!ids.contains(id)){
if
(
!ids.contains(id)){
ids
.
add
(
id
);
ids
.
add
(
id
);
...
@@ -2598,7 +2670,7 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -2598,7 +2670,7 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
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
);
tempDEList
.
add
(
entity
);
tempDEList
.
add
(
entity
);
Object
id
=
entity
.
get
(
keyField
);
Object
id
=
entity
.
get
${
keyfieldPublicCodeName
}(
);
if
(
!ObjectUtils.isEmpty(id))
if
(
!ObjectUtils.isEmpty(id))
tempIds
.
add
(
id
);
tempIds
.
add
(
id
);
if
(
tempDEList
.
size
()>=
batchSize
||
(
tempDEList
.
size
()<
batchSize
&&
i
==
entities
.
size
()-
1
)){
if
(
tempDEList
.
size
()>=
batchSize
||
(
tempDEList
.
size
()<
batchSize
&&
i
==
entities
.
size
()-
1
)){
...
@@ -2627,11 +2699,11 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -2627,11 +2699,11 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
if
(
ids
.
size
()>
0
){
if
(
ids
.
size
()>
0
){
List
<${
de
.
codeName
}>
oldEntities
=
this
.
listByIds
(
ids
);
List
<${
de
.
codeName
}>
oldEntities
=
this
.
listByIds
(
ids
);
for
(${
de
.
codeName
}
entity
:
oldEntities
){
for
(${
de
.
codeName
}
entity
:
oldEntities
){
oldIds
.
add
(
entity
.
get
(
keyField
));
oldIds
.
add
(
entity
.
get
${
keyfieldPublicCodeName
}(
));
}
}
}
}
for
(${
de
.
codeName
}
entity
:
entities
){
for
(${
de
.
codeName
}
entity
:
entities
){
Object
id
=
entity
.
get
(
keyField
);
Object
id
=
entity
.
get
${
keyfieldPublicCodeName
}(
);
if
(
oldIds
.
contains
(
id
))
if
(
oldIds
.
contains
(
id
))
_update
.
add
(
entity
);
_update
.
add
(
entity
);
else
else
...
@@ -2656,4 +2728,17 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
...
@@ -2656,4 +2728,17 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
</#
if
>
</#
if
>
</#
macro
>
</#
macro
>
<#
comment
>
虚拟联合主键
update
条件,返回
update
(
et
,
wrapper
.
eq
(
"humanname"
,
et
.
getHumanname
()).
eq
(
"location"
,
et
.
getLocation
()))</#
comment
>
<#
function
getUnionKeyUpdateCond
unionKeyList
>
<#
assign
formatValue
=
""
>
<#
list
item
.
getUnionKeyValuePSDEFields
()
as
defield
>
<#
assign
unionKeyPrivateCodeName
=
srfcaseformat
(
defield
.
getCodeName
(),
'l_u2lC'
)
>
<#
assign
unionKeyPublicCodeName
=
unionKeyPrivateCodeName
?
cap_first
>
<#
assign
unionKeyCodeName
=
unionKeyPrivateCodeName
?
lower_case
>
<#
assign
formatValue
=
formatValue
+
".eq(
\"
"
+
unionKeyCodeName
+
"
\"
,et.get"
+
unionKeyPublicCodeName
+
"())"
>
</#
list
>
<#
assign
unionKeyResult
=
"update(et,wrapper"
+
formatValue
+
")"
>
<#
return
unionKeyResult
>
</#
function
>
</#
if
>
</#
if
>
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/DEFieldDefaultValueAspect.java.ftl
浏览文件 @
b33cb212
...
@@ -216,7 +216,7 @@ public class DEFieldDefaultValueAspect
...
@@ -216,7 +216,7 @@ public class DEFieldDefaultValueAspect
private
void
fillPreFieldValue
(
String
fieldname
,
DEPredefinedFieldType
preFieldType
,
EntityBase
et
,
String
actionName
,
String
logicValue
,
AuthenticationUser
curUser
)
throws
Exception
{
private
void
fillPreFieldValue
(
String
fieldname
,
DEPredefinedFieldType
preFieldType
,
EntityBase
et
,
String
actionName
,
String
logicValue
,
AuthenticationUser
curUser
)
throws
Exception
{
Object
fieldValue
=
et
.
get
(
fieldname
);
Object
fieldValue
=
et
.
get
(
fieldname
);
//
为预置属性进行赋值
//
为预置属性进行赋值
if
(
actionName
.
equalsIgnoreCase
(
"create"
)
||
if
(
actionName
.
toLowerCase
().
startsWith
(
"create"
)
||
preFieldType
==
DEPredefinedFieldType
.
UPDATEDATE
||
preFieldType
==
DEPredefinedFieldType
.
UPDATEMAN
||
preFieldType
==
DEPredefinedFieldType
.
UPDATEDATE
||
preFieldType
==
DEPredefinedFieldType
.
UPDATEMAN
||
preFieldType
==
DEPredefinedFieldType
.
UPDATEMANNAME
){
preFieldType
==
DEPredefinedFieldType
.
UPDATEMANNAME
){
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录