From f3948fa31158c7b7dea3b038e01c43ce54c55a1c Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 14 Apr 2021 11:09:57 +0800
Subject: [PATCH] modify

---
 src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml |   48 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml b/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
index 4bc3f36..3a2147d 100644
--- a/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
+++ b/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
@@ -2,6 +2,41 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao">
 
+	<select id="selectSumRewardAmountByMemberId" resultType="java.math.BigDecimal">
+		SELECT
+			SUM(a.reward_amount)
+		FROM
+			contract_order a
+				LEFT JOIN follow_follower_order_relation b ON a.id = b.order_id
+		WHERE
+			a.member_id = #{memberId}
+		  AND b.order_type = 2
+			and b.trade_id = #{tradeId};
+	</select>
+
+	<select id="selectSumBondAmountBymemberId" resultType="java.math.BigDecimal">
+		SELECT
+			SUM(a.bond_amount)
+		FROM
+			contract_order a
+				LEFT JOIN follow_follower_order_relation b ON a.id = b.order_id
+		WHERE
+			a.member_id = #{memberId}
+		  AND b.order_type = 2
+		  and b.trade_id = #{tradeId};
+	</select>
+
+	<select id="selectByMemberIdandIsFollow" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity">
+		SELECT
+			*
+		FROM
+			follow_follower_profit 
+		WHERE 
+			member_id = #{id} 
+			and is_follow = #{isFollowY} 
+		order by create_time desc
+    </select>
+
 	<select id="selectFollowRecords" resultType="com.xcong.excoin.modules.documentary.vo.FollowRecordsVo">
 		SELECT
 			id,
@@ -49,7 +84,6 @@
 			member_id = #{memberId} 
 			and contract_type = 2
 			and order_type in (3,4)
-			and closing_type not in (4,5)
 		order by create_time desc
     </select>
 	<select id="getMyFollowOrderNowRecords" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
@@ -71,7 +105,6 @@
 		WHERE 
 			member_id = #{memberId} 
 			and contract_type = 2
-		order by opening_time desc
     </select>
     
 	<select id="selectDocumentaryOrderSetInfoBymemberIdAndTradeId" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity">
@@ -90,4 +123,15 @@
 		total_profit=total_profit+#{profit}
 		where trade_member_id=#{tradeMemberId} and member_id=#{memberId}
 	</update>
+
+	<select id="selectFollowerCntByTradeMemberId" resultType="java.lang.Integer">
+		select count(1) from follow_follower_profit
+		where trade_member_id=#{tradeMemberId} and is_follow = 1
+	</select>
+
+	<select id="selectAllFollowerProfit" resultType="java.math.BigDecimal">
+		select sum(total_profit)
+		from follow_follower_profit
+		where trade_member_id=#{tradeMemberId}
+	</select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1