|
|
@ -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); |
|
|
|