|
@@ -144,7 +144,7 @@
|
|
|
left join sc_building sb on(sb.id = sd.building_id)
|
|
|
left join sc_device_type sdt1 on(sdt1.id = sd.device_type_id)
|
|
|
left join sc_device_manufacturer sdm1 on(sdm1.id = sdt1.manufacturer_id)
|
|
|
- left join sc_grid_management sgm on(sgm.device_id = sd.id)
|
|
|
+ left join sc_grid_management sgm on(sgm.device_id = sd.id and sgm.status = 1)
|
|
|
where swl.status = 1 and sd.status = 1 and sgm.status = 1
|
|
|
<if test="siteId != null"> and sd.site_id = #{siteId}</if>
|
|
|
<if test="deviceId != null"> and sd.id = #{deviceId}</if>
|
|
@@ -184,7 +184,7 @@
|
|
|
select sd.building_id,count(1) as device_count
|
|
|
from sc_warning_log swl
|
|
|
left join sc_device sd on(sd.id = swl.device_id)
|
|
|
- left join sc_grid_management sgm on(sgm.device_id = sd.id)
|
|
|
+ left join sc_grid_management sgm on(sgm.device_id = sd.id and sgm.status = 1)
|
|
|
where swl.status = 1 and sd.status = 1 and sgm.status = 1
|
|
|
<if test="siteId != null"> and sd.site_id = #{siteId}</if>
|
|
|
<if test="userId != null"> and sgm.user_id = #{userId}</if>
|