From 0eb68e935e7a09fb2c20abb0276bdf4e4f554c5d Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 26 May 2021 14:40:58 +0800
Subject: [PATCH] modify

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

diff --git a/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml b/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
index d92a2c7..95a1dfc 100644
--- a/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
+++ b/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
@@ -1,7 +1,44 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!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="selectBondAmountByTradeIdAndMemberId" resultType="java.math.BigDecimal">
+		SELECT
+			b.bond_amount
+		FROM
+			follow_follower_order_relation a
+				LEFT JOIN contract_order b ON a.order_id = b.id
+		WHERE
+			a.member_id = #{memberId}
+		  AND a.trade_id = #{tradeId}
+		  AND a.order_type = 2
+		order by b.create_time desc
+	</select>
+
+	<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
 			*
@@ -102,7 +139,7 @@
 
 	<select id="selectFollowerCntByTradeMemberId" resultType="java.lang.Integer">
 		select count(1) from follow_follower_profit
-		where trade_member_id=#{tradeMemberId}
+		where trade_member_id=#{tradeMemberId} and is_follow = 1
 	</select>
 
 	<select id="selectAllFollowerProfit" resultType="java.math.BigDecimal">

--
Gitblit v1.9.1