From 3e55e48e000d22334364bcd9dfc6445e9631c70f Mon Sep 17 00:00:00 2001
From: Hentua <wangdoubleone@gmail.com>
Date: Sun, 26 Nov 2023 22:21:18 +0800
Subject: [PATCH] blnka

---
 src/main/resources/mapper/modules/MallOrderInfoMapper.xml |   55 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/src/main/resources/mapper/modules/MallOrderInfoMapper.xml b/src/main/resources/mapper/modules/MallOrderInfoMapper.xml
index 657a430..aae0174 100644
--- a/src/main/resources/mapper/modules/MallOrderInfoMapper.xml
+++ b/src/main/resources/mapper/modules/MallOrderInfoMapper.xml
@@ -56,9 +56,10 @@
         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
+        inner join mall_member b on a.member_id = b.id
         <where>
             <if test="record != null">
                 <if test="record.payResult != null and record.payResult != ''">
@@ -151,6 +152,8 @@
             <result property="price" column="price" />
             <result property="amount" column="amount" />
             <result property="isNormal" column="is_normal" />
+            <result property="memberInviteId" column="member_invite_id" />
+            <result property="memberCouponId" column="member_coupon_id" />
             <result property="state" column="state" />
         </collection>
     </resultMap>
@@ -199,6 +202,8 @@
             b.cnt,
             b.price,
             b.amount,
+            b.member_invite_id,
+            b.member_coupon_id,
             b.is_normal
         from mall_order_info a
              inner join mall_order_item b on a.id=b.order_id
@@ -423,20 +428,34 @@
     </select>
 
     <select id="getGoodsStatisticsInPage" resultType="cc.mrbird.febs.mall.vo.AdminGoodsStatisticsVo">
-    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
+            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