From c83b580b0f51a2cdf16f2b1537aa3cb113ef112f Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期五, 20 十二月 2024 17:56:10 +0800
Subject: [PATCH] add: 花材销售统计商品分类

---
 src/main/resources/mapper/payment/DeliveryOrderMapper.xml |   46 +++++++++++++++++++++++++++++++++++++---------
 1 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/src/main/resources/mapper/payment/DeliveryOrderMapper.xml b/src/main/resources/mapper/payment/DeliveryOrderMapper.xml
index 7af2ae0..91e1e49 100644
--- a/src/main/resources/mapper/payment/DeliveryOrderMapper.xml
+++ b/src/main/resources/mapper/payment/DeliveryOrderMapper.xml
@@ -6,7 +6,10 @@
         SELECT q.*, o.warehouse_name, o.warehouse_location_code, o.payment_time
         FROM t_delivery_order q
         join t_order o on q.order_id = o.id
+        left join t_warehouse w on o.warehouse_id=w.id
+        left join t_warehouse_location wl on o.warehouse_location_id=wl.id
         WHERE q.deleted = 0 and o.deleted = 0
+--         and w.deleted=0 and wl.deleted=0
         and q.supplier_id = #{supplierId}
         <if test="condition.orderNo != null and condition.orderNo != ''">
             AND q.order_no LIKE concat('%', #{condition.orderNo},'%')
@@ -17,13 +20,20 @@
                 #{item}
             </foreach>
         </if>
+<!--        <if test="condition.startDate != null">-->
+<!--            AND q.create_time &gt; #{condition.startDate}-->
+<!--        </if>-->
+<!--        <if test="condition.endDate != null">-->
+<!--            AND q.create_time &lt;= #{condition.endDate}-->
+<!--        </if>-->
         <if test="condition.startDate != null">
-            AND q.create_time &gt; #{condition.startDate}
+            AND o.payment_time &gt;= #{condition.startDate}
         </if>
         <if test="condition.endDate != null">
-            AND q.create_time &lt;= #{condition.endDate}
+            AND o.payment_time &lt; #{condition.endDate}
         </if>
-        ORDER BY o.payment_time
+--         ORDER BY o.payment_time
+        order by w.seq,wl.seq asc
     </select>
 
     <select id="selectDoStationList" resultType="com.mzl.flower.dto.response.payment.DeliveryOrderStationListDTO">
@@ -130,11 +140,17 @@
             AND o.warehouse_location_code LIKE concat('%', #{condition.warehouseLocationCode},'%')
         </if>
 
+<!--        <if test="condition.startDate != null">-->
+<!--            AND q.create_time &gt; #{condition.startDate}-->
+<!--        </if>-->
+<!--        <if test="condition.endDate != null">-->
+<!--            AND q.create_time &lt;= #{condition.endDate}-->
+<!--        </if>-->
         <if test="condition.startDate != null">
-            AND q.create_time &gt; #{condition.startDate}
+            AND o.payment_time &gt;= #{condition.startDate}
         </if>
         <if test="condition.endDate != null">
-            AND q.create_time &lt;= #{condition.endDate}
+            AND o.payment_time &lt; #{condition.endDate}
         </if>
         ) tt
         GROUP BY tt.id, tt.supplierName, tt.supplierTel, tt.stationName
@@ -177,11 +193,17 @@
             AND o.warehouse_location_code LIKE concat('%', #{condition.warehouseLocationCode},'%')
         </if>
 
+<!--        <if test="condition.startDate != null">-->
+<!--            AND q.create_time &gt; #{condition.startDate}-->
+<!--        </if>-->
+<!--        <if test="condition.endDate != null">-->
+<!--            AND q.create_time &lt;= #{condition.endDate}-->
+<!--        </if>-->
         <if test="condition.startDate != null">
-            AND q.create_time &gt; #{condition.startDate}
+            AND o.payment_time &gt;= #{condition.startDate}
         </if>
         <if test="condition.endDate != null">
-            AND q.create_time &lt;= #{condition.endDate}
+            AND o.payment_time &lt; #{condition.endDate}
         </if>
 
         ORDER BY q.arrive_time
@@ -213,11 +235,17 @@
             t.warehouse_location_code LIKE concat('%', #{name},'%')
             )
         </if>
+<!--        <if test="startDate != null">-->
+<!--            AND o.create_time &gt; #{startDate}-->
+<!--        </if>-->
+<!--        <if test="endDate != null">-->
+<!--            AND o.create_time &lt;= #{endDate}-->
+<!--        </if>-->
         <if test="startDate != null">
-            AND o.create_time &gt; #{startDate}
+            AND t.payment_time &gt;= #{startDate}
         </if>
         <if test="endDate != null">
-            AND o.create_time &lt;= #{endDate}
+            AND t.payment_time &lt; #{endDate}
         </if>
 
         <if test="statusList != null and statusList.size > 0">

--
Gitblit v1.9.3