Revert "bug 5452"

This reverts commit 5f84a89973.
This commit is contained in:
sxu 2025-03-28 10:37:11 +08:00
parent 2d0adc8258
commit e9403316d8
1 changed files with 20 additions and 8 deletions

View File

@ -115,7 +115,7 @@
) d LEFT JOIN (
SELECT
statistic_date,
-- CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(concat(g.ancestors, ','),',', #{param.orgLevel} + 1), ',', -1) as SIGNED) as a_org_id,
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(concat(g.ancestors, ','),',', #{param.orgLevel} + 1), ',', -1) as SIGNED) as a_org_id,
sum( consume_num ) AS consume_num,
sum( consume_amount ) AS consume_amount,
sum( consume_repair_num ) AS consume_repair_num,
@ -128,10 +128,16 @@
LEFT JOIN sys_dept g on g.dept_id = a.org_id
<where>
AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
and g.dept_id in
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
#{orgId}
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
and (
<foreach collection="param.orgIdList" item="orgId" separator=" or " open=""
close="">
g.ancestors like concat('', #{orgId}, ',%')
or g.ancestors like concat('%,', #{orgId}, ',%')
or g.ancestors like concat('%,', #{orgId}, '')
</foreach>
)
</if>
<if test="'2'.toString() == authPO.roleType.toString()">
and EXISTS (
SELECT null
@ -282,10 +288,16 @@
LEFT JOIN sys_dept g on g.dept_id = a.org_id
<where>
AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
and g.dept_id in
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
#{orgId}
</foreach>
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
and (
<foreach collection="param.orgIdList" item="orgId" separator=" or " open=""
close="">
g.ancestors like concat('', #{orgId}, ',%')
or g.ancestors like concat('%,', #{orgId}, ',%')
or g.ancestors like concat('%,', #{orgId}, '')
</foreach>
)
</if>
<if test="'2'.toString() == authPO.roleType.toString()">
and EXISTS (
SELECT null