Browse Source

修复:检查项更新失败bug

zhongwei
ty 9 months ago
parent
commit
81208354b4
  1. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java

@ -162,11 +162,17 @@ public class CarCheckRecordServiceImpl extends ServiceImpl<CarCheckRecordMapper,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean updateCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO) { public boolean updateCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO) {
boolean deleteFlag = carCheckItemService.removeRelativeCarCheckItem(carCheckRecordDTO.getId());
if (!deleteFlag){
return false;
}
// 更新检查项 // 更新检查项
List<CarCheckItemEntity> itemList = carCheckRecordDTO.getItemList(); List<CarCheckItemEntity> itemList = carCheckRecordDTO.getItemList();
boolean updateItem = carCheckItemService.updateBatchById(itemList); itemList.forEach(x -> {x.setCarCheckRecordId(carCheckRecordDTO.getId());
// 若更新检查项成功,则更新车检记录 x.setId(null);});
if (updateItem) { boolean b = carCheckItemService.saveBatch(itemList);
if (b) {
// 若更新检查项成功,则更新车检记录
CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity(); CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity();
BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity); BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity);
return this.updateById(carCheckRecordEntity); return this.updateById(carCheckRecordEntity);

Loading…
Cancel
Save