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

外键值附加数据值填充

上级 e00a7710
......@@ -433,6 +433,38 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
}
</#if>
<#comment>为当前实体填充父数据(外键值文本、外键值附加数据)</#comment>
<#if item.getMinorPSDERs?? && item.getMinorPSDERs()??>
/**
* 为当前实体填充父数据(外键值文本、外键值附加数据)
* @param et
*/
private void fillParentData(${item.getCodeName()} et){
<#list item.getMinorPSDERs() as MinorPSDER>
<#if MinorPSDER?? && MinorPSDER.getDERType()=='DER1N'>
<#if MinorPSDER.getMajorPSDataEntity?? && MinorPSDER.getMajorPSDataEntity()?? && MinorPSDER.getCodeName?? && MinorPSDER.getCodeName()??>
<#assign MajorEntity = MinorPSDER.getMajorPSDataEntity()>
<#assign MajorEntityName=srfcaseformat(MinorPSDER.getCodeName(),'l_u2lC')>
<#assign MajorKeyFieldCodeName =srfcaseformat(MinorPSDER.getPSPickupDEField(),'l_u2lC')?cap_first>
//实体关系[${MinorPSDER.getLogicName()}]
if(!ObjectUtils.isEmpty(et.get${MajorKeyFieldCodeName}())){
${MajorEntity.getCodeName()} ${MajorEntityName}=et.get${MajorEntityName?cap_first}();
if(!ObjectUtils.isEmpty(${MajorEntityName})){
<#comment>找出当前关系的外键值文本及附加数据字段</#comment>
<#list de.getAllPSDEFields() as defield>
<#if defield.getPSDER1N()?? && defield.getPSDER1N().name==MinorPSDER.name && (((defield.getDataType())!'')!='PICKUP')>
<#assign minorFieldCodeName = srfcaseformat(defield.getCodeName(),'l_u2lC') >
<#assign majorFieldCodeName = srfcaseformat(defield.getRelatedPSDEField().getCodeName(),'l_u2lC') >
et.set${minorFieldCodeName}(${MajorEntityName}.get${majorFieldCodeName}());
</#if>
</#list>
}
</#if>
</#if>
</#list>
}
</#if>
<#comment>输出自定义sql查询</#comment>
@Override
public List<JSONObject> select(String sql){
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册