selectPayDetails app sql查询缩小查询范围

This commit is contained in:
张松
2025-01-02 19:51:24 +08:00
parent 5e4aaf78ce
commit eac53e57b0
6 changed files with 18 additions and 14 deletions

View File

@@ -48,16 +48,20 @@
<select id="selectCashOutPage" resultType="com.sqx.modules.pay.entity.CashOut">
SELECT c.*,
ifnull(u.user_name,"用户不存在") as userName,
s.username as sysUserName,
ifnull(t.total,0.00) as total,
ifnull(t.count,0) as count,
ifnull(t1.total,0.00) as verifyTotal,
ifnull(t1.count,0) as verifyCount
s.username as sysUserName
<if test="isApp == false">
,ifnull(t.total,0.00) as total,
ifnull(t.count,0) as count,
ifnull(t1.total,0.00) as verifyTotal,
ifnull(t1.count,0) as verifyCount
</if>
FROM cash_out c
left join tb_user u on c.user_id = u.user_id
left join sys_user s on s.user_id= c.sys_user_id
left join (select user_id,ROUND(sum(money),2) as total,count(*) as count from cash_out where state = 1 GROUP BY user_id) t on c.user_id = t.user_id
left join (select user_id,ROUND(sum(money),2) as total,count(*) as count from cash_out where state = 3 GROUP BY user_id) t1 on c.user_id = t1.user_id
<if test="isApp == false">
left join (select user_id,ROUND(sum(money),2) as total,count(*) as count from cash_out where state = 1 GROUP BY user_id) t on c.user_id = t.user_id
left join (select user_id,ROUND(sum(money),2) as total,count(*) as count from cash_out where state = 3 GROUP BY user_id) t1 on c.user_id = t1.user_id
</if>
<where>
<if test="cashOut.userName!=null and cashOut.userName!=''">
and u.user_name like concat("%",#{cashOut.userName},"%")