From eef8f98f76fdeb17c3d4a968c93b8b8351111905 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 06 Sep 2022 15:26:30 +0800
Subject: [PATCH] 20220902

---
 src/main/resources/mapper/modules/MallMemberMapper.xml |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/main/resources/mapper/modules/MallMemberMapper.xml b/src/main/resources/mapper/modules/MallMemberMapper.xml
index 973bf34..e3c1dd9 100644
--- a/src/main/resources/mapper/modules/MallMemberMapper.xml
+++ b/src/main/resources/mapper/modules/MallMemberMapper.xml
@@ -4,11 +4,12 @@
 
     <select id="selectMallMemberListInPage" resultType="cc.mrbird.febs.mall.entity.MallMember">
         SELECT m.*,a.name referrerName,IFNULL(c.balance,0) balance,IFNULL(c.score,0) score,IFNULL(c.prize_score,0) prizeScore,IFNULL(c.commission,0) commission
-        ,d.description levelName
+        ,d.description levelName,e.state leaderState
         FROM mall_member m
         left join mall_member a on m.referrer_id = a.invite_id
         LEFT JOIN mall_member_wallet c on c.member_id = m.id
         LEFT JOIN data_dictionary_custom d on d.code = m.level and type='AGENT_LEVEL'
+        LEFT JOIN mall_team_leader e on e.member_id = m.id
         <where>
             <if test="record != null" >
                 <if test="record.name!=null and record.name!=''">
@@ -33,7 +34,7 @@
                 </if>
             </if>
         </where>
-        order by m.CREATED_TIME desc
+        GROUP BY m.id order by m.CREATED_TIME desc
     </select>
 
     <select id="getMallMemberInfoById" resultType="cc.mrbird.febs.mall.vo.MallMemberVo">
@@ -84,12 +85,12 @@
             (select sum(e.amount)
              from mall_order_info e
                       inner join mall_member b on e.member_id=b.ID
-                      inner join mall_order_item c on e.id = c.order_id and c.is_normal=2
+                      inner join mall_order_item c on e.id = c.order_id -- and c.is_normal=2
              where e.status in (2, 3, 4) and e.order_type=1 and (b.invite_id=a.invite_id or b.referrer_id=a.invite_id)) amount,
             (select count(1) from mall_member e
                       inner join mall_order_info b on e.id=b.member_id and b.status in (2, 3, 4)
-             where e.invite_id=a.invite_id or e.referrer_id=a.invite_id) orderCnt,
-            (select count(1) from mall_member x where x.referrer_id=a.invite_id) cnt
+             where find_in_set(a.invite_id, e.referrer_ids)) orderCnt,
+            (select count(1) from mall_member x where find_in_set(a.invite_id, x.referrer_ids)) cnt
         from mall_member a
         inner join mall_member_wallet p on a.id=p.member_id
         left join data_dictionary_custom u on a.level=u.code and u.type='AGENT_LEVEL'
@@ -395,4 +396,16 @@
             </if>
         </where>
     </select>
+
+    <select id="selectMemberWithLevel" resultType="cc.mrbird.febs.mall.entity.MallMember">
+        select * from mall_member
+        where level=#{level}
+    </select>
+
+    <select id="selectMemberByOpenId" resultType="cc.mrbird.febs.mall.entity.MallMember">
+        SELECT a.*
+        FROM mall_member a
+        where a.open_id = #{openId} limit 1
+    </select>
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1