WUE趋势查询逻辑
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=0fbfa60e280ccbd7ecf3fa3efd1431a9&amp;file=file.png" alt="" /></p>
<pre><code> -- 筛选有水的园区
SELECT DISTINCT dor.*
FROM dp_organization dor
INNER JOIN dp_park_water dpw on dor.id = dpw.org_id
where
dpw.water_sum &gt; 0
and find_in_set(#{parentId}, dor.path_code) &gt; 0
and dor.is_valid = 'Y'
-- 再查询改园区下所有机房的IT用电量
SELECT
sum(electricity_sum) electricity_sum,
sum(electricity_it) electricity_it
FROM dp_room_electricity t1
LEFT JOIN dp_room_info t2 on t1.org_id = t2.org_id
LEFT JOIN dp_organization t3 on t1.org_id = t3.id
AND t2.site_type = #{siteType}
AND t1.account_date = #{accountDate}
and FIND_IN_SET(#{orgId},t3.path_code)
AND t1.account_date &gt;= #{startTime}
AND t1.account_date &lt;= #{endTime}
and t3.is_valid = 'Y'
-- 查询生产用水、节水量
SELECT
SUM(water_sum) water_sum,
SUM(water_save) water_save
FROM dp_park_water t1
LEFT JOIN dp_organization t2 on t1.org_id = t2.id
AND t1.site_type = #{siteType}
AND t1.account_date = #{accountDate}
and FIND_IN_SET(#{orgId}, t2.path_code)
and t1.account_date &gt;= #{startTime}
and t1.account_date &lt;= #{endTime}
and t2.is_valid = 'Y'
</code></pre>