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)
@Override
public boolean updateCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO) {
boolean deleteFlag = carCheckItemService.removeRelativeCarCheckItem(carCheckRecordDTO.getId());
if (!deleteFlag){
return false;
}
// 更新检查项
List<CarCheckItemEntity> itemList = carCheckRecordDTO.getItemList();
boolean updateItem = carCheckItemService.updateBatchById(itemList);
// 若更新检查项成功,则更新车检记录
if (updateItem) {
itemList.forEach(x -> {x.setCarCheckRecordId(carCheckRecordDTO.getId());
x.setId(null);});
boolean b = carCheckItemService.saveBatch(itemList);
if (b) {
// 若更新检查项成功,则更新车检记录
CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity();
BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity);
return this.updateById(carCheckRecordEntity);

Loading…
Cancel
Save