This commit is contained in:
sxu 2025-03-28 09:03:28 +08:00
parent feffac06b9
commit 5f84a89973
1 changed files with 8 additions and 20 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,16 +128,10 @@
LEFT JOIN sys_dept g on g.dept_id = a.org_id
<where>
AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
<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}, '')
and g.dept_id in
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
#{orgId}
</foreach>
)
</if>
<if test="'2'.toString() == authPO.roleType.toString()">
and EXISTS (
SELECT null
@ -288,16 +282,10 @@
LEFT JOIN sys_dept g on g.dept_id = a.org_id
<where>
AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
<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>
and g.dept_id in
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
#{orgId}
</foreach>
<if test="'2'.toString() == authPO.roleType.toString()">
and EXISTS (
SELECT null