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

调整 get entity=null 处理

上级 3c3ff595
...@@ -251,9 +251,8 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa ...@@ -251,9 +251,8 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
<@buildEntityParam deaction/> <@buildEntityParam deaction/>
<@addGetActionBoforeLogic deaction/> <@addGetActionBoforeLogic deaction/>
${item.getCodeName()} et = getById(key); ${item.getCodeName()} et = getById(key);
if(et == null){ if (et == null) {
et = new ${item.getCodeName()}(); throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), key);
et.set${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}(key);
} }
else { else {
<#comment>1N关系中,在父实体中创建子实体的List集合</#comment> <#comment>1N关系中,在父实体中创建子实体的List集合</#comment>
...@@ -1181,8 +1180,7 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser ...@@ -1181,8 +1180,7 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
<@addGetActionBoforeLogic deaction/> <@addGetActionBoforeLogic deaction/>
Optional<${item.getCodeName()}> result = repository.findById(key); Optional<${item.getCodeName()}> result = repository.findById(key);
if(!result.isPresent()) { if(!result.isPresent()) {
${item.getCodeName()} et = new ${item.getCodeName()}(); throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), key);
et.set${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}(key);
<@addAfterLogic deaction/> <@addAfterLogic deaction/>
return et; return et;
} }
...@@ -1690,8 +1688,7 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser ...@@ -1690,8 +1688,7 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
<#--<@addGetActionBoforeLogic deaction/>--> <#--<@addGetActionBoforeLogic deaction/>-->
${item.getCodeName()} et=${subSysServiceApiDECodeName?uncap_first}FeignClient.${deaction.getPSSubSysServiceAPIDEMethod().getCodeName()?uncap_first}(${keyfield.getCodeName()?lower_case}); ${item.getCodeName()} et=${subSysServiceApiDECodeName?uncap_first}FeignClient.${deaction.getPSSubSysServiceAPIDEMethod().getCodeName()?uncap_first}(${keyfield.getCodeName()?lower_case});
if(et==null){ if(et==null){
et=new ${item.getCodeName()}(); throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), key);
et.set${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}(${keyfield.getCodeName()?lower_case});
} }
else{ else{
<#comment>1N关系中,在父实体中创建子实体的List集合</#comment> <#comment>1N关系中,在父实体中创建子实体的List集合</#comment>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册