From 8a57b3a0ee3fa70e8d43eb12865f1c27d0d385d8 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期三, 01 四月 2020 14:55:58 +0800
Subject: [PATCH] Merge branch 'div-1' into div

---
 fanli/src/main/java/com/yeshi/fanli/mapping/order/OrderTeamRewardMapper.xml |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/order/OrderTeamRewardMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/order/OrderTeamRewardMapper.xml
index b6fcf61..941f27e 100644
--- a/fanli/src/main/java/com/yeshi/fanli/mapping/order/OrderTeamRewardMapper.xml
+++ b/fanli/src/main/java/com/yeshi/fanli/mapping/order/OrderTeamRewardMapper.xml
@@ -158,5 +158,37 @@
 	<select id="countCanSettleUid" resultType="java.lang.Long"
 		parameterType="java.util.Date">SELECT COUNT(*) FROM ( SELECT t.otr_uid FROM
 		yeshi_ec_order_team_reward t WHERE t.otr_state=1 AND
-		#{0}&gt;t.otr_pre_get_time GROUP BY t.otr_uid) a</select>
+		#{0}&gt;t.otr_pre_get_time GROUP BY t.otr_uid) a
+	</select>
+		
+	<select id="sumValidMoneyByUidAndDate" resultType="BigDecimal">
+		SELECT SUM(d.`otr_money`) FROM yeshi_ec_order_team_reward d
+		WHERE d.`otr_uid` = #{uid} AND (d.`otr_state` = 1 OR d.`otr_state` = 3)
+		<if test="level != null">
+			AND d.otr_level = #{level}
+		</if>
+		<if test="day == 1"> <!-- 浠婂ぉ -->
+			AND TO_DAYS(d.`otr_valid_time`) = TO_DAYS(NOW())
+		</if>
+		<if test="day == 2"> <!-- 鏄ㄥぉ -->
+			AND TO_DAYS(NOW()) - TO_DAYS(d.`otr_valid_time`) = 1
+		</if>
+		<if test="day == 3"> <!-- 鏈湀 -->
+			AND DATE_FORMAT(d.`otr_valid_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')
+		</if>
+		<if test="day == 4"> <!-- 涓婃湀 -->
+			AND PERIOD_DIFF(DATE_FORMAT(NOW(),'%Y%m'),DATE_FORMAT(d.`otr_valid_time`, '%Y%m')) = 1
+		</if>
+	</select>	
+		
+		
+	<select id="sumRecievedMoneyByUid" resultType="BigDecimal">
+		SELECT SUM(d.`otr_money`) FROM yeshi_ec_order_team_reward d
+		WHERE d.`otr_uid` = #{uid} AND d.`otr_state` = 3
+		<if test="level != null">
+			AND d.otr_level = #{level}
+		</if>
+	</select>	
+		
+		
 </mapper>

--
Gitblit v1.8.0