From 9757b5a835a8f2dbaad8a42569f1a6ace2be8515 Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Thu, 4 Jun 2026 18:47:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E6=8E=92=E5=8D=95=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=86=E7=BB=84=E7=BB=B4=E5=BA=A6=E6=95=B0=E6=8D=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/mysql/planitem/PlanItemMapper.java | 14 +++- .../service/plan/PlanServiceImpl.java | 20 ++--- .../mapper/planitem/PlanItemMapper.xml | 84 +++++++++++-------- 3 files changed, 70 insertions(+), 48 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 80b02cb3c..6ffd3c69d 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 @@ -29,14 +29,24 @@ public interface PlanItemMapper extends BaseMapperX { * @param wrapper * @param type * @param orderGoodsIds 商品id列表 - * @param orderIds 父级订单数组 + * @param rootIds 父级订单数组 * @return */ IPage selectOrderList(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper wrapper, @Param("type") int type, @Param("orderGoodsIds") List orderGoodsIds, - @Param("orderIds") Long... orderIds); + @Param("rootIds") List rootIds); + + /** + * 未排单顶级订单id列表 + * + * @param page + * @param wrapper + * @return + */ + IPage selectRootOrderIdList(@Param("page") IPage page, + @Param(Constants.WRAPPER) Wrapper wrapper); /** * 未排单子单查询 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 90bcda5ae..d631f5f20 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 @@ -539,16 +539,11 @@ public class PlanServiceImpl implements PlanService { // 查询类型:订单分组 int type = OrderPlanQueryTypeEnum.ORDER_GROUP.getType(); if(CollUtil.isNotEmpty(goodsIds)) { - // 从订单材质查询订单id列表 - List goodsOrderId = - goodsMapper.getParentOrderIdsByGoodsIds( - goodsIds, - pageReqVO.getOrderIds()); + List orderIdList = Optional.ofNullable(pageReqVO.getOrderIds()).orElse(new ArrayList<>()); - if (CollUtil.isNotEmpty(goodsOrderId)) { - // 查询本身和父订单id - pageReqVO.setOrderIds(orderService.getFatherAndSonOrderIds(goodsOrderId)); - } + List goodsDOS = goodsMapper.selectListByGoodsId(orderIdList, goodsIds, organId); + orderGoodsIds.addAll(goodsDOS.stream().map(GoodsDO::getId).toList()); + type = OrderPlanQueryTypeEnum.GOODS_GROUP.getType(); } QueryWrapperX queryWrapperX = new QueryWrapperX<>(); @@ -564,7 +559,12 @@ public class PlanServiceImpl implements PlanService { .likeIfPresent(FIELD_ADDRESS, pageReqVO.getConsigneeAddress()) .betweenIfPresent(FIELD_ORDER_DATE, LocalDateTimeUtils.generateTimeSection(pageReqVO.getCreateTime())); PageDTO page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); - IPage orderList = planItemMapper.selectOrderList(page, queryWrapperX, type, orderGoodsIds); + + // 查询满足未排单条件的顶级订单id + IPage rootOrderIdList = planItemMapper.selectRootOrderIdList(page, queryWrapperX); + // 查询顶级列表的信息 + IPage orderList = planItemMapper.selectOrderList(page, queryWrapperX, type, orderGoodsIds, rootOrderIdList.getRecords()); + List mainOrderList = orderList.getRecords(); long total = orderList.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 151f53565..ef7dd4296 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 @@ -19,7 +19,6 @@ + +