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

通过外键值文本填充外键值(移除无效代码)

上级 542be90b
......@@ -3188,43 +3188,4 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
</#if>
</#macro>
<#comment>通过外键值文本填充外键值</#comment>
<#macro fillForeignKeyByText>
<#if sys.codeName='Sample'>
//填充外键值
<#list item.getMinorPSDERs() as minder>
<#if minder?? && minder.getDERType()=='DER1N'>
<#if minder.getMajorPSDataEntity?? && minder.getMajorPSDataEntity()?? && minder.getCodeName??>
<#assign MajorEntity = minder.getMajorPSDataEntity()>
<#if MajorEntity.getCodeName?? && minder.getCodeName()?? && minder.getPSPickupTextDEField??>
<#assign foreignkeyId = srfcaseformat(MajorEntity.getKeyPSDEField().getCodeName(),'l_u2lC')?cap_first>
<#assign foreignkeyField = MajorEntity.getMajorPSDEField()>
<#assign foreignkeyName = srfcaseformat(foreignkeyField.getCodeName(),'l_u2lC')?cap_first>
<#assign importTag="">
<#if foreignkeyField.getImportTag()??>
<#assign importTag=foreignkeyField.getImportTag()>
<#elseif foreignkeyField.getLogicName()??>
<#assign importTag=foreignkeyField.getLogicName()>
<#else>
<#assign importTag=foreignkeyField.getCodeName()>
</#if>
if(ObjectUtils.isEmpty(entity.get${foreignkeyId}()) && !ObjectUtils.isEmpty(entity.get${foreignkeyName}())){
QueryWrapper<${MajorEntity.getCodeName()}> ${minder.codeName?lower_case}Wrapper = new QueryWrapper<>();
${minder.codeName?lower_case}Wrapper.eq("${foreignkeyField.name?lower_case}",entity.get${foreignkeyName}());
${MajorEntity.getCodeName()} ${minder.codeName?lower_case}Entity = ${srfcaseformat(minder.getCodeName(),'l_u2lC')}Service.getOne(${minder.codeName?lower_case}Wrapper,false);
if(${minder.codeName?lower_case}Entity == null){
Integer lineNum = i + 1;
errorLines.add(lineNum);
errorMsgs.add("第" + lineNum + "行:未能找到[${importTag}:entity.get${foreignkeyName}()]对应的外键值。");
continue;
}else{
entity.set${foreignkeyId}(${minder.codeName?lower_case}Entity.get${foreignkeyId}());
}
}
</#if>
</#if>
</#if>
</#list>
</#if>
</#macro>
</#if>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册