From fc1f912905287cd1ff9f81207f05f158301f7563 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 15 Jun 2022 19:05:17 +0800
Subject: [PATCH] fix some problem

---
 src/main/resources/mapper/modules/MallOrderInfoMapper.xml |   35 +++++++++++++++++++++++++++--------
 1 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/src/main/resources/mapper/modules/MallOrderInfoMapper.xml b/src/main/resources/mapper/modules/MallOrderInfoMapper.xml
index 9964fe6..00a6577 100644
--- a/src/main/resources/mapper/modules/MallOrderInfoMapper.xml
+++ b/src/main/resources/mapper/modules/MallOrderInfoMapper.xml
@@ -232,7 +232,7 @@
             and member_id=#{memberId}
         </if>
         <if test="date != null">
-            and date_format(a.receving_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
+            and date_format(a.receiving_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
         </if>
     </select>
 
@@ -240,22 +240,41 @@
         select IFNULL(sum(IFNULL(b.amount,0) - IFNULL(b.cost_price*b.cnt, 0)),0)
         from mall_order_info a
         inner join mall_order_item b on a.id=b.order_id
-        where a.status in (2, 3, 4) and a.is_normal = 2 and a.order_type=1
+        where a.order_type=1
+        <if test="isNormal == 2">
+            and a.status in (2, 3, 4) and b.is_normal = 2 and b.has_settle=1
+        </if>
+        <if test="isNormal == 1">
+            and a.status=4 and b.is_normal = 1 and b.has_settle=1
+        </if>
         <if test="member != null">
             and member_id=#{memberId}
         </if>
-        <if test="date != null and type == 'D'">
-            and date_format(a.receving_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
+        <if test='date != null and dateType == "D"'>
+            and date_format(a.pay_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
         </if>
-        <if test="date != null and type == 'M'">
-            and date_format(a.receving_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
+        <if test='date != null and dateType == "M"'>
+            and date_format(a.pay_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
         </if>
-        <if test="date != null and type == 'Y'">
-            and date_format(a.receving_time, '%Y') = date_format(#{date}, '%Y')
+        <if test='date != null and dateType == "Y"'>
+            and date_format(a.pay_time, '%Y') = date_format(#{date}, '%Y')
         </if>
     </select>
 
     <select id="selectByOrderNo" resultType="cc.mrbird.febs.mall.entity.MallOrderInfo">
         select * from mall_order_info where order_no=#{orderNo}
     </select>
+
+    <update id="updateOrderConfirmStatus">
+        update mall_order_info
+        set status=4,
+            receiving_time=new Date()
+        where status=3 and date_format(pay_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
+    </update>
+
+    <select id="selectOrderInfoWithNormalGoods" resultMap="OrderInfoMap">
+        select * from mall_order_info a
+        inner join mall_order_item b on a.id=b.order_id and b.is_normal=1
+        where date_format(pay_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1