fix (farm): 基地管理
- 删除基地同时删除其所属地块
This commit is contained in:
@@ -15,6 +15,7 @@ import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManag
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.plotinfo.PlotInfoMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.specieslibrary.SpeciesLibraryMapper;
|
||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
|
||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -46,8 +47,6 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
@Resource
|
||||
private BaseInfoMapper baseInfoMapper;
|
||||
@Resource
|
||||
private PlotInfoMapper plotInfoMapper;
|
||||
@Resource
|
||||
private SpeciesLibraryMapper speciesLibraryMapper;
|
||||
@Resource
|
||||
private PersonnelManagementMapper personnelManagementMapper;
|
||||
@@ -55,6 +54,8 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
private GridInfoMapper gridInfoMapper;
|
||||
@Resource
|
||||
private ProductionPlanService productionPlanService;
|
||||
@Resource
|
||||
private PlotInfoService plotInfoService;
|
||||
|
||||
@Override
|
||||
public String createBaseInfo(BaseInfoSaveReqVO createReqVO) {
|
||||
@@ -93,8 +94,8 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
if (flag) {
|
||||
// 删除
|
||||
baseInfoMapper.deleteById(id);
|
||||
plotInfoService.deleteByBaseId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,7 +131,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
List<BaseNameRespVO> res = new ArrayList<>();
|
||||
|
||||
// 地块
|
||||
List<PlotInfoDO> plotInfoDOS = plotInfoMapper.selectList();
|
||||
List<PlotInfoDO> plotInfoDOS = plotInfoService.getPlotInfos();
|
||||
// 基地
|
||||
List<BaseInfoDO> baseInfoDOS = baseInfoMapper.selectList();
|
||||
Map<String, String> baseNameMap = baseInfoDOS.stream().collect(Collectors.toMap(BaseInfoDO::getId, BaseInfoDO::getName, (v1, v2) -> v1));
|
||||
@@ -198,7 +199,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
String baseId = obj.getId();
|
||||
String baseName = obj.getName();
|
||||
BigDecimal baseArea = obj.getArea();
|
||||
List<PlotInfoDO> plotList = plotInfoMapper.selectList("base_id", baseId);
|
||||
List<PlotInfoDO> plotList = plotInfoService.getPlotInfos( baseId);
|
||||
|
||||
// 基地概述
|
||||
BaseInfoRespVO.BaseInfo baseOverview = this.packageBaseOverview(tenantId, baseId, baseName, baseArea, plotList);
|
||||
|
||||
@@ -63,4 +63,10 @@ public interface PlotInfoService {
|
||||
PageResult<PlotInfoDO> getPlotInfoPage(PlotInfoPageReqVO pageReqVO);
|
||||
|
||||
PlotInfoDO getPlotInfoByPlotId(String plotId);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param id
|
||||
*/
|
||||
void deleteByBaseId(String baseId);
|
||||
}
|
||||
@@ -131,6 +131,11 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
||||
return plotInfoMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByBaseId(String baseId) {
|
||||
plotInfoMapper.delete("base_id", baseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证: 地块总面积不得大于基地面积
|
||||
* @param baseId 基地面积
|
||||
|
||||
Reference in New Issue
Block a user