提交 ca3a5d8a 编写于 作者: zhouweidong's avatar zhouweidong

主实体删除操作(同时删除、置空、限制删除)

上级 9c08445e
......@@ -485,6 +485,8 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
<#assign minorKeyField = der.getMinorPSDataEntity().getKeyPSDEField()>
${srfcaseformat(der.getMinorPSDataEntity().getCodeName(),'l_u2lC')}Service.removeBy${srfcaseformat(MajorDerField.codeName,'l_u2lC')?cap_first}(key) ;
</#if>
<#comment>主实体删除操作(同时删除、置空、限制删除)</#comment>
<@majorEntityRemove der/>
</#list>
</#if>
<#comment>同步清除索引主实体数据</#comment>
......@@ -2849,4 +2851,20 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
</#if>
</#macro>
<#comment>主实体删除操作</#comment>
<#macro majorEntityRemove der>
<#if der.getDERType() =='DER1N' && der.getRemoveActionType()?? && der.getMinorPSDataEntity()?? && (der.getMinorPSDataEntity().getStorageMode()==1||der.getMinorPSDataEntity().getStorageMode()==2||der.getMinorPSDataEntity().getStorageMode()==4) >
<#assign MajorDerField = der.getPSPickupDEField()>
<#assign minorKeyField = der.getMinorPSDataEntity().getKeyPSDEField()>
<#assign minorEntityCodeName=der.getMinorPSDataEntity().getCodeName()>
<#if der.getRemoveActionType()?c=='1'><#comment>同时删除</#comment>
${srfcaseformat(minorEntityCodeName,'l_u2lC')}Service.removeBy${srfcaseformat(MajorDerField.codeName,'l_u2lC')?cap_first}(key) ;
<#elseif der.getRemoveActionType()?c=='2'><#comment>置空</#comment>
<#elseif der.getRemoveActionType()?c=='3'><#comment>限制删除</#comment>
if(!ObjectUtils.isEmpty(${srfcaseformat(minorEntityCodeName,'l_u2lC')}Service.selectBy${srfcaseformat(MajorField.codeName,'l_u2lC')?cap_first}(key)))
throw new BadRequestAlertException("删除数据失败,当前数据存在关系实体[${minorEntityCodeName}]数据,无法删除!","","");
</#if>
</#if>
</#macro>
</#if>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册