diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java index 216c37553..b5217889f 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java @@ -143,7 +143,7 @@ public interface OrderMapper extends BaseMapperX { * @param parentIds * @return */ - List selectChildList(@Param("reqVO") OrderPageReqVO reqVO, @Param("parentIds") List parentIds); + List selectChildIdList(@Param("reqVO") OrderPageReqVO reqVO, @Param("parentIds") List parentIds); IPage selectOrderPage(@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/assemblylist/AssemblyListServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/assemblylist/AssemblyListServiceImpl.java index 780112c65..be0bb97ba 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/assemblylist/AssemblyListServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/assemblylist/AssemblyListServiceImpl.java @@ -108,9 +108,12 @@ public class AssemblyListServiceImpl implements AssemblyListService { orderDOS.sort(Comparator.comparing(o -> sortMap.get(o.getId()))); // 3. 查询子单 - List childList = - orderMapper.selectChildList(pageReqVO, orderIds); + List childIdList = orderMapper.selectChildIdList(pageReqVO, orderIds); + if (CollUtil.isEmpty(childIdList)) { + return new PageResult<>(orderDOS, pageResultTotal); + } + List childList = orderMapper.selectByIds(childIdList); if (CollUtil.isEmpty(childList)) { return new PageResult<>(orderDOS, pageResultTotal); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java index 1aa5a7e75..906361bef 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java @@ -356,9 +356,12 @@ public class OrderServiceImpl implements OrderService { orderDOS.sort(Comparator.comparing(o -> sortMap.get(o.getId()))); // 3. 查询子单 - List childList = - orderMapper.selectChildList(pageReqVO, orderIds); + List childIdList = orderMapper.selectChildIdList(pageReqVO, orderIds); + if (CollUtil.isEmpty(childIdList)) { + return new PageResult<>(orderDOS, pageResultTotal); + } + List childList = orderMapper.selectByIds(childIdList); if (CollUtil.isEmpty(childList)) { return new PageResult<>(orderDOS, pageResultTotal); } 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 6dff9c445..88fba4087 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 @@ -34,13 +34,10 @@ t.root_id FROM orders t - where 1=1 - - AND EXISTS ( - SELECT 1 - FROM order_component oc - WHERE oc.order_id = t.id + JOIN order_component oc + ON oc.organ_id = t.organ_id + AND oc.order_id = t.id AND oc.deleted = 0 AND oc.pid = 0 @@ -60,8 +57,8 @@ - ) + where 1=1 AND CAST(t.id AS CHAR) LIKE CONCAT('%', #{reqVO.id}, '%') @@ -171,11 +168,36 @@ - - SELECT * + SELECT DISTINCT + t.id FROM orders t + + JOIN order_component oc + ON oc.organ_id = t.organ_id + AND oc.order_id = t.id + AND oc.deleted = 0 + AND oc.pid = 0 + + + + AND oc.extra_process_status = 0 + + + AND oc.process_status = 1 + AND (oc.extra_process_status IS NULL OR oc.extra_process_status != 0) + + + AND oc.process_status = 2 + + + AND oc.extra_process_status = 3 + + + + WHERE t.parent_id IN - - AND EXISTS ( - SELECT 1 - FROM order_component oc - WHERE oc.order_id = t.id - AND oc.deleted = 0 - AND oc.pid = 0 - - - - AND oc.extra_process_status = 0 - - - AND oc.process_status = 1 - AND (oc.extra_process_status IS NULL OR oc.extra_process_status != 0) - - - AND oc.process_status = 2 - - - AND oc.extra_process_status = 3 - - - - ) - - AND CAST(t.id AS CHAR) LIKE CONCAT('%', #{reqVO.id}, '%')