From 62221e096a5d15287297d733cae712a23fd17460 Mon Sep 17 00:00:00 2001 From: liuzhaotian Date: Thu, 3 Apr 2025 15:34:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E5=8D=95=E6=9F=A5=E8=AF=A2=E5=B0=8F?= =?UTF-8?q?=E6=9D=BFSQL=E5=8F=82=E6=95=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/mysql/planitem/PlanItemMapper.java | 6 +++- .../service/plan/PlanServiceImpl.java | 25 ++++++++++++----- .../mapper/planitem/PlanItemMapper.xml | 28 ++++++++++++++++--- 3 files changed, 47 insertions(+), 12 deletions(-) diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/planitem/PlanItemMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/planitem/PlanItemMapper.java index c2f31f9b6..33e02ab3b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/planitem/PlanItemMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/planitem/PlanItemMapper.java @@ -43,7 +43,10 @@ public interface PlanItemMapper extends BaseMapperX { List selectOrderPlanPlateList(@Param("planIds") List planIds, @Param("organId") Long organId); - IPage selectPlateListByPlateIds(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper wrapper,@Param("organId") Long organId); + List selectPlateListByPlateIds(@Param(Constants.WRAPPER) Wrapper wrapper,@Param("pageNo") Integer pageNo,@Param("pageSize") Integer pageSize); + + Long selectPlateCountByPlateIds(@Param(Constants.WRAPPER) Wrapper wrapper); + IPage selectNoPlanGoodsByRoomAndBodyIds(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper wrapper,@Param("organId") Long organId); @@ -86,4 +89,5 @@ public interface PlanItemMapper extends BaseMapperX { .inIfPresent(PlanItemDO::getOrderId,orderIds) .select(PlanItemDO::getGoodsId)); } + } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java index 9c9dd687c..36ea5f5fa 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java @@ -753,9 +753,19 @@ public class PlanServiceImpl implements PlanService { if(vo.getPlanIds().isEmpty()){ return null; } - for (Long planId : vo.getPlanIds()) { - validatePlan(planId); + + List planIds = vo.getPlanIds(); + + List planDOS = planMapper.selectBatchIds(planIds); + + if(planDOS.size() != planIds.size()){ + planDOS.forEach(f->{ + if(!planIds.contains(f.getId())){ + throw exception(PLAN_NOT_DATA_EXISTS,f.getId()); + } + }); } + QueryWrapperX queryWrapperX = new QueryWrapperX<>(); String filterTypes = ""; @@ -779,17 +789,18 @@ public class PlanServiceImpl implements PlanService { .betweenIfPresent("op.height", new BigDecimal[]{vo.getLongMinRang(), vo.getLongMaxRang()}) .likeIfPresent("op.filter_type", insertSeparator(filterTypes)); - PageDTO page = new PageDTO<>(vo.getPageNo(), vo.getPageSize()); + Integer pageNo = (vo.getPageNo() - 1) * vo.getPageSize(); - IPage pageResult = planItemMapper.selectPlateListByPlateIds(page,queryWrapperX,getUserOrganId()); + List pageResult = planItemMapper.selectPlateListByPlateIds(queryWrapperX,pageNo,vo.getPageSize()); - - if (CollUtil.isEmpty(pageResult.getRecords())) { + if (CollUtil.isEmpty(pageResult)) { return new PageResult<>(); } + Long sum = planItemMapper.selectPlateCountByPlateIds(queryWrapperX); + + return new PageResult<>(pageResult, sum); - return new PageResult<>(pageResult.getRecords(), pageResult.getTotal()); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml index a198d7019..02e9844e1 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml @@ -124,10 +124,30 @@ ob.room_name as roomName from order_plan_item opi - join order_goods og on opi.order_id = og.order_id and opi.goods_id = og.id and og.organ_id = #{organId} - join order_plate op on opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id and op.organ_id = #{organId} - join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id and oi.organ_id = #{organId} - join order_body ob on oi.order_id = ob.order_id and oi.body_id = ob.id and ob.organ_id = #{organId} + join order_goods og on opi.order_id = og.order_id and opi.goods_id = og.id + join order_plate op on opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id + join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id + join order_body ob on oi.order_id = ob.order_id and oi.body_id = ob.id + + ${ew.customSqlSegment} + + limit #{pageNo},#{pageSize}; + + + + + + +