|
|
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.farm.service.cropRecord;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|
|
|
|
import cn.iocoder.yudao.module.farm.dal.dataobject.crop.CropDO; |
|
|
|
|
import cn.iocoder.yudao.module.farm.dal.mysql.crop.CropMapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
|
import org.apache.poi.ss.formula.functions.T; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import javax.annotation.Resource; |
|
|
|
@ -79,15 +80,18 @@ public class CropRecordServiceImpl implements CropRecordService {
|
|
|
|
|
@Override |
|
|
|
|
public void deleteCropRecord(Long id) { |
|
|
|
|
// 校验存在
|
|
|
|
|
this.validateCropRecordExists(id); |
|
|
|
|
CropRecordDO cropRecordDO = this.validateCropRecordExists(id); |
|
|
|
|
// 删除
|
|
|
|
|
cropRecordMapper.deleteById(id); |
|
|
|
|
cropRecordDO.setPretendDelete(true); |
|
|
|
|
cropRecordMapper.updateById(cropRecordDO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void validateCropRecordExists(Long id) { |
|
|
|
|
if (cropRecordMapper.selectById(id) == null) { |
|
|
|
|
private CropRecordDO validateCropRecordExists(Long id) { |
|
|
|
|
CropRecordDO cropRecordDO = cropRecordMapper.selectById(id); |
|
|
|
|
if (cropRecordDO == null) { |
|
|
|
|
throw exception(CROP_RECORD_NOT_EXISTS); |
|
|
|
|
} |
|
|
|
|
return cropRecordDO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|