mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
装配订单分页性能优化
This commit is contained in:
+1
-1
@@ -143,7 +143,7 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
|||||||
* @param parentIds
|
* @param parentIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OrderDO> selectChildList(@Param("reqVO") OrderPageReqVO reqVO, @Param("parentIds") List<Long> parentIds);
|
List<Long> selectChildIdList(@Param("reqVO") OrderPageReqVO reqVO, @Param("parentIds") List<Long> parentIds);
|
||||||
|
|
||||||
IPage<OrderRespVOCopy> selectOrderPage(@Param("page") IPage<OrderRespVOCopy> page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
IPage<OrderRespVOCopy> selectOrderPage(@Param("page") IPage<OrderRespVOCopy> page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -108,9 +108,12 @@ public class AssemblyListServiceImpl implements AssemblyListService {
|
|||||||
orderDOS.sort(Comparator.comparing(o -> sortMap.get(o.getId())));
|
orderDOS.sort(Comparator.comparing(o -> sortMap.get(o.getId())));
|
||||||
|
|
||||||
// 3. 查询子单
|
// 3. 查询子单
|
||||||
List<OrderDO> childList =
|
List<Long> childIdList = orderMapper.selectChildIdList(pageReqVO, orderIds);
|
||||||
orderMapper.selectChildList(pageReqVO, orderIds);
|
if (CollUtil.isEmpty(childIdList)) {
|
||||||
|
return new PageResult<>(orderDOS, pageResultTotal);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<OrderDO> childList = orderMapper.selectByIds(childIdList);
|
||||||
if (CollUtil.isEmpty(childList)) {
|
if (CollUtil.isEmpty(childList)) {
|
||||||
return new PageResult<>(orderDOS, pageResultTotal);
|
return new PageResult<>(orderDOS, pageResultTotal);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -356,9 +356,12 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
orderDOS.sort(Comparator.comparing(o -> sortMap.get(o.getId())));
|
orderDOS.sort(Comparator.comparing(o -> sortMap.get(o.getId())));
|
||||||
|
|
||||||
// 3. 查询子单
|
// 3. 查询子单
|
||||||
List<OrderDO> childList =
|
List<Long> childIdList = orderMapper.selectChildIdList(pageReqVO, orderIds);
|
||||||
orderMapper.selectChildList(pageReqVO, orderIds);
|
if (CollUtil.isEmpty(childIdList)) {
|
||||||
|
return new PageResult<>(orderDOS, pageResultTotal);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<OrderDO> childList = orderMapper.selectByIds(childIdList);
|
||||||
if (CollUtil.isEmpty(childList)) {
|
if (CollUtil.isEmpty(childList)) {
|
||||||
return new PageResult<>(orderDOS, pageResultTotal);
|
return new PageResult<>(orderDOS, pageResultTotal);
|
||||||
}
|
}
|
||||||
|
|||||||
+32
-37
@@ -34,13 +34,10 @@
|
|||||||
t.root_id
|
t.root_id
|
||||||
|
|
||||||
FROM orders t
|
FROM orders t
|
||||||
where 1=1
|
|
||||||
|
|
||||||
<if test="reqVO.assembly or reqVO.processStatus != null">
|
<if test="reqVO.assembly or reqVO.processStatus != null">
|
||||||
AND EXISTS (
|
JOIN order_component oc
|
||||||
SELECT 1
|
ON oc.organ_id = t.organ_id
|
||||||
FROM order_component oc
|
AND oc.order_id = t.id
|
||||||
WHERE oc.order_id = t.id
|
|
||||||
AND oc.deleted = 0
|
AND oc.deleted = 0
|
||||||
AND oc.pid = 0
|
AND oc.pid = 0
|
||||||
<if test="reqVO.processStatus != null">
|
<if test="reqVO.processStatus != null">
|
||||||
@@ -60,8 +57,8 @@
|
|||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
)
|
|
||||||
</if>
|
</if>
|
||||||
|
where 1=1
|
||||||
|
|
||||||
<if test="reqVO.id != null and reqVO.id != ''">
|
<if test="reqVO.id != null and reqVO.id != ''">
|
||||||
AND CAST(t.id AS CHAR) LIKE CONCAT('%', #{reqVO.id}, '%')
|
AND CAST(t.id AS CHAR) LIKE CONCAT('%', #{reqVO.id}, '%')
|
||||||
@@ -171,11 +168,36 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectChildList"
|
<select id="selectChildIdList"
|
||||||
resultType="com.cf.imes.module.executor.dal.dataobject.order.OrderDO">
|
resultType="java.lang.Long">
|
||||||
|
|
||||||
SELECT *
|
SELECT DISTINCT
|
||||||
|
t.id
|
||||||
FROM orders t
|
FROM orders t
|
||||||
|
<if test="reqVO.assembly or reqVO.processStatus != null">
|
||||||
|
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
|
||||||
|
<if test="reqVO.processStatus != null">
|
||||||
|
<choose>
|
||||||
|
<when test="reqVO.processStatus == 0">
|
||||||
|
AND oc.extra_process_status = 0
|
||||||
|
</when>
|
||||||
|
<when test="reqVO.processStatus == 1">
|
||||||
|
AND oc.process_status = 1
|
||||||
|
AND (oc.extra_process_status IS NULL OR oc.extra_process_status != 0)
|
||||||
|
</when>
|
||||||
|
<when test="reqVO.processStatus == 2">
|
||||||
|
AND oc.process_status = 2
|
||||||
|
</when>
|
||||||
|
<when test="reqVO.processStatus == 3">
|
||||||
|
AND oc.extra_process_status = 3
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
WHERE t.parent_id IN
|
WHERE t.parent_id IN
|
||||||
|
|
||||||
<foreach collection="parentIds"
|
<foreach collection="parentIds"
|
||||||
@@ -186,33 +208,6 @@
|
|||||||
#{parentId}
|
#{parentId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
||||||
<if test="reqVO.assembly or reqVO.processStatus != null">
|
|
||||||
AND EXISTS (
|
|
||||||
SELECT 1
|
|
||||||
FROM order_component oc
|
|
||||||
WHERE oc.order_id = t.id
|
|
||||||
AND oc.deleted = 0
|
|
||||||
AND oc.pid = 0
|
|
||||||
<if test="reqVO.processStatus != null">
|
|
||||||
<choose>
|
|
||||||
<when test="reqVO.processStatus == 0">
|
|
||||||
AND oc.extra_process_status = 0
|
|
||||||
</when>
|
|
||||||
<when test="reqVO.processStatus == 1">
|
|
||||||
AND oc.process_status = 1
|
|
||||||
AND (oc.extra_process_status IS NULL OR oc.extra_process_status != 0)
|
|
||||||
</when>
|
|
||||||
<when test="reqVO.processStatus == 2">
|
|
||||||
AND oc.process_status = 2
|
|
||||||
</when>
|
|
||||||
<when test="reqVO.processStatus == 3">
|
|
||||||
AND oc.extra_process_status = 3
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</if>
|
|
||||||
)
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="reqVO.id != null and reqVO.id != ''">
|
<if test="reqVO.id != null and reqVO.id != ''">
|
||||||
AND CAST(t.id AS CHAR) LIKE CONCAT('%', #{reqVO.id}, '%')
|
AND CAST(t.id AS CHAR) LIKE CONCAT('%', #{reqVO.id}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user