Compare commits

..

No commits in common. "ca34461e7fb690589a79cf8d663d0140301118e5" and "f3dbb618902657e95ef3b9e2727098b0b5950dda" have entirely different histories.

1 changed files with 22 additions and 60 deletions

View File

@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
at2.actual_amount
end, 0)) as income,
SUM(IFNULL(CASE
WHEN at2.trade_type in (30, 100, 110, 120) then
WHEN at2.trade_type in (30, 100, 110) then
at2.actual_amount
end, 0)) as outcome
from
@ -128,21 +128,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserIncomeOutcome" resultType="com.bonus.canteen.core.report.domain.UserIncomeOutcomeVO">
SELECT
b.user_id,
c.user_id,
b.phonenumber,
b.dept_id,
b.dept_name,
b.dept_full_name,
b.nick_name,
c.wallet_bal_user as wallet_bal,
(b.income - b.outcome) as wallet_bal_now,
c.wallet_bal_user as wallet_bal_now,
b.income,
b.outcome,
(d.income - d.outcome) as last_wallet_bal
(c.wallet_bal_user + b.outcome - b.income) as last_wallet_bal
from
(
select
su.user_id,
at2.user_id,
su.nick_name,
su.phonenumber,
sd.dept_id,
@ -153,73 +153,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
at2.actual_amount
end, 0)) as income,
SUM(IFNULL(CASE
WHEN at2.trade_type in (30, 100, 110, 120) then
WHEN at2.trade_type in (30, 100, 110) then
at2.actual_amount
end, 0)) as outcome
from
sys_user su
left join acc_trade at2 on
acc_trade at2
left join sys_user su on
at2.user_id = su.user_id
left join sys_dept sd on
su.dept_id = sd.dept_id
where
at2.pay_state = 3
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
and su.dept_id in
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">
#{deptId}
</foreach>
</if>
and at2.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
and at2.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
and at2.pay_state = 3
left join sys_dept sd on
su.dept_id = sd.dept_id
where
1 = 1
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
and su.dept_id in
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">
#{deptId}
</foreach>
</if>
GROUP BY
su.user_id
at2.user_id
) b
left join
(
select
su.user_id,
su.nick_name,
su.phonenumber,
sd.dept_id,
sd.dept_name,
sd.dept_full_name,
SUM(IFNULL(CASE
WHEN at2.trade_type in (10, 20, 130) then
at2.actual_amount
end, 0)) as income,
SUM(IFNULL(CASE
WHEN at2.trade_type in (30, 100, 110, 120) then
at2.actual_amount
end, 0)) as outcome
from
sys_user su
left join acc_trade at2 on
at2.user_id = su.user_id
and at2.trade_time <![CDATA[ < ]]> #{param.startDateTime}
and at2.pay_state = 3
left join sys_dept sd on
su.dept_id = sd.dept_id
where
1 = 1
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
and su.dept_id in
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">
#{deptId}
</foreach>
</if>
GROUP BY
su.user_id
) d on b.user_id = d.user_id
left join
(
select
IFNULL(sum(a.wallet_bal), 0) as wallet_bal_user ,
su.user_id
from
sys_user su
left join
(
select
awi.user_id,
@ -228,7 +189,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
acc_wallet_info awi
group by
awi.user_id ) a
on a.user_id = su.user_id
left join sys_user su on
a.user_id = su.user_id
where
1 = 1
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
@ -249,6 +211,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or c.user_id like CONCAT('%',#{param.searchValue},'%')
)
</if>
order by outcome desc
order by c.user_id
</select>
</mapper>