parent
2d0adc8258
commit
e9403316d8
|
|
@ -115,7 +115,7 @@
|
||||||
) d LEFT JOIN (
|
) d LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
statistic_date,
|
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_num ) AS consume_num,
|
||||||
sum( consume_amount ) AS consume_amount,
|
sum( consume_amount ) AS consume_amount,
|
||||||
sum( consume_repair_num ) AS consume_repair_num,
|
sum( consume_repair_num ) AS consume_repair_num,
|
||||||
|
|
@ -128,10 +128,16 @@
|
||||||
LEFT JOIN sys_dept g on g.dept_id = a.org_id
|
LEFT JOIN sys_dept g on g.dept_id = a.org_id
|
||||||
<where>
|
<where>
|
||||||
AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
|
AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
|
||||||
and g.dept_id in
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
||||||
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
and (
|
||||||
#{orgId}
|
<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>
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<if test="'2'.toString() == authPO.roleType.toString()">
|
<if test="'2'.toString() == authPO.roleType.toString()">
|
||||||
and EXISTS (
|
and EXISTS (
|
||||||
SELECT null
|
SELECT null
|
||||||
|
|
@ -282,10 +288,16 @@
|
||||||
LEFT JOIN sys_dept g on g.dept_id = a.org_id
|
LEFT JOIN sys_dept g on g.dept_id = a.org_id
|
||||||
<where>
|
<where>
|
||||||
AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
|
AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
|
||||||
and g.dept_id in
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
||||||
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
and (
|
||||||
#{orgId}
|
<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>
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<if test="'2'.toString() == authPO.roleType.toString()">
|
<if test="'2'.toString() == authPO.roleType.toString()">
|
||||||
and EXISTS (
|
and EXISTS (
|
||||||
SELECT null
|
SELECT null
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue