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

代码规范检查:test行为

上级 b55cee3e
...@@ -282,11 +282,14 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa ...@@ -282,11 +282,14 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
createIndexMajorEntityData(et); createIndexMajorEntityData(et);
</#if> </#if>
<#if isLogicInheritDE> <#if isLogicInheritDE>
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("${keyfield.name?lower_case}",et.get${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}()))) if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("${keyfield.name?lower_case}",et.get${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}()))) {
return false;
}
<#else> <#else>
if(!this.retBool(this.baseMapper.insert(et))) if(!this.retBool(this.baseMapper.insert(et))) {
</#if>
return false; return false;
}
</#if>
<#comment>1N关系中,在父实体中创建子实体的List集合</#comment> <#comment>1N关系中,在父实体中创建子实体的List集合</#comment>
<#if de.getMajorPSDERs?? && de.getMajorPSDERs()??> <#if de.getMajorPSDERs?? && de.getMajorPSDERs()??>
<#list de.getMajorPSDERs() as MajorPSDER> <#list de.getMajorPSDERs() as MajorPSDER>
...@@ -359,11 +362,13 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa ...@@ -359,11 +362,13 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
<#if de.getKeyPSDEField()??> <#if de.getKeyPSDEField()??>
<#if de.getKeyPSDEField().isPhisicalDEField()==false && de.getUnionKeyValuePSDEFields()??> <#if de.getKeyPSDEField().isPhisicalDEField()==false && de.getUnionKeyValuePSDEFields()??>
<#comment>虚拟联合主键</#comment> <#comment>虚拟联合主键</#comment>
if(!updateById(et)) if(!updateById(et)) {
return false; return false;
}
<#else> <#else>
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("${keyfield.name?lower_case}",et.get${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}()))) if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("${keyfield.name?lower_case}",et.get${srfcaseformat(keyfield.codeName,'l_u2lC')?cap_first}()))) {
return false; return false;
}
</#if> </#if>
<#comment>1N关系中,在父实体中创建子实体的List集合</#comment> <#comment>1N关系中,在父实体中创建子实体的List集合</#comment>
<#if de.getMajorPSDERs?? && de.getMajorPSDERs()??> <#if de.getMajorPSDERs?? && de.getMajorPSDERs()??>
...@@ -895,10 +900,12 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa ...@@ -895,10 +900,12 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
ids.add(id); ids.add(id);
} }
} }
if(ids.size()>0) if(ids.size()>0) {
return this.listByIds(ids); return this.listByIds(ids);
else }
return entities; else {
return entities;
}
} }
</#if> </#if>
...@@ -2765,6 +2772,7 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser ...@@ -2765,6 +2772,7 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
} }
} }
@Override
@Transactional @Transactional
public void asyncImportData(List<${de.codeName}> entities, int batchSize ,boolean isIgnoreError){ public void asyncImportData(List<${de.codeName}> entities, int batchSize ,boolean isIgnoreError){
executeImportData(entities,batchSize,isIgnoreError); executeImportData(entities,batchSize,isIgnoreError);
...@@ -2778,8 +2786,9 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser ...@@ -2778,8 +2786,9 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
@Transactional @Transactional
public JSONObject executeImportData(List<${de.codeName}> entities, int batchSize ,boolean isIgnoreError) { public JSONObject executeImportData(List<${de.codeName}> entities, int batchSize ,boolean isIgnoreError) {
JSONObject rs=testImportData(entities,isIgnoreError); JSONObject rs=testImportData(entities,isIgnoreError);
if(rs.getInteger("rst")==1 && !isIgnoreError) if(rs.getInteger("rst")==1 && !isIgnoreError) {
return rs; return rs;
}
List<${de.codeName}> tempDEList=new ArrayList<>(); List<${de.codeName}> tempDEList=new ArrayList<>();
Set tempIds=new HashSet<>(); Set tempIds=new HashSet<>();
...@@ -2787,8 +2796,9 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser ...@@ -2787,8 +2796,9 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
${de.codeName} entity = entities.get(i); ${de.codeName} entity = entities.get(i);
tempDEList.add(entity); tempDEList.add(entity);
Object id=entity.get${keyfieldPublicCodeName}(); Object id=entity.get${keyfieldPublicCodeName}();
if(!ObjectUtils.isEmpty(id)) if(!ObjectUtils.isEmpty(id)) {
tempIds.add(id); tempIds.add(id);
}
if(tempDEList.size()>=batchSize || (tempDEList.size()<batchSize && i==entities.size()-1)){ if(tempDEList.size()>=batchSize || (tempDEList.size()<batchSize && i==entities.size()-1)){
commit(tempDEList,tempIds); commit(tempDEList,tempIds);
tempDEList.clear(); tempDEList.clear();
...@@ -2818,15 +2828,19 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser ...@@ -2818,15 +2828,19 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
} }
for(${de.codeName} entity:entities){ for(${de.codeName} entity:entities){
Object id=entity.get${keyfieldPublicCodeName}(); Object id=entity.get${keyfieldPublicCodeName}();
if(oldIds.contains(id)) if(oldIds.contains(id)) {
_update.add(entity); _update.add(entity);
else }
else {
_create.add(entity); _create.add(entity);
}
} }
if(_update.size()>0) if(_update.size()>0) {
proxyService.updateBatch(_update); proxyService.updateBatch(_update);
if(_create.size()>0) }
if(_create.size()>0) {
proxyService.createBatch(_create); proxyService.createBatch(_create);
}
} }
</#if> </#if>
</#macro> </#macro>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册