Browse Source

Merge remote-tracking branch 'origin/master'

wangyangyang 4 years ago
parent
commit
0e605717af

+ 5 - 7
sms_water/src/main/resources/mapper/DeviceMapper.xml

@@ -173,16 +173,12 @@
         ,t.MANUFACTURER_ID as "manufacturerId"
         ,t.DEVICE_TYPE as "deviceType"
         ,t.DEVICE_MODE as "deviceMode"
-        <if test="deviceDto.sceneId!= null and deviceDto.sceneId != 0 ">
-            ,s.PARENT_SCENE_ID as "parentSceneId"
-            ,s.SCENE_ID as "sceneId"
-        </if>
+        ,s.PARENT_SCENE_ID as "parentSceneId"
+        ,s.SCENE_ID as "sceneId"
         ,case when s.ID is null then 0 else 1 end as "isCheck"
         from sms_device d
         left join sms_device_type t on d.DEVICE_TYPE_ID = t.id
-        <if test="deviceDto.sceneId!= null and deviceDto.sceneId != 0 ">
-            inner join sms_device_scene s on s.DEVICE_ID=d.ID and s.SCENE_ID=#{deviceDto.sceneId} and s.status=1
-        </if>
+        left join sms_device_scene s on s.DEVICE_ID=d.ID and s.SCENE_ID=#{deviceDto.sceneId} and s.status=1
         where d.status = 1
         <if test="deviceDto.tenantId != null and deviceDto.tenantId != '' ">
             and d.tenant_id = #{deviceDto.tenantId}
@@ -328,11 +324,13 @@
         <if test="deviceDto.sceneId!= null and deviceDto.sceneId != 0 ">
         ,s.PARENT_SCENE_ID as "parentSceneId"
         ,s.SCENE_ID as "sceneId"
+        ,ss.SCENE_NAME as "sceneName"
         </if>
         from sms_device d
         left join sms_device_type t on d.DEVICE_TYPE_ID = t.id
         <if test="deviceDto.sceneId!= null and deviceDto.sceneId != 0 ">
             inner join sms_device_scene s on s.DEVICE_ID=d.ID and s.SCENE_ID=#{deviceDto.sceneId} and s.status=1
+            left join sms_scene ss on s.SCENE_ID=ss.id
         </if>
         where d.status = 1
         <if test="deviceDto.tenantId != null and deviceDto.tenantId != '' ">

+ 2 - 2
sms_water/src/main/resources/mapper/DeviceParmMapper.xml

@@ -223,14 +223,14 @@
             select a.id as "deviceId",b.id as "attributeId",b.`NAME` as "attributeName"
             ,case when p.ID is null then 0 else 1 end as "isCheck"
             from sms_device a
