Browse Source

农场 area、crop、crop_record、discuss、event 假删除

zyh
小久哥 3 years ago
parent
commit
0ea7bf55b3
  1. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaBaseVO.java
  2. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaExcelVO.java
  3. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaExportReqVO.java
  4. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaPageReqVO.java
  5. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaRespVO.java
  6. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropBaseVO.java
  7. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropExcelVO.java
  8. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropExportReqVO.java
  9. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropPageReqVO.java
  10. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordBaseVO.java
  11. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordExcelVO.java
  12. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordExportReqVO.java
  13. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordPageReqVO.java
  14. 1
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussBaseVO.java
  15. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExcelVO.java
  16. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExportReqVO.java
  17. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussPageReqVO.java
  18. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventBaseVO.java
  19. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventExcelVO.java
  20. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventExportReqVO.java
  21. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventPageReqVO.java
  22. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventSearchPageReqVO.java
  23. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/area/AreaDO.java
  24. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/crop/CropDO.java
  25. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/cropRecord/CropRecordDO.java
  26. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/discuss/DiscussDO.java
  27. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/event/EventDO.java
  28. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/area/AreaMapper.java
  29. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/crop/CropMapper.java
  30. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/cropRecord/CropRecordMapper.java
  31. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/discuss/DiscussMapper.java
  32. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/event/EventMapper.java
  33. 14
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java
  34. 11
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/crop/CropServiceImpl.java
  35. 12
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/cropRecord/CropRecordServiceImpl.java
  36. 11
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java
  37. 11
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/event/EventServiceImpl.java

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaBaseVO.java

