From e40ef82eb5531e286fdb930cb74b423b7436b50b Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Mon, 25 May 2026 18:28:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86=E3=80=81?= =?UTF-8?q?=E6=9C=AA=E6=8E=92=E8=AE=A2=E5=8D=95=E3=80=81=E5=88=86=E5=A0=86?= =?UTF-8?q?=E6=89=93=E5=8C=85=E6=94=AF=E6=8C=81=E6=9D=A1=E4=BB=B6=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E4=BD=9C=E7=94=A8=E5=88=B0=E5=AD=90=E5=8D=95=20mycat?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=BC=82=E5=B8=B8=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/mysql/planitem/PlanItemMapper.java | 4 +- .../service/plan/PlanServiceImpl.java | 5 +- .../resources/mapper/order/OrderMapper.xml | 72 ++++++++++++------- .../mapper/planitem/PlanItemMapper.xml | 44 +++++++++--- 4 files changed, 84 insertions(+), 41 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 447e25ee6..56e29b6c7 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 @@ -41,15 +41,13 @@ public interface PlanItemMapper extends BaseMapperX { /** * 未排单子单查询 * - * @param page * @param wrapper * @param type * @param orderGoodsIds 商品id列表 * @param orderIds 父级订单数组 * @return */ - IPage selectOrderChildList(@Param("page") IPage page, - @Param(Constants.WRAPPER) Wrapper wrapper, + List selectOrderChildList(@Param(Constants.WRAPPER) Wrapper wrapper, @Param("type") int type, @Param("orderGoodsIds") List orderGoodsIds, @Param("orderIds") Long... orderIds); 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 c6a702790..417064bef 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 @@ -573,10 +573,7 @@ public class PlanServiceImpl implements PlanService { if (CollUtil.isNotEmpty(mainOrderList)) { // 主单id列表 Long[] mainOrderIds = mainOrderList.stream().map(OrderRespVOCopy::getOrderId).toArray(Long[]::new); - PageDTO childPage = new PageDTO<>(pageReqVO.getPageNo(), PageParam.PAGE_SIZE_NONE); - IPage childOrderList = planItemMapper.selectOrderChildList(childPage, queryWrapperX, type, orderGoodsIds, mainOrderIds); - - List childList = childOrderList.getRecords(); + List childList = planItemMapper.selectOrderChildList(queryWrapperX, type, orderGoodsIds, mainOrderIds); if (CollUtil.isNotEmpty(childList)) { // 按 parentId 分组 diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml index d8862a7c1..b861a59bb 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml @@ -29,17 +29,22 @@ + SELECT o.id AS orderId, @@ -51,6 +52,7 @@ SUM(og.plate_num - og.planned_plate_num) AS num, SUM(og.area - og.planned_plate_area) AS area FROM order_goods og + WHERE og.plate_num - og.planned_plate_num > 0 @@ -70,22 +72,44 @@ - WHERE o.id IN ( + JOIN ( - SELECT DISTINCT + SELECT + root_id + FROM ( - CASE - WHEN x.parent_id = 0 THEN x.id - ELSE x.parent_id - END + SELECT + IF(x.parent_id = 0, x.id, x.parent_id) AS root_id FROM orders x - ${ew.customSqlSegment.replace('o.', 'x.')} - and IFNULL(x.plate_num,0) - IFNULL(x.planned_plate_num,0) > 0 - ) + - AND o.parent_id = 0 + + + ${ew.customSqlSegment.replace('o.', 'x.')} + + AND IFNULL(x.plate_num,0) - IFNULL(x.planned_plate_num,0) > 0 + + + + + + WHERE IFNULL(x.plate_num,0) - IFNULL(x.planned_plate_num,0) > 0 + + + + + + ) tmp + + GROUP BY root_id + + ) root_order + + ON root_order.root_id = o.id + + WHERE o.parent_id = 0 AND IFNULL(o.plate_num,0) - IFNULL(o.planned_plate_num,0) > 0