提交 579d1e5a 编写于 作者: sq3536's avatar sq3536

联合主键

上级 e100cf9b
...@@ -246,7 +246,12 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa ...@@ -246,7 +246,12 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
<#if hasMinorPSDERs gt 0> <#if hasMinorPSDERs gt 0>
list.forEach(item->fillParentData(item)); list.forEach(item->fillParentData(item));
</#if> </#if>
saveBatch(list,batchSize); <#comment>联合主键,走SaveOrUpdateBatch,防止因主键冲突导致后续数据无法保存</#comment>
<#if item.getUnionKeyValuePSDEFields()??>
this.saveOrUpdateBatch(list,batchSize);
<#else>
this.saveBatch(list,batchSize);
</#if>
} }
<#elseif deaction.getCodeName()?lower_case == "update"> <#elseif deaction.getCodeName()?lower_case == "update">
...@@ -456,12 +461,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa ...@@ -456,12 +461,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
if(_update.size()>0) if(_update.size()>0)
this.updateBatch(_update); this.updateBatch(_update);
if(_create.size()>0) if(_create.size()>0)
<#comment>联合主键,走saveBatch,防止因主键冲突导致后续数据无法保存</#comment>
<#if item.getUnionKeyValuePSDEFields()??>
this.saveBatch(_create);
<#else>
this.createBatch(_create); this.createBatch(_create);
</#if>
if(delIds.size()>0) if(delIds.size()>0)
this.removeBatch(delIds); this.removeBatch(delIds);
} }
...@@ -764,7 +764,12 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser ...@@ -764,7 +764,12 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
@Override @Override
public void createBatch(List<${item.getCodeName()}> list) { public void createBatch(List<${item.getCodeName()}> list) {
<#comment>联合主键,走SaveOrUpdateBatch,防止因主键冲突导致后续数据无法保存</#comment>
<#if item.getUnionKeyValuePSDEFields()??>
repository.saveAll(list);
<#else>
repository.insert(list); repository.insert(list);
</#if>
} }
<#elseif deaction.getCodeName()?lower_case == "update"> <#elseif deaction.getCodeName()?lower_case == "update">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册