From 7d7ac69a8af85ab9e67c1dc2c6f52b03d27669e4 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期四, 26 十二月 2024 08:58:19 +0800
Subject: [PATCH] add:阿里云短信模板获取签名和模板信息

---
 src/main/resources/mapper/payment/DeliveryOrderMapper.xml |  106 ++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 68 insertions(+), 38 deletions(-)

diff --git a/src/main/resources/mapper/payment/DeliveryOrderMapper.xml b/src/main/resources/mapper/payment/DeliveryOrderMapper.xml
index 7af2ae0..7b03df7 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
@@ -148,6 +164,8 @@
         join t_order o on q.order_id = o.id
         join t_supplier_info s on s.id = q.supplier_id
         join t_station st on st.id = s.station_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 q.status in ('PENDING', 'ARRIVED', 'CHECKED')
         AND q.supplier_id = #{condition.supplierId}
@@ -177,47 +195,59 @@
             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 w.seq,wl.seq asc
+        <!-- ORDER BY q.arrive_time -->
+     </select>
 
-        ORDER BY q.arrive_time
-    </select>
-
-    <select id="statisticStationList" resultType="com.mzl.flower.dto.response.flower.StationStatisticDTO">
-        SELECT
-        s.station_id AS stationId,
-        st.`name`,
-        SUM( oi.num ) AS totalNum,
-        SUM(CASE WHEN  o.`status` = 'CHECKED'  THEN oi.num ELSE 0 END) AS checkedSupplierCount,
-        SUM(CASE WHEN  o.`status` = 'PENDING' or o.`status`= 'ARRIVED' THEN oi.num ELSE 0 END) AS uncheckedSupplierCount
-        FROM t_delivery_order o
-        LEFT JOIN t_delivery_order_item i ON o.id = i.delivery_id
-        LEFT JOIN t_order_item oi ON oi.id = i.order_item_id
-        LEFT JOIN t_supplier_info s ON s.id = o.supplier_id
-        LEFT JOIN t_station st ON st.id = s.station_id
-        LEFT JOIN t_order t ON t.id = i.order_id
-        WHERE o.deleted = 0
-        AND o.`status` IN ( 'PENDING', 'ARRIVED', 'CHECKED' )
-        <if test="userId !=null and userId !=''">
-            AND st.user_ids LIKE concat('%', #{userId},'%')
-        </if>
-        <if test="name !=null and name !=''">
-            AND ( s.id LIKE concat('%', #{name},'%')  OR
-            s.contact_tel LIKE concat('%', #{name},'%') OR
-            s.`name` LIKE concat('%', #{name},'%') OR
-            st.`name` LIKE concat('%', #{name},'%') OR
-            t.warehouse_location_code LIKE concat('%', #{name},'%')
-            )
-        </if>
+     <select id="statisticStationList" resultType="com.mzl.flower.dto.response.flower.StationStatisticDTO">
+         SELECT
+         s.station_id AS stationId,
+         st.`name`,
+         SUM( oi.num ) AS totalNum,
+         SUM(CASE WHEN  o.`status` = 'CHECKED'  THEN oi.num ELSE 0 END) AS checkedSupplierCount,
+         SUM(CASE WHEN  o.`status` = 'PENDING' or o.`status`= 'ARRIVED' THEN oi.num ELSE 0 END) AS uncheckedSupplierCount
+         FROM t_delivery_order o
+         LEFT JOIN t_delivery_order_item i ON o.id = i.delivery_id
+         LEFT JOIN t_order_item oi ON oi.id = i.order_item_id
+         LEFT JOIN t_supplier_info s ON s.id = o.supplier_id
+         LEFT JOIN t_station st ON st.id = s.station_id
+         LEFT JOIN t_order t ON t.id = i.order_id
+         WHERE o.deleted = 0
+         AND o.`status` IN ( 'PENDING', 'ARRIVED', 'CHECKED' )
+         <if test="userId !=null and userId !=''">
+             AND st.user_ids LIKE concat('%', #{userId},'%')
+         </if>
+         <if test="name !=null and name !=''">
+             AND ( s.id LIKE concat('%', #{name},'%')  OR
+             s.contact_tel LIKE concat('%', #{name},'%') OR
+             s.`name` LIKE concat('%', #{name},'%') OR
+             st.`name` LIKE concat('%', #{name},'%') OR
+             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