From af085dd2fdea97c66ed9520f31754e1025d9dc02 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期二, 10 十二月 2024 16:06:58 +0800
Subject: [PATCH] 582-在售商品可以直接进行删除,需要进行优化,在售商品删除提示无法删除,需要先进行下架再进行删除

---
 src/main/resources/mapper/payment/OrderMapper.xml |   61 ++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/src/main/resources/mapper/payment/OrderMapper.xml b/src/main/resources/mapper/payment/OrderMapper.xml
index 6142cf6..66cd365 100644
--- a/src/main/resources/mapper/payment/OrderMapper.xml
+++ b/src/main/resources/mapper/payment/OrderMapper.xml
@@ -7,6 +7,7 @@
         where status_backend = 'SEND' and partner_id is not null
     </update>
 
+
     <select id="getPartnerOrderReceive" resultType="com.mzl.flower.entity.payment.Order">
         select * from t_order t where status_backend = 'SEND' and partner_id is not null
     </select>
@@ -14,6 +15,7 @@
     <select id="getOrderStatusCount" resultType="com.mzl.flower.dto.response.payment.OrderStatusCountDTO">
         SELECT q.status_backend value, count(1) orderCount
         FROM t_order q
+        left join t_user u on q.create_by = u.id
         WHERE q.deleted = 0
         <if test="condition.orderNo != null and condition.orderNo != ''">
             AND q.order_no LIKE concat('%', #{condition.orderNo},'%')
@@ -51,7 +53,7 @@
             AND q.payment_time &gt;= #{condition.createStartDate}
         </if>
         <if test="condition.createEndDate != null">
-            AND q.payment_time &lt;= #{condition.createEndDate}
+            AND q.payment_time &lt; #{condition.createEndDate}
         </if>
         <if test="condition.partnerId != null">
             AND q.partner_id = #{condition.partnerId}
@@ -63,9 +65,10 @@
             AND exists(
                 select 1 from t_order_item oi
                 where oi.order_id = q.id
-                and oi.status = 'reduce'
+                and (oi.status = 'reduce' or oi.status = 'abnormal')
             )
             and q.transfer_id is null
+            and q.status in ('COLLECTION', 'SEND')
         </if>
         <if test="condition.billId != null and condition.billId != ''">
             AND q.bill_id = #{condition.billId}
@@ -76,6 +79,22 @@
                 where oi.order_id = q.id
                 and oi.flower_name LIKE concat('%', #{condition.flowerName},'%')
             )
+        </if>
+
+        <if test="condition.warehouseLocationCode != null and condition.warehouseLocationCode != ''">
+            AND q.warehouse_location_code LIKE concat('%', #{condition.warehouseLocationCode},'%')
+        </if>
+        <if test="condition.createName != null and condition.createName != ''">
+            AND u.nick_name LIKE concat('%', #{condition.createName},'%')
+        </if>
+        <if test="condition.province != null and condition.province != ''">
+            AND q.customer_province LIKE concat('%', #{condition.province},'%')
+        </if>
+        <if test="condition.city != null and condition.city != ''">
+            AND q.customer_city LIKE concat('%', #{condition.city},'%')
+        </if>
+        <if test="condition.region != null and condition.region != ''">
+            AND q.customer_region LIKE concat('%', #{condition.region},'%')
         </if>
         GROUP BY q.status_backend
     </select>
@@ -92,6 +111,15 @@
         WHERE q.deleted = 0
         <if test="condition.orderNo != null and condition.orderNo != ''">
             AND q.order_no LIKE concat('%', #{condition.orderNo},'%')
+        </if>
+        <if test="condition.province != null and condition.province != ''">
+            AND q.customer_province LIKE concat('%', #{condition.province},'%')
+        </if>
+        <if test="condition.city != null and condition.city != ''">
+            AND q.customer_city LIKE concat('%', #{condition.city},'%')
+        </if>
+        <if test="condition.region != null and condition.region != ''">
+            AND q.customer_region LIKE concat('%', #{condition.region},'%')
         </if>
         <if test="condition.customerAddress != null and condition.customerAddress != ''">
             AND q.customer_address LIKE concat('%', #{condition.customerAddress},'%')
@@ -131,7 +159,7 @@
             AND q.payment_time  &gt;= #{condition.createStartDate}
         </if>
         <if test="condition.createEndDate != null">
-            AND q.payment_time &lt;= #{condition.createEndDate}
+            AND q.payment_time &lt; #{condition.createEndDate}
         </if>
         <if test="condition.partnerId != null">
             AND q.partner_id = #{condition.partnerId}
@@ -160,6 +188,9 @@
         </if>
         <if test="condition.warehouseLocationCode != null and condition.warehouseLocationCode != ''">
             AND q.warehouse_location_code LIKE concat('%', #{condition.warehouseLocationCode},'%')
+        </if>
+        <if test="condition.createName != null and condition.createName != ''">
+            AND u.nick_name LIKE concat('%', #{condition.createName},'%')
         </if>
 
         ORDER BY q.create_time desc, q.payment_time desc
@@ -193,7 +224,7 @@
             AND q.payment_time &gt;= #{condition.createStartDate}
         </if>
         <if test="condition.createEndDate != null">
-            AND q.payment_time &lt;= #{condition.createEndDate}
+            AND q.payment_time &lt; #{condition.createEndDate}
         </if>
 <!--        <if test="condition.createStartDate != null">-->
 <!--            AND q.create_time &gt;= #{condition.createStartDate}-->
@@ -331,7 +362,7 @@
             AND q.payment_time &gt;= #{condition.startDate}
         </if>
         <if test="condition.endDate != null">
-            AND q.payment_time &lt;= #{condition.endDate}
+            AND q.payment_time &lt; #{condition.endDate}
         </if>
         <if test="condition.createStartDate != null">
             AND q.create_time &gt;= #{condition.createStartDate}
@@ -382,4 +413,24 @@
             and o.create_time &lt;= #{endTime}
         </if>
     </select>
+
+<!--    获取所有的订单数据,以及时间数据-->
+    <select id="selectAllDateList" resultType="com.mzl.flower.entity.payment.Order">
+        SELECT t.id,t.payment_time,
+               CASE
+                   WHEN t.payment_time > DATE(t.payment_time) + INTERVAL 17 HOUR THEN DATE(t.payment_time) + INTERVAL 1 DAY
+                   ELSE DATE(t.payment_time)
+                   END AS payment_date,
+               t.create_time,
+               CASE
+                   WHEN t.create_time > DATE(t.create_time) + INTERVAL 17 HOUR THEN DATE(t.create_time) + INTERVAL 1 DAY
+                   ELSE DATE(t.create_time)
+                   END AS create_date
+        FROM t_order t
+        order by t.create_time desc
+    </select>
+
+    <update id="updatePaymentCreateDate">
+        update t_order  set payment_date_sta=#{order.paymentDate}, create_date_sta=#{order.createDate} where id=#{order.id}
+    </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3