From 118623071a97b66f21c29e2bc02b8f15855ede5d Mon Sep 17 00:00:00 2001
From: Cui Zhi Feng <cuizf@fengyuntec.com>
Date: 星期三, 25 九月 2024 19:54:11 +0800
Subject: [PATCH] 均价计算 优化
---
src/main/resources/mapper/payment/DeliveryOrderMapper.xml | 37 +++++++++++++++++++++++++++++++------
1 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/mapper/payment/DeliveryOrderMapper.xml b/src/main/resources/mapper/payment/DeliveryOrderMapper.xml
index 34f3909..243e5d8 100644
--- a/src/main/resources/mapper/payment/DeliveryOrderMapper.xml
+++ b/src/main/resources/mapper/payment/DeliveryOrderMapper.xml
@@ -188,6 +188,22 @@
</select>
<select id="statisticStationList" resultType="com.mzl.flower.dto.response.flower.StationStatisticDTO">
+ select tt.*
+ , (select count(distinct s.id)
+ from t_supplier_info s
+ join t_delivery_order q on s.id = q.supplier_id
+ WHERE q.deleted = 0
+ and q.status in ('CHECKED')
+ AND s.station_id = tt.stationId
+ ) checkedSupplierCount
+ , (select count(distinct s.id)
+ from t_supplier_info s
+ join t_delivery_order q on s.id = q.supplier_id
+ WHERE q.deleted = 0
+ and q.status in ('PENDING', 'ARRIVED')
+ AND s.station_id = tt.stationId
+ ) uncheckedSupplierCount
+ from (
SELECT
s.station_id AS stationId,
st.`name`,
@@ -218,10 +234,15 @@
<if test="endDate != null">
AND o.create_time <= #{endDate}
</if>
- GROUP BY
- s.station_id,
- st.`name`;
+ <if test="statusList != null and statusList.size > 0">
+ AND o.status in
+ <foreach collection="statusList" item="status" open="(" separator="," close=")">
+ #{status}
+ </foreach>
+ </if>
+ GROUP BY s.station_id, st.`name`
+ ) tt
</select>
<update id="setDeliveryOrderPending">
@@ -236,9 +257,13 @@
SELECT q.*
FROM t_delivery_order q
WHERE q.deleted = 0
- and q.status in ('PENDING', 'ARRIVED', 'CHECKED')
+ AND q.status in ('PENDING', 'ARRIVED')
AND q.supplier_id = #{supplierId}
- AND q.create_time > #{startDate}
- AND q.create_time <= #{endDate}
+ <if test="startDate != null">
+ AND q.create_time > #{startDate}
+ </if>
+ <if test="endDate != null">
+ AND q.create_time <= #{endDate}
+ </if>
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3