dos 4 сар өмнө
parent
commit
bac640afa3

+ 36 - 10
game-business/src/main/resources/mapper/business/AppUserAgentMapper.xml

@@ -101,10 +101,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             a.user_id as userId,
             c.username as nickName,
             a.pid as pid,
-            (select IFNULL(sum(betting_amount),0) from app_game_betting as b where b.user_id = a.user_id) as bettingAmount,
-            (select IFNULL(sum(d.game_commission),0) from app_user_count as d where d.user_id = a.user_id) as gameCommission,
-            (select IFNULL(sum(d.live_commission),0) from app_user_count as d where d.user_id = a.user_id) as liveCommission,
-            (select IFNULL(sum(e.game_win_amount - e.game_lose_amount),0) from app_user_count as e where e.user_id = a.user_id) as gameAmount,
+            (
+                select IFNULL(sum(betting_amount),0) from app_game_betting as b where b.user_id = a.user_id
+                <if test="teamDto.beginTime != null and teamDto.beginTime != ''">
+                    and <![CDATA[ b.create_time >= concat(#{teamDto.beginTime},' 00:00:00') ]]>
+                </if>
+                <if test="teamDto.endTime != null and teamDto.endTime != ''">
+                    and <![CDATA[ b.create_time <= concat(#{teamDto.endTime},' 23:59:59') ]]>
+                </if>
+             ) as bettingAmount,
+            (
+                select IFNULL(sum(d.game_commission),0) from app_user_count as d where d.user_id = a.user_id
+                <if test="teamDto.beginTime != null and teamDto.beginTime != ''">
+                    and <![CDATA[ d.str_date >= #{teamDto.beginTime} ]]>
+                </if>
+                <if test="teamDto.endTime != null and teamDto.endTime != ''">
+                    and <![CDATA[ d.str_date <= #{teamDto.endTime} ]]>
+                </if>
+            ) as gameCommission,
+            (
+                select IFNULL(sum(f.live_commission),0) from app_user_count as f where f.user_id = a.user_id
+                    <if test="teamDto.beginTime != null and teamDto.beginTime != ''">
+                        and <![CDATA[ f.str_date >= #{teamDto.beginTime} ]]>
+                    </if>
+                    <if test="teamDto.endTime != null and teamDto.endTime != ''">
+                        and <![CDATA[ f.str_date <= #{teamDto.endTime} ]]>
+                    </if>
+            ) as liveCommission,
+            (
+                select IFNULL(sum(e.game_win_amount - e.game_lose_amount),0) from app_user_count as e where e.user_id = a.user_id
+                <if test="teamDto.beginTime != null and teamDto.beginTime != ''">
+                    and <![CDATA[ e.str_date >= #{teamDto.beginTime} ]]>
+                </if>
+                <if test="teamDto.endTime != null and teamDto.endTime != ''">
+                    and <![CDATA[ e.str_date <= #{teamDto.endTime} ]]>
+                </if>
+            ) as gameAmount,
             a.live_rate as liveRate,
             a.dividend_guarantee_rate as dividendGuaranteeRate
         from app_user_agent as a left join mugozbg_live.app_user as c on a.user_id = c.userid where (a.pid = #{teamDto.pid} or a.user_id = #{teamDto.pid})
@@ -114,12 +146,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="teamDto.nickName != null and teamDto.nickName != ''">
              and c.username = #{teamDto.nickName}
         </if>
-        <if test="teamDto.beginTime != null and teamDto.beginTime != ''">
-             and <![CDATA[ a.str_date >= #{teamDto.beginTime} ]]>
-        </if>
-        <if test="teamDto.endTime != null and teamDto.endTime != ''">
-             and <![CDATA[ a.str_date <= #{teamDto.endTime} ]]>
-        </if>
     </select>
 
     <select id="selectAllAgentList" resultMap="AppUserAgentResult">