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

实体数据导入

上级 141e2f41
......@@ -2486,7 +2486,6 @@ ${deaction.getRender().code}
}
}
<#if de.getMajorPSDER1Ns?? && de.getMajorPSDER1Ns()??>
//外键约束检查
<#list de.getMinorPSDERs() as MinorPSDER>
<#if MinorPSDER?? && MinorPSDER.getDERType()=='DER1N' && (MinorPSDER.getMajorPSDataEntity().getStorageMode()==1||MinorPSDER.getMajorPSDataEntity().getStorageMode()==2||MinorPSDER.getMajorPSDataEntity().getStorageMode()==4)>
<#if MinorPSDER.getMajorPSDataEntity?? && MinorPSDER.getMajorPSDataEntity()?? && MinorPSDER.getCodeName?? && MinorPSDER.getCodeName()??>
......@@ -2496,19 +2495,19 @@ ${deaction.getRender().code}
<#assign MajorEntityService=srfcaseformat(MinorPSDER.getMajorPSDataEntity().getCodeName(),'l_u2lC')+"Service">
//实体关系[${MinorPSDER.name}]
if(!ObjectUtils.isEmpty(entity.get${MajorKeyFieldCodeName}())){
${pub.getPKGCodeName()}.core.${MajorEntity.getPSSystemModule().getCodeName()?lower_case}.domain.${MajorEntityCodeName} fkEntity=${MajorEntityService}.getById(entity.get${MajorKeyFieldCodeName}());
if(ObjectUtils.isEmpty(fkEntity)){
Integer lineNum = i + 1;
errorLines.add(lineNum);
errorMsgs.add(String.format("第" + lineNum + "行:[%s]父数据有误。",entity.get${MajorKeyFieldCodeName}()));
if(isIgnoreError){
entity.set${MajorKeyFieldCodeName}(null);
continue;
}
else{
break;
}
${pub.getPKGCodeName()}.core.${MajorEntity.getPSSystemModule().getCodeName()?lower_case}.domain.${MajorEntityCodeName} fkEntity=${MajorEntityService}.getById(entity.get${MajorKeyFieldCodeName}());
if(ObjectUtils.isEmpty(fkEntity)){
Integer lineNum = i + 1;
errorLines.add(lineNum);
errorMsgs.add(String.format("第" + lineNum + "行:[%s]父数据有误。",entity.get${MajorKeyFieldCodeName}()));
if(isIgnoreError){
entity.set${MajorKeyFieldCodeName}(null);
continue;
}
else{
break;
}
}
}
</#if>
</#if>
......@@ -2546,15 +2545,15 @@ ${deaction.getRender().code}
return rs;
String keyField= DEFieldCacheMap.getDEKeyField(${de.codeName}.class);
List<${de.codeName}> tempDEList=new ArrayList<>();
Set tempIds=new HashSet<>();//主键
Set tempIds=new HashSet<>();
for(int i=0;i<entities.size();i++) {
${de.codeName} entity = entities.get(i);
${de.codeName} entity = entities.get(i);
tempDEList.add(entity);
tempIds.add(entity.get(keyField));
//分批次提交
Object id=entity.get(keyField);
if(!ObjectUtils.isEmpty(id))
tempIds.add(id);
if(tempDEList.size()>=batchSize || (tempDEList.size()<batchSize && i==entities.size()-1)){
commit(tempDEList,tempIds);
tempDEList.clear();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册