farm模块-地块返回基地名称
This commit is contained in:
@@ -32,6 +32,8 @@ public class PlotInfoDO extends BaseDO {
|
||||
* 所属基地ID
|
||||
*/
|
||||
private String baseId;
|
||||
@TableField(exist = false)
|
||||
private String baseName;
|
||||
/**
|
||||
* 地块ID
|
||||
*/
|
||||
|
||||
@@ -85,7 +85,7 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
||||
throw exception(PLOT_INFO_NOT_EXISTS);
|
||||
}
|
||||
// 校验: 存在在种地块时 不允许删除
|
||||
boolean flag = productionPlanService.validateIncompletePlansBId("plot_id",obj.getPlotId());
|
||||
boolean flag = productionPlanService.validateIncompletePlansBId("plot_id", obj.getPlotId());
|
||||
// 删除
|
||||
if (flag) {
|
||||
plotInfoMapper.deleteById(id);
|
||||
@@ -106,12 +106,15 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
||||
|
||||
@Override
|
||||
public PlotInfoDO getPlotInfo(String id) {
|
||||
return plotInfoMapper.selectById(id);
|
||||
PlotInfoDO plotInfoDO = plotInfoMapper.selectById(id);
|
||||
BaseInfoDO baseInfoDO = baseInfoMapper.selectById(plotInfoDO.getBaseId());
|
||||
plotInfoDO.setBaseName(baseInfoDO.getName());
|
||||
return plotInfoDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlotInfoDO> getPlotInfos(String baseId) {
|
||||
return plotInfoMapper.selectList("base_id",baseId);
|
||||
return plotInfoMapper.selectList("base_id", baseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,9 +141,10 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
||||
|
||||
/**
|
||||
* 验证: 地块总面积不得大于基地面积
|
||||
*
|
||||
* @param baseId 基地面积
|
||||
*/
|
||||
private boolean validateTotalPlotArea(String baseId){
|
||||
private boolean validateTotalPlotArea(String baseId) {
|
||||
BaseInfoDO baseObj = baseInfoMapper.selectOne("id", baseId);
|
||||
BigDecimal baseArea = baseObj.getArea();
|
||||
|
||||
@@ -154,7 +158,7 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
||||
.filter(area -> area != null) // 重要:过滤null值
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
return plotTotalArea.compareTo(baseArea) > 0 ;
|
||||
return plotTotalArea.compareTo(baseArea) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user