后台-充值-成功订单包含已退款订单

This commit is contained in:
khalil
2023-10-12 14:40:50 +08:00
parent d69b1837de
commit 3ef422b6c5
16 changed files with 65 additions and 64 deletions

View File

@@ -34,7 +34,7 @@
</if>
group by fm.create_time, team_id, fi.invite_code) a, users u, charge_record r
where a.invite_code = u.invite_code
and u.uid = r.uid and r.charge_status = 2
and u.uid = r.uid and r.charge_status in (2,6)
and r.charge_prod_id != 'exchange'
<if test="onlyQueryOld != null and onlyQueryOld">
and date_format(r.create_time, '%Y-%m') &lt; date_format(current_timestamp, '%Y-%m')
@@ -54,7 +54,7 @@
</if>
group by fm.create_time, team_id, fi.invite_code) a, users u , charge_record r
where a.invite_code = u.invite_code
and u.uid = r.uid and r.charge_status = 2 and r.charge_prod_id != 'exchange'
and u.uid = r.uid and r.charge_status in (2,6) and r.charge_prod_id != 'exchange'
<if test="onlyQueryOld != null and onlyQueryOld">
and date_format(r.create_time, '%Y-%m') &lt; date_format(current_timestamp, '%Y-%m')
</if>
@@ -79,7 +79,7 @@
and team_id = #{teamId}
group by fm.create_time, team_id, fi.invite_code) a, users u , charge_record r, users u2
where a.invite_code = u.invite_code
and u.uid = r.uid and r.charge_status = 2 and r.charge_prod_id != 'exchange'
and u.uid = r.uid and r.charge_status in (2,6) and r.charge_prod_id != 'exchange'
and u2.uid = u.invite_uid
and date_format(r.create_time, '%Y-%m') = #{month}
<if test="erbanNo != null and erbanNo != ''">
@@ -116,7 +116,7 @@
flow_team_member_invite_user fi, users u, charge_record r
where fi.uid = r.uid
and u.uid = r.uid
and r.charge_status = 2
and r.charge_status in (2,6)
and r.charge_prod_id != 'exchange'
and r.buss_type in (0,4)
and date_format(r.create_time, '%Y-%m') = date_format(u.create_time, '%Y-%m')
@@ -133,7 +133,7 @@
0 newUserChargeAmount, ifnull(sum(r.amount/100), 0) totalChargeAmount,
count(distinct r.uid) totalChargeUserNum, count(r.charge_record_id) totalChargeNum
from flow_team_member_invite_user fi , charge_record r
where fi.uid = r.uid and r.charge_status = 2 and r.charge_prod_id != 'exchange'
where fi.uid = r.uid and r.charge_status in (2,6) and r.charge_prod_id != 'exchange'
and r.buss_type in (0,4)
<if test="queryLimitTime != null">
and r.create_time >= #{queryLimitTime}
@@ -161,7 +161,7 @@
from
charge_record r, flow_team_member fm, flow_team_member_invite_user fu
left join users u on fu.uid = u.uid
where fu.uid = r.uid and r.charge_status = 2 and r.charge_prod_id != 'exchange'
where fu.uid = r.uid and r.charge_status in (2,6) and r.charge_prod_id != 'exchange'
and fm.member_id = fu.member_id
<if test="teamIds != null and teamIds.size > 0">
and fu.team_id in
@@ -190,7 +190,7 @@
#{teamId}
</foreach>
</if>
and r.charge_status = 2 and r.charge_prod_id != 'exchange' and r.buss_type in (0,4)
and r.charge_status in (2,6) and r.charge_prod_id != 'exchange' and r.buss_type in (0,4)
and date_format(r.create_time, '%Y-%m') = #{month}
<if test="queryLimitTime != null and queryLimitTime != ''">
and u.create_time >= #{queryLimitTime}

View File

@@ -11,18 +11,18 @@
(cr2.amount / 100) as firstChargeAmount,
dgh1.first_give_time as firstGiveTime,
(dgh2.diamond_num / 1000) as diamondAmount,
((select sum(cr.amount) from charge_record as cr where cr.uid = u.uid and cr.charge_status = 2 and
((select sum(cr.amount) from charge_record as cr where cr.uid = u.uid and cr.charge_status in (2,6) and
cr.create_time between u.create_time and now()) / 100) as totalChargeAmount,
((select sum(dgh.diamond_num) from diamond_give_history as dgh where dgh.to_uid = u.uid and dgh.create_time
between u.create_time and now()) / 1000) as totalDiamondAmount
from users as u
inner join account as a on a.uid = u.uid
left join (
select cr.uid, min(cr.create_time) as first_charge_time from charge_record as cr where cr.charge_status = 2
select cr.uid, min(cr.create_time) as first_charge_time from charge_record as cr where cr.charge_status in (2,6)
group by cr.uid
) as cr1 on cr1.uid = u.uid
left join charge_record as cr2 on cr2.uid = cr1.uid and cr2.create_time = cr1.first_charge_time and
cr2.charge_status = 2
cr2.charge_status in (2,6)
left join (
select dgh.to_uid, min(dgh.create_time) as first_give_time from diamond_give_history as dgh group by dgh.to_uid
) as dgh1 on dgh1.to_uid = u.uid