@ -19,5 +19,7 @@ public class AreaBaseVO {
private Long parentId;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaExcelVO.java

@ -25,4 +25,6 @@ public class AreaExcelVO {
@ExcelProperty("")
private Date createTime;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaExportReqVO.java

@ -25,4 +25,6 @@ public class AreaExportReqVO {
@ApiModelProperty(value = "结束")
private Date endCreateTime;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaPageReqVO.java

@ -27,4 +27,6 @@ public class AreaPageReqVO extends PageParam {
@ApiModelProperty(value = "结束")
private Date endCreateTime;
private Boolean pretendDelete = false;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaRespVO.java

@ -18,4 +18,6 @@ public class AreaRespVO extends AreaBaseVO {
@ApiModelProperty(value = "")
private Date createTime;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropBaseVO.java

@ -24,4 +24,6 @@ public class CropBaseVO {
@NotNull(message = "当前库存不能为空")
private Integer stock;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropExcelVO.java

@ -30,4 +30,6 @@ public class CropExcelVO {
@ExcelProperty("")
private Date createTime;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropExportReqVO.java

@ -30,4 +30,6 @@ public class CropExportReqVO {
@ApiModelProperty(value = "结束")
private Date endCreateTime;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropPageReqVO.java

@ -32,4 +32,6 @@ public class CropPageReqVO extends PageParam {
@ApiModelProperty(value = "结束")
private Date endCreateTime;
private Boolean pretendDelete = false;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordBaseVO.java

@ -27,4 +27,6 @@ public class CropRecordBaseVO {
@NotNull(message = "剩余数量不能为空")
private Integer afterStock;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordExcelVO.java

@ -32,4 +32,6 @@ public class CropRecordExcelVO {
@ExcelProperty("")
private Date createTime;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordExportReqVO.java

@ -32,4 +32,6 @@ public class CropRecordExportReqVO {
@ApiModelProperty(value = "结束")
private Date endCreateTime;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordPageReqVO.java

@ -34,4 +34,6 @@ public class CropRecordPageReqVO extends PageParam {
@ApiModelProperty(value = "结束")
private Date endCreateTime;
private Boolean pretendDelete = false;
}

1
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussBaseVO.java

@ -36,4 +36,5 @@ public class DiscussBaseVO {
private List<WorkHourBaseVO> workHourList;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExcelVO.java

@ -43,4 +43,6 @@ public class DiscussExcelVO {
@ExcelProperty("")
private List<WorkHourBaseVO> workHourList;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExportReqVO.java

@ -37,4 +37,6 @@ public class DiscussExportReqVO {
@ApiModelProperty(value = "结束")
private Date endCreateTime;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussPageReqVO.java

@ -39,4 +39,6 @@ public class DiscussPageReqVO extends PageParam {
@ApiModelProperty(value = "结束")
private Date endCreateTime;
private Boolean pretendDelete = false;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventBaseVO.java

@ -30,4 +30,6 @@ public class EventBaseVO {
@ApiModelProperty(value = "")
private JSONArray images;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventExcelVO.java

@ -36,4 +36,6 @@ public class EventExcelVO {
@ExcelProperty("")
private Date createTime;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventExportReqVO.java

@ -36,4 +36,6 @@ public class EventExportReqVO {
@ApiModelProperty(value = "结束")
private Date endCreateTime;
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventPageReqVO.java

@ -38,4 +38,6 @@ public class EventPageReqVO extends PageParam {
@ApiModelProperty(value = "结束")
private Date endCreateTime;
private Boolean pretendDelete = false;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventSearchPageReqVO.java

@ -43,4 +43,6 @@ public class EventSearchPageReqVO extends PageParam {
@ApiModelProperty(value = "结束")
private LocalDateTime endCreateTime;
private Boolean pretendDelete;
}

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/area/AreaDO.java

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.farm.dal.dataobject.area;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
@ -31,4 +32,7 @@ public class AreaDO extends BaseDO {
private Long parentId;
@ApiModelProperty("假装删除")
private Boolean pretendDelete;
}

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/crop/CropDO.java

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.farm.dal.dataobject.crop;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
@ -40,4 +41,7 @@ public class CropDO extends BaseDO {
*/
private Integer stock;
@ApiModelProperty("假装删除")
private Boolean pretendDelete;
}

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/cropRecord/CropRecordDO.java

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.farm.dal.dataobject.cropRecord;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
@ -41,4 +42,7 @@ public class CropRecordDO extends BaseDO {
*/
private Integer afterStock;
@ApiModelProperty("假装删除")
private Boolean pretendDelete;
}

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/discuss/DiscussDO.java

@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.workHour.vo.WorkHourBaseVO;
import cn.iocoder.yudao.module.farm.dal.dataobject.workHour.WorkHourDO;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
@ -55,4 +56,7 @@ public class DiscussDO extends BaseDO {
private Integer cropNum;
@ApiModelProperty("假装删除")
private Boolean pretendDelete;
}

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/event/EventDO.java

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.farm.dal.dataobject.event;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
@ -48,4 +49,7 @@ public class EventDO extends BaseDO {
@TableField(typeHandler = JacksonTypeHandler.class)
private JSONArray images;
@ApiModelProperty("假装删除")
private Boolean pretendDelete;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/area/AreaMapper.java

@ -22,6 +22,7 @@ public interface AreaMapper extends BaseMapperX<AreaDO> {
.likeIfPresent(AreaDO::getName, reqVO.getName())
.eqIfPresent(AreaDO::getParentId, reqVO.getParentId())
.betweenIfPresent(AreaDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.eqIfPresent(AreaDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(AreaDO::getId));
}
@ -30,6 +31,7 @@ public interface AreaMapper extends BaseMapperX<AreaDO> {
.likeIfPresent(AreaDO::getName, reqVO.getName())
.eqIfPresent(AreaDO::getParentId, reqVO.getParentId())
.betweenIfPresent(AreaDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.eqIfPresent(AreaDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(AreaDO::getId));
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/crop/CropMapper.java

@ -23,6 +23,7 @@ public interface CropMapper extends BaseMapperX<CropDO> {
.eqIfPresent(CropDO::getImages, reqVO.getImages())
.eqIfPresent(CropDO::getStock, reqVO.getStock())
.betweenIfPresent(CropDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.eqIfPresent(CropDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(CropDO::getId));
}
@ -32,6 +33,7 @@ public interface CropMapper extends BaseMapperX<CropDO> {
.eqIfPresent(CropDO::getImages, reqVO.getImages())
.eqIfPresent(CropDO::getStock, reqVO.getStock())
.betweenIfPresent(CropDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.eqIfPresent(CropDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(CropDO::getId));
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/cropRecord/CropRecordMapper.java

@ -24,6 +24,7 @@ public interface CropRecordMapper extends BaseMapperX<CropRecordDO> {
.eqIfPresent(CropRecordDO::getStock, reqVO.getStock())
.eqIfPresent(CropRecordDO::getAfterStock, reqVO.getAfterStock())
.betweenIfPresent(CropRecordDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.eqIfPresent(CropRecordDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(CropRecordDO::getId));
}
@ -34,6 +35,7 @@ public interface CropRecordMapper extends BaseMapperX<CropRecordDO> {
.eqIfPresent(CropRecordDO::getStock, reqVO.getStock())
.eqIfPresent(CropRecordDO::getAfterStock, reqVO.getAfterStock())
.betweenIfPresent(CropRecordDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.eqIfPresent(CropRecordDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(CropRecordDO::getId));
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/discuss/DiscussMapper.java

@ -24,6 +24,7 @@ public interface DiscussMapper extends BaseMapperX<DiscussDO> {
.eqIfPresent(DiscussDO::getContent, reqVO.getContent())
.eqIfPresent(DiscussDO::getImages, reqVO.getImages())
.betweenIfPresent(DiscussDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.eqIfPresent(DiscussDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(DiscussDO::getId));
}
@ -34,6 +35,7 @@ public interface DiscussMapper extends BaseMapperX<DiscussDO> {
.eqIfPresent(DiscussDO::getContent, reqVO.getContent())
.eqIfPresent(DiscussDO::getImages, reqVO.getImages())
.betweenIfPresent(DiscussDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.eqIfPresent(DiscussDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(DiscussDO::getId));
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/event/EventMapper.java

@ -25,6 +25,7 @@ public interface EventMapper extends BaseMapperX<EventDO> {
.eqIfPresent(EventDO::getContent, reqVO.getContent())
.eqIfPresent(EventDO::getImages, reqVO.getImages())
.betweenIfPresent(EventDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.eqIfPresent(EventDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(EventDO::getId));
}
@ -36,6 +37,7 @@ public interface EventMapper extends BaseMapperX<EventDO> {
.eqIfPresent(EventDO::getContent, reqVO.getContent())
.eqIfPresent(EventDO::getImages, reqVO.getImages())
.betweenIfPresent(EventDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.eqIfPresent(EventDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(EventDO::getId));
}

14
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java

@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.google.gson.JsonArray;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -53,15 +54,18 @@ public class AreaServiceImpl implements AreaService {
@Override
public void deleteArea(Long id) {
// 校验存在
this.validateAreaExists(id);
// 删除
areaMapper.deleteById(id);
AreaDO areaDO = this.validateAreaExists(id);
// 假装删除
areaDO.setPretendDelete(true);
areaMapper.updateById(areaDO);
}
private void validateAreaExists(Long id) {
if (areaMapper.selectById(id) == null) {
private AreaDO validateAreaExists(Long id) {
AreaDO areaDO = areaMapper.selectById(id);
if (areaDO == null) {
throw exception(AREA_NOT_EXISTS);
}
return areaDO;
}
@Override

11
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/crop/CropServiceImpl.java

@ -48,15 +48,18 @@ public class CropServiceImpl implements CropService {
@Override
public void deleteCrop(Long id) {
// 校验存在
this.validateCropExists(id);
CropDO cropDO = this.validateCropExists(id);
// 删除
cropMapper.deleteById(id);
cropDO.setPretendDelete(true);
cropMapper.updateById(cropDO);
}
private void validateCropExists(Long id) {
if (cropMapper.selectById(id) == null) {
private CropDO validateCropExists(Long id) {
CropDO cropDO = cropMapper.selectById(id);
if (cropDO == null) {
throw exception(CROP_NOT_EXISTS);
}
return cropDO;
}
@Override

12
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/cropRecord/CropRecordServiceImpl.java

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

11
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java

@ -114,15 +114,18 @@ public class DiscussServiceImpl implements DiscussService {
@Override
public void deleteDiscuss(Long id) {
// 校验存在
this.validateDiscussExists(id);
DiscussDO discussDO = this.validateDiscussExists(id);
// 删除
discussMapper.deleteById(id);
discussDO.setPretendDelete(true);
discussMapper.updateById(discussDO);
}
private void validateDiscussExists(Long id) {
if (discussMapper.selectById(id) == null) {
private DiscussDO validateDiscussExists(Long id) {
DiscussDO discussDO = discussMapper.selectById(id);
if (discussDO == null) {
throw exception(DISCUSS_NOT_EXISTS);
}
return discussDO;
}
@Override

11
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/event/EventServiceImpl.java

@ -50,15 +50,18 @@ public class EventServiceImpl implements EventService {
@Override
public void deleteEvent(Long id) {
// 校验存在
this.validateEventExists(id);
EventDO eventDO = this.validateEventExists(id);
// 删除
eventMapper.deleteById(id);
eventDO.setPretendDelete(true);
eventMapper.updateById(eventDO);
}
private void validateEventExists(Long id) {
if (eventMapper.selectById(id) == null) {
private EventDO validateEventExists(Long id) {
EventDO eventDO = eventMapper.selectById(id);
if (eventDO == null) {
throw exception(EVENT_NOT_EXISTS);
}
return eventDO;
}
@Override

Loading…
Cancel
Save