薪资操作账单fixed

This commit is contained in:
2025-07-25 16:57:01 +08:00
parent 184208ed18
commit a2a3881bf5

View File

@@ -15,8 +15,8 @@
resultType="com.accompany.business.vo.guild.GuildUsdAccountCycleUsdStatVo">
select *, `totalIncome` - `settledIncome` `remainingIncome` from
(select r.cycle_date `cycleDate`,
sum(case when type in (1, 6, 8) or (type = 4 and target_guild_member_id = #{memberId}) then abs(operate_usd) else 0 end) `totalIncome`,
sum(case when type in (2, 5, 3) or (type = 4 and guild_member_id = #{memberId}) then abs(operate_usd) else 0 end) `settledIncome`
sum(case when type in (1, 6, 8, 10) or (type = 4 and target_guild_member_id = #{memberId}) then abs(operate_usd) else 0 end) `totalIncome`,
sum(case when type in (2, 5, 3, 9) or (type = 4 and guild_member_id = #{memberId}) then abs(operate_usd) else 0 end) `settledIncome`
from guild_usd_bill_record r
where (r.guild_member_id = #{memberId} or r.target_guild_member_id = #{memberId})
and r.cycle_date in <foreach collection="cycleDateList" item="cycleDate" open="(" separator="," close=")">#{cycleDate}</foreach>
@@ -102,7 +102,7 @@
sum(IF( FIND_IN_SET( type, 3), operate_usd, 0 )) usbToAgent,
sum(IF( FIND_IN_SET( type, 4), operate_usd, 0 )) usbToOwner,
sum(IF( FIND_IN_SET( type, 5) or FIND_IN_SET(type, 7) or FIND_IN_SET( type, 8), operate_usd, 0 )) officialWithdram,
sum(IF( FIND_IN_SET( type, 9,10), operate_usd, 0 )) platformOperationUsb
sum(IF( FIND_IN_SET( type, '9, 10'), operate_usd, 0 )) platformOperationUsb
from guild_usd_bill_record r
where r.cycle_date = #{dateCycle}
<if test="hallId != null">
@@ -143,7 +143,7 @@
sum(IF( FIND_IN_SET( type, 3), operate_usd, 0 )) usbToAgent,
sum(IF( FIND_IN_SET( type, 4), operate_usd, 0 )) usbToOwner,
sum(IF( FIND_IN_SET( type, 5) or FIND_IN_SET(type, 7) or FIND_IN_SET( type, 8), operate_usd, 0 )) officialWithdram,
sum(IF( FIND_IN_SET( type, 9,10), operate_usd, 0 )) platformOperationUsb
sum(IF( FIND_IN_SET( type, '9, 10'), operate_usd, 0 )) platformOperationUsb
from guild_usd_bill_record
where cycle_date = #{dateCycle}
group by uid ,guild_id) a ON hm.uid = a.uid AND hm.guild_id = a.guild_id