订单管理、装配设置 条件过滤作用到子单修复

This commit is contained in:
gaoqr
2026-06-18 11:19:36 +08:00
parent 9e275f7ab7
commit bbc242ae52
@@ -34,23 +34,32 @@
t.root_id
FROM orders t
where 1=1
<if test="reqVO.processStatus != null">
JOIN order_component oc
ON oc.order_id = t.id
AND oc.deleted = 0
AND oc.pid = 0
</if>
WHERE 1 = 1
<if test="reqVO.assembly and reqVO.processStatus == null">
<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>
@@ -134,31 +143,6 @@
AND t.create_time BETWEEN #{reqVO.createTime[0]} AND #{reqVO.createTime[1]}
</if>
<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
</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>
AND t.deleted = #{reqVO.deleted}
<choose>
@@ -202,6 +186,109 @@
#{parentId}
</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 != ''">
AND CAST(t.id AS CHAR) LIKE CONCAT('%', #{reqVO.id}, '%')
</if>
<if test="reqVO.apiOrderId != null and reqVO.apiOrderId != ''">
AND t.api_order_id = #{reqVO.apiOrderId}
</if>
<if test="reqVO.orderDate != null and reqVO.orderDate.length == 2">
AND t.order_date BETWEEN #{reqVO.orderDate[0]} AND #{reqVO.orderDate[1]}
</if>
<if test="reqVO.deliveryDate != null and reqVO.deliveryDate.length == 2">
AND t.delivery_date BETWEEN #{reqVO.deliveryDate[0]} AND #{reqVO.deliveryDate[1]}
</if>
<if test="reqVO.orderType != null">
AND t.order_type = #{reqVO.orderType}
</if>
<if test="reqVO.orderSort != null">
AND t.order_sort = #{reqVO.orderSort}
</if>
<if test="reqVO.dataType != null">
AND t.data_type = #{reqVO.dataType}
</if>
<if test="reqVO.status != null">
AND t.status = #{reqVO.status}
</if>
<if test="reqVO.customOrderNo != null and reqVO.customOrderNo != ''">
AND t.custom_order_no LIKE CONCAT('%', #{reqVO.customOrderNo}, '%')
</if>
<if test="reqVO.customer != null and reqVO.customer != ''">
AND t.customer = #{reqVO.customer}
</if>
<if test="reqVO.address != null and reqVO.address != ''">
AND t.address LIKE CONCAT('%', #{reqVO.address}, '%')
</if>
<if test="reqVO.phoneNumber != null and reqVO.phoneNumber != ''">
AND t.phone_number = #{reqVO.phoneNumber}
</if>
<if test="reqVO.dealer != null and reqVO.dealer != ''">
AND t.dealer LIKE CONCAT('%', #{reqVO.dealer}, '%')
</if>
<if test="reqVO.dealerPhoneNumber != null and reqVO.dealerPhoneNumber != ''">
AND t.dealer_phone_number = #{reqVO.dealerPhoneNumber}
</if>
<if test="reqVO.salesman != null and reqVO.salesman != ''">
AND t.salesman = #{reqVO.salesman}
</if>
<if test="reqVO.splitter != null and reqVO.splitter != ''">
AND t.splitter = #{reqVO.splitter}
</if>
<if test="reqVO.remark != null and reqVO.remark != ''">
AND t.remark = #{reqVO.remark}
</if>
<if test="reqVO.organId != null">
AND t.organ_id = #{reqVO.organId}
</if>
<if test="reqVO.createTime != null and reqVO.createTime.length == 2">
AND t.create_time BETWEEN #{reqVO.createTime[0]} AND #{reqVO.createTime[1]}
</if>
AND t.deleted = #{reqVO.deleted}
ORDER BY t.id DESC