|
|
@ -9,25 +9,79 @@ |
|
|
|
SELECT |
|
|
|
COALESCE((SELECT SUM(recharge_coin + free_coin + task_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE DATE(create_time) = CURDATE()), 0) AS differr, |
|
|
|
WHERE DATE(create_time) = CURDATE() |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS differr, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(free_6 + free_12 + core_jb + buy_jb) |
|
|
|
FROM user_gold), 0) AS sumgold, |
|
|
|
FROM user_gold |
|
|
|
left join user on user.jwcode = user_gold.jwcode |
|
|
|
<where> <if test="areas != null"> |
|
|
|
area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
</where>), 0) AS sumgold, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(buy_jb) |
|
|
|
FROM user_gold), 0) AS rechargegold, |
|
|
|
FROM user_gold |
|
|
|
left join user on user.jwcode = user_gold.jwcode |
|
|
|
<where> <if test="areas != null"> |
|
|
|
area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
</where>), 0) AS rechargegold, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(free_6) |
|
|
|
FROM user_gold), 0) AS sfreegold, |
|
|
|
FROM user_gold |
|
|
|
left join user on user.jwcode = user_gold.jwcode |
|
|
|
<where> <if test="areas != null"> |
|
|
|
area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
</where>), 0) AS sfreegold, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(free_12) |
|
|
|
FROM user_gold), 0) AS dfreegold, |
|
|
|
FROM user_gold |
|
|
|
left join user on user.jwcode = user_gold.jwcode |
|
|
|
<where> <if test="areas != null"> |
|
|
|
area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
</where>), 0) AS dfreegold, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(core_jb) |
|
|
|
FROM user_gold), 0) AS taskgold, |
|
|
|
FROM user_gold |
|
|
|
left join user on user.jwcode = user_gold.jwcode |
|
|
|
<where> <if test="areas != null"> |
|
|
|
area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
</where>), 0) AS taskgold, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(free_6) + SUM(free_12) |
|
|
|
FROM user_gold), 0) AS freegold; |
|
|
|
FROM user_gold |
|
|
|
left join user on user.jwcode = user_gold.jwcode |
|
|
|
<where> <if test="areas != null"> |
|
|
|
area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
</where>), 0) AS freegold; |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 第二个查询:getTwo --> |
|
|
@ -36,34 +90,76 @@ |
|
|
|
COALESCE((SELECT SUM(recharge_coin + free_coin + task_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE YEAR(create_time) = YEAR(CURDATE()) |
|
|
|
AND update_type = 0), 0) AS totalgold, |
|
|
|
AND update_type = 0 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS totalgold, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(recharge_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE YEAR(create_time) = YEAR(CURDATE()) |
|
|
|
AND update_type = 0), 0) AS totalcoin, |
|
|
|
AND update_type = 0 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS totalcoin, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(recharge_coin + free_coin + task_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) |
|
|
|
AND update_type = 0), 0) AS yesterdaytotal, |
|
|
|
AND update_type = 0 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS yesterdaytotal, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(recharge_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) |
|
|
|
AND update_type = 0), 0) AS yesterdayrecharge, |
|
|
|
AND update_type = 0 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS yesterdayrecharge, |
|
|
|
COALESCE((SELECT SUM(recharge_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE YEAR(create_time) = YEAR(CURDATE()) |
|
|
|
AND update_type = 0), 0) AS rechargegold, |
|
|
|
AND update_type = 0 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS rechargegold, |
|
|
|
COALESCE((SELECT SUM(free_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE YEAR(create_time) = YEAR(CURDATE()) |
|
|
|
AND update_type = 0), 0) AS freegold, |
|
|
|
AND update_type = 0 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS freegold, |
|
|
|
COALESCE((SELECT SUM(task_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE YEAR(create_time) = YEAR(CURDATE()) |
|
|
|
AND update_type = 0), 0) AS taskgold |
|
|
|
AND update_type = 0 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS taskgold |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 第三个查询:getThree --> |
|
|
@ -72,33 +168,75 @@ |
|
|
|
COALESCE((SELECT SUM(recharge_coin + free_coin + task_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE YEAR(create_time) = YEAR(CURDATE()) |
|
|
|
AND update_type = 1), 0) AS consumeGold, |
|
|
|
AND update_type = 1 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS consumeGold, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(recharge_coin + free_coin + task_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE YEAR(create_time) = YEAR(CURDATE()) |
|
|
|
AND update_type = 2), 0) AS refundcoin, |
|
|
|
AND update_type = 2 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS refundcoin, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(recharge_coin + free_coin + task_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) |
|
|
|
AND update_type = 1), 0) AS yesterdayGold, |
|
|
|
AND update_type = 1 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS yesterdayGold, |
|
|
|
|
|
|
|
COALESCE((SELECT SUM(recharge_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) |
|
|
|
AND update_type = 2), 0) AS yesterdayrefund, |
|
|
|
AND update_type = 2 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS yesterdayrefund, |
|
|
|
COALESCE((SELECT SUM(recharge_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE YEAR(create_time) = YEAR(CURDATE()) |
|
|
|
AND update_type = 1), 0) AS rechargegold, |
|
|
|
AND update_type = 1 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS rechargegold, |
|
|
|
COALESCE((SELECT SUM(task_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE YEAR(create_time) = YEAR(CURDATE()) |
|
|
|
AND update_type = 1), 0) AS taskgold, |
|
|
|
AND update_type = 1 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS taskgold, |
|
|
|
COALESCE((SELECT SUM(free_coin) |
|
|
|
FROM detail_y |
|
|
|
WHERE YEAR(create_time) = YEAR(CURDATE()) |
|
|
|
AND update_type = 1), 0) AS freegold |
|
|
|
AND update_type = 1 |
|
|
|
<if test="areas != null"> |
|
|
|
AND area IN |
|
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")"> |
|
|
|
#{areas} |
|
|
|
</foreach> |
|
|
|
</if>), 0) AS freegold |
|
|
|
</select> |
|
|
|
</mapper> |