From 790ed3c2799b395cc2b51c7c070c8a73cd9203a1 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 11 Sep 2023 17:43:47 +0800
Subject: [PATCH] 优惠卷

---
 src/main/resources/mapper/modules/MallOrderInfoMapper.xml |   49 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/src/main/resources/mapper/modules/MallOrderInfoMapper.xml b/src/main/resources/mapper/modules/MallOrderInfoMapper.xml
index 1ac65c9..7fb0231 100644
--- a/src/main/resources/mapper/modules/MallOrderInfoMapper.xml
+++ b/src/main/resources/mapper/modules/MallOrderInfoMapper.xml
@@ -56,7 +56,8 @@
         select a.*,
                b.name memberName,
                b.bind_phone memberBindPhone,
-               b.phone memberPhone
+               b.phone memberPhone,
+               (select member.name from mall_member member where member.invite_id = b.referrer_id) refererName
         from mall_order_info a
         left join mall_member b on a.member_id = b.id
         <where>
@@ -412,6 +413,7 @@
         select
         a.*,
         b.goods_name,
+        b.sku_name,
         b.cnt,
         b.price,
         b.amount
@@ -422,19 +424,34 @@
     </select>
 
     <select id="getGoodsStatisticsInPage" resultType="cc.mrbird.febs.mall.vo.AdminGoodsStatisticsVo">
-    select
-        goods_name goodsName,
-        SUM(cnt) goodsCnt
-    from mall_order_item
-    <where>
-        <if test="record.orderIdsStr != null">
-            and order_id in
-                <foreach collection="record.orderIdsStr" item="id" index="index" open="(" close=")" separator=",">
-                    #{id}
-                </foreach>
-        </if>
-    </where>
-        GROUP BY goods_id
-        ORDER BY goods_id desc
-</select>
+        select
+            goods_name goodsName,
+            SUM(cnt) goodsCnt
+        from mall_order_item
+        <where>
+        1=1
+            <if test="record.orderIdsStr != null">
+                and order_id in
+                    <foreach collection="record.orderIdsStr" item="id" index="index" open="(" close=")" separator=",">
+                        #{id}
+                    </foreach>
+            </if>
+        </where>
+            GROUP BY goods_id
+            ORDER BY goods_id desc
+    </select>
+
+    <select id="selectAmountOrTeamAmount" resultType="java.math.BigDecimal">
+        select IFNULL(sum(IFNULL(a.amount,0)),0) from mall_order_info a
+        inner join mall_member b on a.member_id=b.ID
+        <where>
+            a.status in (2,3,4)
+            <if test="type == 1">
+                and b.invite_id=#{inviteId}
+            </if>
+            <if test="type == 2">
+                and find_in_set(#{inviteId}, b.referrer_ids)
+            </if>
+        </where>
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1