|
@@ -4,31 +4,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="currentMonthsTotal" resultType="com.kxs.user.api.vo.kxsapp.userLevel.AmountDetailVO">
|
|
<select id="currentMonthsTotal" resultType="com.kxs.user.api.vo.kxsapp.userLevel.AmountDetailVO">
|
|
|
- select IFNULL(sum(zlb.TradeAmount), 0) as zlb, IFNULL(gd.gdCount, 0) as gd, IFNULL(pos.posAmount + pos2.posAmount2,0) as pos
|
|
|
|
|
- from HelpProfitUserTradeSummay zlb
|
|
|
|
|
- left join (select sum(ActiveBuddyMerStatus) as gdCount, UserId
|
|
|
|
|
- from UserTradeMonthSummary
|
|
|
|
|
|
|
+
|
|
|
|
|
+ select sum(HelpNonDirectTradeAmt + HelpNonDirectDebitTradeAmt + NotHelpNonDirectTradeAmt +
|
|
|
|
|
+ NotHelpNonDirectDebitTradeAmt + ProfitNonDirectTradeAmt + ProfitNonDirectDebitTradeAmt) +
|
|
|
|
|
+ pos2.posAmount2 as posAmount,
|
|
|
|
|
+ IFNULL(gd.gdCount, 0) as gd,
|
|
|
|
|
+ IFNULL(zlb, 0) as zlb
|
|
|
|
|
+ from TradeDaySummary pos
|
|
|
|
|
+ left join (select sum(ProfitTradeAmt + ProfitDebitTradeAmt) as posAmount2, UserId
|
|
|
|
|
+ from TradeDaySummary2
|
|
|
where UserId = #{userId}
|
|
where UserId = #{userId}
|
|
|
and TradeMonth = #{queryMonth}
|
|
and TradeMonth = #{queryMonth}
|
|
|
and SeoTitle = 'team'
|
|
and SeoTitle = 'team'
|
|
|
- and BrandId = 14
|
|
|
|
|
- GROUP BY TradeMonth) gd on gd.UserId = zlb.UserId
|
|
|
|
|
- left join (select sum(HelpNonDirectTradeAmt +HelpNonDirectDebitTradeAmt +NotHelpNonDirectTradeAmt +NotHelpNonDirectDebitTradeAmt +ProfitNonDirectTradeAmt +ProfitNonDirectDebitTradeAmt ) as posAmount, UserId
|
|
|
|
|
- from TradeDaySummary
|
|
|
|
|
|
|
+ GROUP BY TradeMonth) pos2 on pos2.UserId = pos.UserId
|
|
|
|
|
+ left join (select sum(ActiveBuddyMerStatus) as gdCount, UserId
|
|
|
|
|
+ from UserTradeMonthSummary
|
|
|
where UserId = #{userId}
|
|
where UserId = #{userId}
|
|
|
and TradeMonth = #{queryMonth}
|
|
and TradeMonth = #{queryMonth}
|
|
|
and SeoTitle = 'team'
|
|
and SeoTitle = 'team'
|
|
|
- GROUP BY TradeMonth) pos on pos.UserId = zlb.UserId
|
|
|
|
|
- left join (select sum(ProfitTradeAmt + ProfitDebitTradeAmt) as posAmount2, UserId
|
|
|
|
|
- from TradeDaySummary2
|
|
|
|
|
|
|
+ and BrandId = 14
|
|
|
|
|
+ GROUP BY TradeMonth) gd on gd.UserId = pos.UserId
|
|
|
|
|
+
|
|
|
|
|
+ left join (select sum(TradeAmount) as zlb, UserId
|
|
|
|
|
+ from HelpProfitUserTradeSummay
|
|
|
where UserId = #{userId}
|
|
where UserId = #{userId}
|
|
|
and TradeMonth = #{queryMonth}
|
|
and TradeMonth = #{queryMonth}
|
|
|
and SeoTitle = 'team'
|
|
and SeoTitle = 'team'
|
|
|
- GROUP BY TradeMonth) pos2 on pos2.UserId = zlb.UserId
|
|
|
|
|
- where zlb.UserId = #{userId}
|
|
|
|
|
- and zlb.TradeMonth = #{queryMonth}
|
|
|
|
|
- and zlb.SeoTitle = 'team'
|
|
|
|
|
- group by zlb.TradeMonth
|
|
|
|
|
|
|
+ GROUP BY TradeMonth) zlb on zlb.UserId = pos.UserId
|
|
|
|
|
+ where pos.UserId = #{userId}
|
|
|
|
|
+ and pos.TradeMonth = #{queryMonth}
|
|
|
|
|
+ and pos.SeoTitle = 'team'
|
|
|
|
|
+ group by pos.TradeMonth
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
</mapper>
|
|
</mapper>
|