结算记录新增累计转赠字段
This commit is contained in:
@@ -101,7 +101,9 @@
|
|||||||
sum(a.totalChargeUserNum) as totalChargeUserNum,
|
sum(a.totalChargeUserNum) as totalChargeUserNum,
|
||||||
sum(a.totalChargeNum) as totalChargeNum,
|
sum(a.totalChargeNum) as totalChargeNum,
|
||||||
sum(a.totalGiveNum) as totalGiveNum,
|
sum(a.totalGiveNum) as totalGiveNum,
|
||||||
sum(a.totalGiveAmount) as totalGiveAmount
|
sum(a.totalGiveAmount) as totalGiveAmount,
|
||||||
|
sum(a.totalGiveUserNum) as totalGiveUserNum,
|
||||||
|
sum(a.newUserGiveAmount) as newUserGiveAmount
|
||||||
from (
|
from (
|
||||||
select
|
select
|
||||||
date_format(u.create_time, '%Y-%m') as `month`,
|
date_format(u.create_time, '%Y-%m') as `month`,
|
||||||
@@ -111,7 +113,9 @@
|
|||||||
0 as totalChargeUserNum,
|
0 as totalChargeUserNum,
|
||||||
0 as totalChargeNum,
|
0 as totalChargeNum,
|
||||||
0 as totalGiveNum,
|
0 as totalGiveNum,
|
||||||
0 as totalGiveAmount
|
0 as totalGiveAmount,
|
||||||
|
0 as totalGiveUserNum,
|
||||||
|
0 as newUserGiveAmount
|
||||||
from flow_team_member_invite_user as fm, users as u
|
from flow_team_member_invite_user as fm, users as u
|
||||||
where fm.uid = u.uid
|
where fm.uid = u.uid
|
||||||
<if test="teamIds != null and teamIds.size > 0">
|
<if test="teamIds != null and teamIds.size > 0">
|
||||||
@@ -130,7 +134,9 @@
|
|||||||
0 as totalChargeUserNum,
|
0 as totalChargeUserNum,
|
||||||
0 as totalChargeNum,
|
0 as totalChargeNum,
|
||||||
0 as totalGiveNum,
|
0 as totalGiveNum,
|
||||||
0 as totalGiveAmount
|
0 as totalGiveAmount,
|
||||||
|
0 as totalGiveUserNum,
|
||||||
|
0 as newUserGiveAmount
|
||||||
from
|
from
|
||||||
flow_team_member_invite_user as fi, users as u, charge_record as r
|
flow_team_member_invite_user as fi, users as u, charge_record as r
|
||||||
where fi.uid = r.uid
|
where fi.uid = r.uid
|
||||||
@@ -155,7 +161,9 @@
|
|||||||
count(distinct r.uid) as totalChargeUserNum,
|
count(distinct r.uid) as totalChargeUserNum,
|
||||||
count(r.charge_record_id) as totalChargeNum,
|
count(r.charge_record_id) as totalChargeNum,
|
||||||
0 as totalGiveNum,
|
0 as totalGiveNum,
|
||||||
0 as totalGiveAmount
|
0 as totalGiveAmount,
|
||||||
|
0 as totalGiveUserNum,
|
||||||
|
0 as newUserGiveAmount
|
||||||
from flow_team_member_invite_user as fi, charge_record as r
|
from flow_team_member_invite_user as fi, charge_record as r
|
||||||
where fi.uid = r.uid
|
where fi.uid = r.uid
|
||||||
and r.charge_status in (2,6)
|
and r.charge_status in (2,6)
|
||||||
@@ -180,7 +188,9 @@
|
|||||||
0 as totalChargeUserNum,
|
0 as totalChargeUserNum,
|
||||||
0 as totalChargeNum,
|
0 as totalChargeNum,
|
||||||
count(1) as totalGiveNum,
|
count(1) as totalGiveNum,
|
||||||
ifnull(sum(dgh.diamond_num / 1000), 0) as totalGiveAmount
|
ifnull(sum(dgh.diamond_num / 1000), 0) as totalGiveAmount,
|
||||||
|
count(distinct dgh.to_uid) as totalGiveUserNum,
|
||||||
|
0 as newUserGiveAmount
|
||||||
from flow_team_member_invite_user as fi
|
from flow_team_member_invite_user as fi
|
||||||
inner join diamond_give_history as dgh on dgh.to_uid = fi.uid
|
inner join diamond_give_history as dgh on dgh.to_uid = fi.uid
|
||||||
where dgh.diamond_num > 0
|
where dgh.diamond_num > 0
|
||||||
@@ -194,6 +204,33 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
group by `month`, fi.team_id
|
group by `month`, fi.team_id
|
||||||
|
union
|
||||||
|
select
|
||||||
|
date_format(dgh.create_time, '%Y-%m') as `month`,
|
||||||
|
0 as newUserNum,
|
||||||
|
0 as newUserChargeAmount,
|
||||||
|
0 as totalChargeAmount,
|
||||||
|
0 as totalChargeUserNum,
|
||||||
|
0 as totalChargeNum,
|
||||||
|
0 as totalGiveNum,
|
||||||
|
0 as totalGiveAmount,
|
||||||
|
0 as totalGiveUserNum,
|
||||||
|
ifnull(sum(dgh.diamond_num / 1000), 0) as newUserGiveAmount
|
||||||
|
from flow_team_member_invite_user as fi
|
||||||
|
inner join users as u on u.uid = fi.uid
|
||||||
|
inner join diamond_give_history as dgh on dgh.to_uid = fi.uid
|
||||||
|
where dgh.diamond_num > 0
|
||||||
|
and date_format(dgh.create_time, '%Y-%m') = date_format(u.create_time, '%Y-%m')
|
||||||
|
<if test="queryLimitTime != null">
|
||||||
|
and dgh.create_time >= #{queryLimitTime}
|
||||||
|
</if>
|
||||||
|
<if test="teamIds != null and teamIds.size > 0">
|
||||||
|
and fi.team_id in
|
||||||
|
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
|
||||||
|
#{teamId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
group by `month`, fi.team_id
|
||||||
) as a
|
) as a
|
||||||
group by a.`month`
|
group by a.`month`
|
||||||
<if test="month != null and month != ''">
|
<if test="month != null and month != ''">
|
||||||
|
Reference in New Issue
Block a user