|
|
@ -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);}); |
|
|
|
|
|
|
|
boolean b = carCheckItemService.saveBatch(itemList); |
|
|
|
|
|
|
|
if (b) { |
|
|
|
// 若更新检查项成功,则更新车检记录
|
|
|
|
// 若更新检查项成功,则更新车检记录
|
|
|
|
if (updateItem) { |
|
|
|
|
|
|
|
CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity(); |
|
|
|
CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity(); |
|
|
|
BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity); |
|
|
|
BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity); |
|
|
|
return this.updateById(carCheckRecordEntity); |
|
|
|
return this.updateById(carCheckRecordEntity); |
|
|
|