-            inner join sms_device_attribute b on a.DEVICE_TYPE_ID= b.DEVICE_TYPE_ID
+            inner join sms_device_attribute b on a.DEVICE_TYPE_ID= b.DEVICE_TYPE_ID  and b.`STATUS` =1
             left join sms_device_parm p on p.DEVICE_ID=a.ID and p.ATTRIBUTE_ID=b.ID and p.`STATUS`=1 and p.SCENE_ID=#{info.sceneId}
             where a.id=#{info.deviceId}
         <if test="info.sceneIds != null and info.sceneIds.size() > 0">
             and b.id not in (
                   select d.ATTRIBUTE_ID
                      from sms_device_parm d
-                  where d.scene_id in
+                  where  d.`STATUS` =1 and d.scene_id in
                <foreach collection="info.sceneIds" item="dramaId" open="(" close=")" separator=",">
                    #{dramaId}
                </foreach>

+ 16 - 16
sms_water/src/main/resources/mapper/MonitorDataReportMapper.xml

@@ -41,7 +41,7 @@
         LEFT JOIN sms_device_attribute da ON da.id = r.ATTRIBUTE_ID
         LEFT JOIN sms_device d ON d.id = r.DEVICE_ID
         left join sms_scene s on s.id=p.PARENT_SCENE_ID
-        where p.IS_CHART = 1 and p.`STATUS`= 1
+        where p.IS_CHART = 1 and p.`STATUS`= 1 and d.ENABLE_STATE = 1
             and p.PARENT_SCENE_ID=#{sceneId}
             and r.year=#{year}
             and r.month=#{month}
@@ -95,7 +95,7 @@
         LEFT JOIN sms_device_attribute da ON da.id = r.ATTRIBUTE_ID
         LEFT JOIN sms_device d ON d.id = r.DEVICE_ID
         left join sms_scene s on s.id=p.PARENT_SCENE_ID
-        where p.IS_CHART = 1 and p.`STATUS`= 1
+        where p.IS_CHART = 1 and p.`STATUS`= 1 and d.ENABLE_STATE = 1
         and p.PARENT_SCENE_ID=#{sceneId}
         and r.year=#{year}
         and r.month=#{month}
@@ -147,7 +147,7 @@
         LEFT JOIN sms_device_attribute da ON da.id = r.ATTRIBUTE_ID
         LEFT JOIN sms_device d ON d.id = r.DEVICE_ID
         left join sms_scene s on s.id=p.PARENT_SCENE_ID
-        where p.IS_CHART = 1 and p.`STATUS`= 1
+        where p.IS_CHART = 1 and p.`STATUS`= 1 and d.ENABLE_STATE = 1
         and p.PARENT_SCENE_ID=#{sceneId}
         and r.year=#{year}
         <if test="tenantId != null and tenantId != '' ">
@@ -200,10 +200,10 @@
         left join sms_scene s on s.id=p.parent_scene_id
         left join sms_device_attribute  da ON da.id = p.ATTRIBUTE_ID
         LEFT JOIN sms_device d ON d.id = r.DEVICE_ID
-        WHERE p.`STATUS`= 1 and p.parm_type in (3,5)
+        WHERE p.`STATUS`= 1 and p.parm_type in (3,5) and d.ENABLE_STATE = 1
             AND r.YEAR = #{year}  and r.month=#{month}  and r.day=#{day}
             <if test="sceneIds != null and sceneIds.size()>0">
-                and r.PARENT_SCENE_ID in
+                and p.PARENT_SCENE_ID in
                 <foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
@@ -256,10 +256,10 @@
         left join sms_scene s on s.id=p.parent_scene_id
         left join sms_device_attribute  da ON da.id = p.ATTRIBUTE_ID
         LEFT JOIN sms_device d ON d.id = r.DEVICE_ID
-        WHERE p.`STATUS`= 1 and p.parm_type in (3,5)
+        WHERE p.`STATUS`= 1 and p.parm_type in (3,5) and d.ENABLE_STATE = 1
         AND r.YEAR = #{year}  and r.month=#{month}
         <if test="sceneIds != null and sceneIds.size()>0">
-            and r.PARENT_SCENE_ID in
+            and p.PARENT_SCENE_ID in
             <foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
@@ -312,10 +312,10 @@
         left join sms_scene s on s.id=p.parent_scene_id
         left join sms_device_attribute  da ON da.id = p.ATTRIBUTE_ID
         LEFT JOIN sms_device d ON d.id = r.DEVICE_ID
-        WHERE p.`STATUS`= 1 and p.parm_type in (3,5)
+        WHERE p.`STATUS`= 1 and p.parm_type in (3,5) and d.ENABLE_STATE = 1
         AND r.YEAR = #{year}
         <if test="sceneIds != null and sceneIds.size()>0">
-            and r.PARENT_SCENE_ID in
+            and p.PARENT_SCENE_ID in
             <foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
@@ -370,10 +370,10 @@
         left join sms_scene s on s.id=p.parent_scene_id
         left join sms_device_attribute  da ON da.id = p.ATTRIBUTE_ID
         LEFT JOIN sms_device d ON d.id = r.DEVICE_ID
-        WHERE p.`STATUS`= 1 and p.parm_type in (8,11,10)
+        WHERE p.`STATUS`= 1 and p.parm_type in (8,11,10) and d.ENABLE_STATE = 1
         AND r.YEAR = #{year}  and r.month=#{month}  and r.day=#{day}
         <if test="sceneIds != null and sceneIds.size()>0">
-            and r.PARENT_SCENE_ID in
+            and p.PARENT_SCENE_ID in
             <foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
@@ -426,10 +426,10 @@
         left join sms_scene s on s.id=p.parent_scene_id
         left join sms_device_attribute  da ON da.id = p.ATTRIBUTE_ID
         LEFT JOIN sms_device d ON d.id = r.DEVICE_ID
-        WHERE p.`STATUS`= 1 and p.parm_type in (8,11,10)
+        WHERE p.`STATUS`= 1 and p.parm_type in (8,11,10) and d.ENABLE_STATE = 1
         AND r.YEAR = #{year}  and r.month=#{month}
         <if test="sceneIds != null and sceneIds.size()>0">
-            and r.PARENT_SCENE_ID in
+            and p.PARENT_SCENE_ID in
             <foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
@@ -483,9 +483,9 @@
         left join sms_device_attribute  da ON da.id = p.ATTRIBUTE_ID
         LEFT JOIN sms_device d ON d.id = r.DEVICE_ID
         WHERE p.`STATUS`= 1 and p.parm_type in (8,11,10)
-        AND r.YEAR = #{year}
+        AND r.YEAR = #{year} and d.ENABLE_STATE = 1
         <if test="sceneIds != null and sceneIds.size()>0">
-            and r.PARENT_SCENE_ID in
+            and p.PARENT_SCENE_ID in
             <foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
@@ -551,7 +551,7 @@
             from sms_alarm_details ad
             left join sms_device d on ad.DEVICE_ID=d.ID
 
-            where ad.ALARM_START_TIME &lt; #{endDate} and ad.ALARM_START_TIME >= #{beginDate}
+            where ad.ALARM_START_TIME &lt; #{endDate} and ad.ALARM_START_TIME >= #{beginDate} and d.ENABLE_STATE = 1
             <if test="sceneIds != null and sceneIds.size()>0">
                 and ad.parent_scene_id  in
                 <foreach collection="sceneIds" item="item" open="(" close=")" separator=",">