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

索引实体

上级 1c7a9a96
......@@ -11,7 +11,7 @@ TARGET=PSDATAENTITY
<#break>
</#if>
</#list>
<#if isIndexSubDE=true && indexPSDER??>
<#if isIndexSubDE && indexPSDER??>
<#comment>索引主实体</#comment>
<#assign majorIndexDE=indexPSDER.getMajorPSDataEntity()>
......
......@@ -23,6 +23,21 @@ TARGET=PSDATAENTITY
<#break>
</#list>
</#if>
<#comment>判断当前实体是否为索引子实体</#comment>
<#assign isIndexSubDE=false>
<#if de.getMinorPSDERs()??>
<#list de.getMinorPSDERs() as MinorPSDER>
<#if MinorPSDER.getDERType()?? && MinorPSDER.getDERType()=="DERINDEX">
<#assign isIndexSubDE=true>
<#assign indexPSDER=MinorPSDER>
<#assign majorIndexDE=indexPSDER.getMajorPSDataEntity()>
<#assign majorIndexDECodeName=indexPSDER.getMajorPSDataEntity().codeName>
<#assign majorIndexDECodeNameCamel = srfcaseformat(majorIndexDECodeName,'l_u2lC')?cap_first>
<#assign majorGroupFieldCodeNameCamel = srfcaseformat(majorIndexDE.getIndexTypePSDEField().codeName,'l_u2lC')?cap_first>
<#break>
</#if>
</#list>
</#if>
package ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.service.impl;
import java.io.Serializable;
......@@ -212,6 +227,10 @@ ${deaction.getRender().code}
<#if hasMinorPSDERs gt 0>
fillParentData(et);
</#if>
<#comment>同步创建索引主实体</#comment>
<#if isIndexSubDE>
createIndexMajorEntityData(et);
</#if>
<#comment>附加数据逻辑-操作前</#comment>
<@addBoforeLogic deaction/>
if(!this.retBool(this.baseMapper.insert(et)))
......@@ -267,6 +286,10 @@ ${deaction.getRender().code}
<#if hasMinorPSDERs gt 0>
fillParentData(et);
</#if>
<#comment>同步更新索引主实体</#comment>
<#if isIndexSubDE>
${srfcaseformat(majorIndexDECodeName,'l_u2lC')}Service.update(${de.codeName?lower_case}InheritMapping.to${majorIndexDECodeNameCamel}(et));
</#if>
<#comment>附加数据逻辑-操作前</#comment>
<@addBoforeLogic deaction/>
<#if de.getKeyPSDEField()??>
......@@ -373,6 +396,10 @@ ${deaction.getRender().code}
</#list>
</#if>
boolean result=removeById(key);
<#comment>同步清除索引主实体</#comment>
<#if isIndexSubDE>
${srfcaseformat(majorIndexDECodeName,'l_u2lC')}Service.remove(key);
</#if>
<#comment>附加数据逻辑-操作后</#comment>
<@addAfterLogic deaction/>
return result ;
......@@ -583,6 +610,25 @@ ${deaction.getRender().code}
}
</#if>
<#comment>同步数据到索引主实体</#comment>
<#if isIndexSubDE && indexPSDER??>
@Autowired
${de.codeName}InheritMapping ${de.codeName?lower_case}InheritMapping;
<#if !P.exists('DER1N',majorIndexDECodeName)>
@Autowired
@Lazy
private ${pub.getPKGCodeName()}.core.${majorIndexDE.getPSSystemModule().getCodeName()?lower_case}.service.I${majorIndexDECodeName}Service ${srfcaseformat(majorIndexDECodeName,'l_u2lC')}Service;
</#if>
private void createIndexMajorEntityData(${de.codeName} et){
if(ObjectUtils.isEmpty(et.get${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}()))
et.set${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}((${srfjavatype(keyfield.stdDataType)})et.getDefaultKey(true));
${majorIndexDECodeName} parent =${de.codeName?lower_case}InheritMapping.to${majorIndexDECodeNameCamel}(et);
parent.set("${majorIndexDECodeName?lower_case}","${indexPSDER.getTypeValue()}");
${srfcaseformat(majorIndexDECodeName,'l_u2lC')}Service.create(parent);
}
</#if>
<#comment>输出自定义sql查询</#comment>
@Override
public List<JSONObject> select(String sql, Map param){
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册