生产中心加入租户查询
This commit is contained in:
@@ -30,4 +30,9 @@ public class ProductionPlanPage2ReqVO extends PageParam {
|
|||||||
@Schema(description = "计划执行状态")
|
@Schema(description = "计划执行状态")
|
||||||
private Integer planStatus;
|
private Integer planStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,28 @@
|
|||||||
package cn.iocoder.yudao.module.farm.controller.admin.specieslibrary;
|
package cn.iocoder.yudao.module.farm.controller.admin.specieslibrary;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.specieslibrary.vo.*;
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.List;
|
|
||||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.specieslibrary.vo.*;
|
||||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibraryDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibraryDO;
|
||||||
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 物种库维护")
|
@Tag(name = "管理后台 - 物种库维护")
|
||||||
@RestController
|
@RestController
|
||||||
@@ -84,6 +79,13 @@ public class SpeciesLibraryController {
|
|||||||
return success(resp);
|
return success(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/lists")
|
||||||
|
@Operation(summary = "获得物种库维护分页")
|
||||||
|
public CommonResult<List<SpeciesLibraryRespVO>> getSpeciesLibraryList() {
|
||||||
|
List<SpeciesLibraryDO> pageResult = speciesLibraryService.getSpeciesLibraryList();
|
||||||
|
return success(BeanUtils.toBean(pageResult, SpeciesLibraryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/tree")
|
@GetMapping("/tree")
|
||||||
@Operation(summary = "物种库三级树(speciesName1->speciesName2->cultivarName)")
|
@Operation(summary = "物种库三级树(speciesName1->speciesName2->cultivarName)")
|
||||||
public CommonResult<List<SpeciesTwoLevelTreeRespVO>> getSpeciesThreeLevelTree() {
|
public CommonResult<List<SpeciesTwoLevelTreeRespVO>> getSpeciesThreeLevelTree() {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public interface ProductionPlanMapper extends BaseMapperX<ProductionPlanDO> {
|
|||||||
.eqIfPresent(ProductionPlanDO::getBaseId, reqVO.getBaseId())
|
.eqIfPresent(ProductionPlanDO::getBaseId, reqVO.getBaseId())
|
||||||
.eqIfPresent(ProductionPlanDO::getPlotId, reqVO.getPlotId())
|
.eqIfPresent(ProductionPlanDO::getPlotId, reqVO.getPlotId())
|
||||||
.eqIfPresent(ProductionPlanDO::getPlanStatus, reqVO.getPlanStatus())
|
.eqIfPresent(ProductionPlanDO::getPlanStatus, reqVO.getPlanStatus())
|
||||||
|
.eqIfPresent(ProductionPlanDO::getTenantId, reqVO.getTenantId())
|
||||||
.orderByDesc(ProductionPlanDO::getCreateTime)
|
.orderByDesc(ProductionPlanDO::getCreateTime)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -62,7 +63,7 @@ public interface ProductionPlanMapper extends BaseMapperX<ProductionPlanDO> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductionPlanRespVO.PlanOverview getPlanOverview(@Param("baseId") String baseId);
|
ProductionPlanRespVO.PlanOverview getPlanOverview(@Param("baseId") String baseId, @Param("tenantId") String tenantId);
|
||||||
|
|
||||||
List<YieldComparisonChartRespVO> getYieldComparisonChart(YieldComparisonChartReqVO req);
|
List<YieldComparisonChartRespVO> getYieldComparisonChart(YieldComparisonChartReqVO req);
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
|
|
||||||
// 计划概述
|
// 计划概述
|
||||||
BaseInfoDO baseObj = baseInfoMapper.selectOne("id", e.getBaseId());
|
BaseInfoDO baseObj = baseInfoMapper.selectOne("id", e.getBaseId());
|
||||||
ProductionPlanRespVO.PlanOverview planOverview = productionPlanMapper.getPlanOverview(e.getBaseId());
|
ProductionPlanRespVO.PlanOverview planOverview = productionPlanMapper.getPlanOverview(e.getBaseId(), getLoginUser().getTenantId().toString());
|
||||||
planOverview.setTotalArea(baseObj.getArea());
|
planOverview.setTotalArea(baseObj.getArea());
|
||||||
e.setPlanOverview(planOverview);
|
e.setPlanOverview(planOverview);
|
||||||
});
|
});
|
||||||
@@ -275,7 +275,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
public PageResult<ProductionPlanResp2VO> getProductionPlanPage2(ProductionPlanPage2ReqVO reqVO) {
|
public PageResult<ProductionPlanResp2VO> getProductionPlanPage2(ProductionPlanPage2ReqVO reqVO) {
|
||||||
Map<String, String> speciesNameMap = speciesLibraryMapper.selectList().stream().collect(toMap(SpeciesLibraryDO::getId, SpeciesLibraryDO::getCultivarName, (v1, v2) -> v1));
|
Map<String, String> speciesNameMap = speciesLibraryMapper.selectList().stream().collect(toMap(SpeciesLibraryDO::getId, SpeciesLibraryDO::getCultivarName, (v1, v2) -> v1));
|
||||||
Map<String, String> employeeNameMap = personnelManagementMapper.selectList().stream().collect(toMap(PersonnelManagementDO::getId, PersonnelManagementDO::getName, (v1, v2) -> v1));
|
Map<String, String> employeeNameMap = personnelManagementMapper.selectList().stream().collect(toMap(PersonnelManagementDO::getId, PersonnelManagementDO::getName, (v1, v2) -> v1));
|
||||||
|
reqVO.setTenantId(getLoginUser().getTenantId().toString());
|
||||||
PageResult<ProductionPlanDO> productionPlanDOPageResult = productionPlanMapper.selectPage2(reqVO);
|
PageResult<ProductionPlanDO> productionPlanDOPageResult = productionPlanMapper.selectPage2(reqVO);
|
||||||
List<ProductionPlanDO> planList = productionPlanDOPageResult.getList();
|
List<ProductionPlanDO> planList = productionPlanDOPageResult.getList();
|
||||||
Map<String, List<ProductionPlanDO>> plansByBaseName = planList.stream().collect(Collectors.groupingBy(ProductionPlanDO::getBaseName, toList()));
|
Map<String, List<ProductionPlanDO>> plansByBaseName = planList.stream().collect(Collectors.groupingBy(ProductionPlanDO::getBaseName, toList()));
|
||||||
@@ -342,7 +342,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
public ProductionPlanResp2VO.PlanOverview getPlanOverview(ProductionPlanDO planObj) {
|
public ProductionPlanResp2VO.PlanOverview getPlanOverview(ProductionPlanDO planObj) {
|
||||||
BaseInfoDO baseObj = baseInfoMapper.selectOne("id", planObj.getBaseId());
|
BaseInfoDO baseObj = baseInfoMapper.selectOne("id", planObj.getBaseId());
|
||||||
if (baseObj != null) {
|
if (baseObj != null) {
|
||||||
ProductionPlanRespVO.PlanOverview source = productionPlanMapper.getPlanOverview(planObj.getBaseId());
|
ProductionPlanRespVO.PlanOverview source = productionPlanMapper.getPlanOverview(planObj.getBaseId(), getLoginUser().getTenantId().toString());
|
||||||
source.setTotalArea(baseObj.getArea());
|
source.setTotalArea(baseObj.getArea());
|
||||||
return BeanUtils.toBean(source, ProductionPlanResp2VO.PlanOverview.class);
|
return BeanUtils.toBean(source, ProductionPlanResp2VO.PlanOverview.class);
|
||||||
} else {
|
} else {
|
||||||
@@ -508,7 +508,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductionPlanRespVO.PlanOverview source = productionPlanMapper.getPlanOverview(baseId);
|
ProductionPlanRespVO.PlanOverview source = productionPlanMapper.getPlanOverview(baseId, tenantId.toString());
|
||||||
return new BasePlanOverviewRespVO().setTotalArea(totalArea)
|
return new BasePlanOverviewRespVO().setTotalArea(totalArea)
|
||||||
.setPlanCount(source.getPlanCount())
|
.setPlanCount(source.getPlanCount())
|
||||||
.setPlanCompletedCount(source.getPlanCompletedCount())
|
.setPlanCompletedCount(source.getPlanCompletedCount())
|
||||||
|
|||||||
@@ -93,4 +93,7 @@ public interface SpeciesLibraryService {
|
|||||||
boolean deleteSpeciesTwoLevelTree(String id);
|
boolean deleteSpeciesTwoLevelTree(String id);
|
||||||
|
|
||||||
CommonResult<SpeciesTwoLevelTreeDetailsRespVO> getSpeciesTwoTreeForOne(String id);
|
CommonResult<SpeciesTwoLevelTreeDetailsRespVO> getSpeciesTwoTreeForOne(String id);
|
||||||
|
|
||||||
|
List<SpeciesLibraryDO> getSpeciesLibraryList();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -834,4 +834,18 @@ public class SpeciesLibraryServiceImpl implements SpeciesLibraryService {
|
|||||||
res.setUseStatus(one.getStatus() ? 1 : 0);
|
res.setUseStatus(one.getStatus() ? 1 : 0);
|
||||||
return CommonResult.success(res);
|
return CommonResult.success(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SpeciesLibraryDO> getSpeciesLibraryList() {
|
||||||
|
List<SpeciesLibraryDO> result = speciesLibraryMapper.selectList();
|
||||||
|
if (result != null) {
|
||||||
|
// 触发图片集合转换,确保分页结果中的每个DO对象都包含转换后的图片集合
|
||||||
|
result.forEach(speciesLibrary -> {
|
||||||
|
if (speciesLibrary != null) {
|
||||||
|
speciesLibrary.getImageList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPlanOverview"
|
<select id="getPlanOverview"
|
||||||
parameterType="string"
|
parameterType="String"
|
||||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO$PlanOverview">
|
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO$PlanOverview">
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*) AS planCount,
|
COUNT(*) AS planCount,
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
<if test="baseId != null and baseId != ''">
|
<if test="baseId != null and baseId != ''">
|
||||||
AND base_id = #{baseId}
|
AND base_id = #{baseId}
|
||||||
</if>
|
</if>
|
||||||
|
and tenant_id = #{tenantId}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user