From 7dc74a0c7bab3eb92ef9ca82401b6f0943960751 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 30 Jun 2020 11:48:47 +0800
Subject: [PATCH] modify

---
 src/main/resources/mapper/modules/MemberMapper.xml |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/src/main/resources/mapper/modules/MemberMapper.xml b/src/main/resources/mapper/modules/MemberMapper.xml
index 172a8f7..e745126 100644
--- a/src/main/resources/mapper/modules/MemberMapper.xml
+++ b/src/main/resources/mapper/modules/MemberMapper.xml
@@ -47,15 +47,40 @@
             a.referer_id,
             a.invite_id,
             concat(c.first_name, c.second_name) account,
-            sum(b.opening_fee_amount) openFeeAmount,
-            sum(b.closing_fee_amount) closeFeeAmount,
-            sum(b.hold_amount) holdFeeAmount,
-            sum(reward_amount) loseOrProfit
+            b.openFeeAmount openFeeAmount,
+            d.holdAmount closeFeeAmount,
+            d.closingFeeAmount holdFeeAmount,
+            d.rewardAmount loseOrProfit
         from member a
         inner join member_authentication c on a.id=c.member_id
-        inner join contract_order b on a.id=b.member_id and b.order_status=1
+        inner join (select member_id, sum(opening_fee_amount) openFeeAmount from contract_order where order_type in (1,2) and order_status=1 group by member_id) b on a.id=b.member_id
+        inner join (select
+                   member_id,
+                   sum(closing_fee_amount) closingFeeAmount,
+                   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)
         group by a.create_time,a.phone, a.email
         order by a.create_time desc
     </select>
+
+    <select id="selectMemberAssetsList" resultType="com.xcong.excoin.modules.agent.entity.MemberEntity">
+        select
+            CONCAT(e.first_name, e.second_name) account,
+            a.phone,
+            a.email,
+            a.invite_id,
+            a.referer_id,
+            b.total_balance contractTotal,
+            c.total_balance coinTotal,
+            d.total_balance agentTotal
+        from kss_framework.member a
+        left join member_wallet_contract 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)
+        order by a.create_time desc
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1