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

代码规范检查:test行为

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