From d4488a987cccd3ddd51a202a9f8aa71d3cdcbced Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 23 Apr 2021 17:12:16 +0800
Subject: [PATCH] 20210423

---
 src/main/resources/mapper/modules/MemberMapper.xml |   50 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/src/main/resources/mapper/modules/MemberMapper.xml b/src/main/resources/mapper/modules/MemberMapper.xml
index e745126..b8e1133 100644
--- a/src/main/resources/mapper/modules/MemberMapper.xml
+++ b/src/main/resources/mapper/modules/MemberMapper.xml
@@ -4,29 +4,39 @@
 
 
     <select id="selectMemberListInPage" resultType="com.xcong.excoin.modules.agent.entity.MemberEntity">
-        select * from member
+        select
+            a.*,
+            CONCAT(e.first_name, e.second_name) account,
+            b.total_balance contractTotal,
+            c.available_balance coinTotal,
+            d.total_balance agentTotal
+        from member a
+        left join (select member_id, sum(total_balance) total_balance from member_wallet_contract group by member_id) b on a.id=b.member_id
+        left join member_wallet_coin c on a.id=c.member_id and c.wallet_code='USDT'
+        left join member_wallet_agent d on a.id=d.member_id
+        left join member_authentication e on a.id=e.member_id
         <where>
             <if test="record != null">
                 <if test="record.inviteId !=null and record.inviteId!=''">
-                    and find_in_set(#{record.inviteId}, referer_ids)
+                    and find_in_set(#{record.inviteId}, a.referer_ids)
                 </if>
                 <if test="record.startTime!=null">
-                    and create_time >=#{record.startTime}
+                    and a.create_time >=#{record.startTime}
                 </if>
                 <if test="record.endTime!=null">
-                    and #{record.endTime} >= create_time
+                    and #{record.endTime} >= a.create_time
                 </if>
                 <if test="record.account!=null and record.account!=''">
-                    and (phone = #{record.account} or email = #{record.account} or invite_id=#{record.account})
+                    and (a.phone = #{record.account} or a.email = #{record.account} or a.invite_id=#{record.account})
                 </if>
-                <if test="record.accountStatus!=null">
-                    and account_status = #{record.accountStatus}
+                <if test="record.accountStatus!=null and record.accountStatus!=''  or record.accountStatus == 0" >
+                    and a.account_status = #{record.accountStatus}
                 </if>
                 <if test="record.accountType != null">
-                    and account_type = #{record.accountType}
+                    and a.account_type = #{record.accountType}
                 </if>
                 <if test="record.certifyStatus != null">
-                    and certify_status = #{record.certifyStatus}
+                    and a.certify_status = #{record.certifyStatus}
                 </if>
             </if>
         </where>
@@ -60,7 +70,13 @@
                    sum(hold_amount) holdAmount,
                    sum(reward_amount) rewardAmount
             from contract_order where order_type in (3,4) and order_status=1 group by member_id) d on a.id=d.member_id
-        where find_in_set(#{record.refererId}, a.referer_ids)
+        where find_in_set(#{record.refererIds}, a.referer_ids)
+        <if test="record.account!=null and record.account!=''">
+            and (a.phone=#{record.account} or a.email=#{record.account} or a.invite_id=#{record.account})
+        </if>
+        <if test="record.refererId!=null and record.refererId!=''">
+            and a.referer_id=#{record.refererId}
+        </if>
         group by a.create_time,a.phone, a.email
         order by a.create_time desc
     </select>
@@ -73,14 +89,20 @@
             a.invite_id,
             a.referer_id,
             b.total_balance contractTotal,
-            c.total_balance coinTotal,
+            c.available_balance coinTotal,
             d.total_balance agentTotal
-        from kss_framework.member a
-        left join member_wallet_contract b on a.id=b.member_id
+        from member a
+        left join (select member_id, sum(total_balance) total_balance from member_wallet_contract group by member_id) b on a.id=b.member_id
         left join member_wallet_coin c on a.id=c.member_id and c.wallet_code='USDT'
         left join member_wallet_agent d on a.id=d.member_id
         left join member_authentication e on a.id=e.member_id
-        where find_in_set(#{record.refererId}, a.referer_ids)
+        where find_in_set(#{record.refererIds}, a.referer_ids)
+        <if test="record.account!=null and record.account!=''">
+            and (a.phone=#{record.account} or a.email=#{record.account} or a.invite_id=#{record.account})
+        </if>
+        <if test="record.refererId!=null and record.refererId!=''">
+            and a.referer_id=#{record.refererId}
+        </if>
         order by a.create_time desc
     </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1