|
|
@ -114,38 +114,25 @@ |
|
|
</foreach> |
|
|
</foreach> |
|
|
AND current_datetime BETWEEN #{startDate} AND #{endDate} |
|
|
AND current_datetime BETWEEN #{startDate} AND #{endDate} |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="listPart1All" resultType="com.example.demo.domain.entity.Statistics"> |
|
|
<select id="listPart1All" resultType="com.example.demo.domain.entity.Statistics"> |
|
|
SELECT |
|
|
SELECT |
|
|
m.name as market, |
|
|
m.name as market, |
|
|
#{today} AS current_datetime, |
|
|
#{today} AS current_datetime, |
|
|
COALESCE(SUM(current_permanent_gold),0) + |
|
|
|
|
|
COALESCE(SUM(current_free_june),0) + |
|
|
|
|
|
COALESCE(SUM(current_free_december),0) + |
|
|
|
|
|
COALESCE(SUM(current_task_gold),0) AS current_gold, |
|
|
|
|
|
|
|
|
|
|
|
COALESCE(SUM(current_permanent_gold),0) AS current_permanent, |
|
|
|
|
|
COALESCE(SUM(current_free_june),0) AS current_free_june, |
|
|
|
|
|
COALESCE(SUM(current_free_december),0) AS current_free_december, |
|
|
|
|
|
COALESCE(SUM(current_task_gold),0) AS current_task, |
|
|
|
|
|
-- 与昨天差值(从 statistics 表取) |
|
|
|
|
|
( |
|
|
|
|
|
COALESCE(SUM(u.current_permanent_gold),0) + |
|
|
|
|
|
COALESCE(SUM(u.current_free_june),0) + |
|
|
|
|
|
COALESCE(SUM(u.current_free_december),0) + |
|
|
|
|
|
COALESCE(SUM(u.current_task_gold),0) |
|
|
|
|
|
) - COALESCE( |
|
|
|
|
|
( |
|
|
|
|
|
SELECT s.current_gold |
|
|
|
|
|
FROM statistics s |
|
|
|
|
|
WHERE s.market = m.name |
|
|
|
|
|
AND s.current_datetime = DATE_SUB(#{today}, INTERVAL 1 DAY) |
|
|
|
|
|
LIMIT 1 |
|
|
|
|
|
), 0 |
|
|
|
|
|
) AS daily_change |
|
|
|
|
|
|
|
|
COALESCE(SUM(u.current_permanent_gold + u.current_free_june + u.current_free_december + u.current_task_gold), 0) |
|
|
|
|
|
AS current_gold, |
|
|
|
|
|
COALESCE(SUM(u.current_permanent_gold), 0) AS current_permanent, |
|
|
|
|
|
COALESCE(SUM(u.current_free_june), 0) AS current_free_june, |
|
|
|
|
|
COALESCE(SUM(u.current_free_december), 0) AS current_free_december, |
|
|
|
|
|
COALESCE(SUM(u.current_task_gold), 0) AS current_task, |
|
|
|
|
|
COALESCE(SUM(u.current_permanent_gold + u.current_free_june + u.current_free_december + u.current_task_gold), 0) |
|
|
|
|
|
- COALESCE(s.current_gold, 0) AS daily_change |
|
|
FROM user u |
|
|
FROM user u |
|
|
left join market m on u.market=m.id |
|
|
|
|
|
where m.name IS NOT NULL |
|
|
|
|
|
GROUP BY market |
|
|
|
|
|
|
|
|
INNER JOIN market m ON u.market = m.id |
|
|
|
|
|
INNER JOIN statistics s ON s.market = m.name |
|
|
|
|
|
AND s.current_datetime = DATE_SUB(#{today}, INTERVAL 1 DAY) |
|
|
|
|
|
WHERE m.name IS NOT NULL |
|
|
|
|
|
GROUP BY m.name |
|
|
</select> |
|
|
</select> |
|
|
<select id="listPart2All" resultType="com.example.demo.domain.entity.Statistics"> |
|
|
<select id="listPart2All" resultType="com.example.demo.domain.entity.Statistics"> |
|
|
SELECT |
|
|
SELECT |
|
|
@ -166,7 +153,7 @@ |
|
|
AND u.first_recharge BETWEEN #{start} AND #{end} THEN ugr.jwcode END) AS first_recharge |
|
|
AND u.first_recharge BETWEEN #{start} AND #{end} THEN ugr.jwcode END) AS first_recharge |
|
|
FROM user_gold_record ugr |
|
|
FROM user_gold_record ugr |
|
|
JOIN user u ON ugr.jwcode = u.jwcode |
|
|
JOIN user u ON ugr.jwcode = u.jwcode |
|
|
left join market m on u.market=m.id |
|
|
|
|
|
|
|
|
inner join market m on u.market=m.id |
|
|
WHERE ugr.audit_status IN (1,3) |
|
|
WHERE ugr.audit_status IN (1,3) |
|
|
AND ugr.flag = 1 |
|
|
AND ugr.flag = 1 |
|
|
AND ugr.create_time BETWEEN #{start} AND #{end} |
|
|
AND ugr.create_time BETWEEN #{start} AND #{end} |
|
|
@ -183,7 +170,7 @@ |
|
|
COALESCE(SUM(s.refund_permanent+s.refund_free_june+s.refund_free_december+s.refund_task),0) AS yearly_refund, |
|
|
COALESCE(SUM(s.refund_permanent+s.refund_free_june+s.refund_free_december+s.refund_task),0) AS yearly_refund, |
|
|
COALESCE(SUM(s.recharge_num),0) AS yearly_recharge_num |
|
|
COALESCE(SUM(s.recharge_num),0) AS yearly_recharge_num |
|
|
FROM statistics s |
|
|
FROM statistics s |
|
|
left join market m on s.market=m.id |
|
|
|
|
|
|
|
|
inner join market m on s.market=m.id |
|
|
WHERE current_datetime BETWEEN #{yearStart} AND #{end} AND m.name IS NOT NULL |
|
|
WHERE current_datetime BETWEEN #{yearStart} AND #{end} AND m.name IS NOT NULL |
|
|
GROUP BY market |
|
|
GROUP BY market |
|
|
</select> |
|
|
</select> |
|
|
@ -218,7 +205,7 @@ |
|
|
JOIN user_gold_record ugr |
|
|
JOIN user_gold_record ugr |
|
|
ON ugr.create_time between d.date_start AND d.date_end |
|
|
ON ugr.create_time between d.date_start AND d.date_end |
|
|
JOIN user u ON ugr.jwcode = u.jwcode |
|
|
JOIN user u ON ugr.jwcode = u.jwcode |
|
|
left join market m on u.market=m.id |
|
|
|
|
|
|
|
|
inner join market m on u.market=m.id |
|
|
WHERE ugr.audit_status IN (1,3) |
|
|
WHERE ugr.audit_status IN (1,3) |
|
|
AND ugr.flag = 1 |
|
|
AND ugr.flag = 1 |
|
|
AND m.name IS NOT NULL |
|
|
AND m.name IS NOT NULL |
|
|
|