Browse Source

验车检查批量新增

master
dimengzhe 3 years ago
parent
commit
6f493a6052
  1. 20
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehinspectitem/ScmVehinspectItemService.java

20
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehinspectitem/ScmVehinspectItemService.java

@ -302,8 +302,11 @@ public class ScmVehinspectItemService extends MybatisBaseService<ScmVehinspectIt
public ResultBean saveItem(List<ScmVehinspectItemDto> dtos) {
ResultBean rb = ResultBean.fireFail();
List<ScmVehinspectItemsVo> voList = scmVehicleInspectitemService.selectListOne();
for(ScmVehinspectItemDto s :dtos){
String vehInspectSid=s.getVehInspectSid();
List<ScmVehinspectItem> scmVehinspectItemList = new ArrayList<>();
List<ScmVehinspectItemdetail> scmVehinspectItemdetailList = new ArrayList<>();
List<ScmVehinspectItemimg> scmVehinspectItemimgList = new ArrayList<>();
for (ScmVehinspectItemDto s : dtos) {
String vehInspectSid = s.getVehInspectSid();
//查询配置项目表中
voList.removeAll(Collections.singleton(null));
if (!voList.isEmpty()) {
@ -312,7 +315,8 @@ public class ScmVehinspectItemService extends MybatisBaseService<ScmVehinspectIt
String sid = scmVehinspectItem.getSid();
BeanUtil.copyProperties(item, scmVehinspectItem);
scmVehinspectItem.setVehInspectSid(vehInspectSid);
baseMapper.insert(scmVehinspectItem);
// baseMapper.insert(scmVehinspectItem);
scmVehinspectItemList.add(scmVehinspectItem);
List<ScmItemDetailVo> detailsList = item.getDetails();
detailsList.removeAll(Collections.singleton(null));
if (!detailsList.isEmpty()) {
@ -320,7 +324,8 @@ public class ScmVehinspectItemService extends MybatisBaseService<ScmVehinspectIt
ScmVehinspectItemdetail scmVehinspectItemdetail = new ScmVehinspectItemdetail();
BeanUtil.copyProperties(details, scmVehinspectItemdetail);
scmVehinspectItemdetail.setMainSid(sid);
scmVehinspectItemdetailService.insert(scmVehinspectItemdetail);
// scmVehinspectItemdetailService.insert(scmVehinspectItemdetail);
scmVehinspectItemdetailList.add(scmVehinspectItemdetail);
});
}
List<ScmItemImgVo> itemImgsList = item.getItemImgs();
@ -330,13 +335,16 @@ public class ScmVehinspectItemService extends MybatisBaseService<ScmVehinspectIt
ScmVehinspectItemimg scmVehinspectItemimg = new ScmVehinspectItemimg();
BeanUtil.copyProperties(img, scmVehinspectItemimg);
scmVehinspectItemimg.setMainSid(sid);
scmVehinspectItemimgService.insert(scmVehinspectItemimg);
// scmVehinspectItemimgService.insert(scmVehinspectItemimg);
scmVehinspectItemimgList.add(scmVehinspectItemimg);
});
}
});
}
}
saveBatch(scmVehinspectItemList);
scmVehinspectItemdetailService.saveBatch(scmVehinspectItemdetailList);
scmVehinspectItemimgService.saveBatch(scmVehinspectItemimgList);
return rb.success();
}
}
Loading…
Cancel
Save