Browse Source

优化获取scada实时数据接口查询数据及报警相关情况

linzhiwei 2 years ago
parent
commit
cb7413c897
1 changed files with 3 additions and 7 deletions
  1. 3 7
      src/main/resources/mapper/ScadaDtuMapper.xml

+ 3 - 7
src/main/resources/mapper/ScadaDtuMapper.xml

@@ -39,14 +39,10 @@
         </collection>
     </resultMap>
     <select id="getRealData" resultMap="getRealDataMap">
-        <![CDATA[    select a.dtu_id,a.collect_time,a.update_time,a.field_mame,a.field_value, b.*,c.FIELD_SHORT_DESC,c.FIELD_UNIT,d.THRESHOLD_VALUE_MIN,d.THRESHOLD_VALUE_MAX,d.flag
+        <![CDATA[    select a.dtu_id,a.collect_time,a.update_time,a.field_name,a.field_value, b.*,c.FIELD_SHORT_DESC,c.FIELD_UNIT,d.THRESHOLD_VALUE_MIN,d.THRESHOLD_VALUE_MAX,d.flag
             from SCADA_DTU b
-            left join (select  dtu_id,collect_time,update_time,field_mame,field_value
-                    from  SCADA_DYU_DATA  data1
-                    where  update_time  =
-                    ( select   max (update_time)
-                    from  SCADA_DYU_DATA   data2
-                    where  data2.DTU_ID  =  data1.DTU_ID)
+            left join (select  dtu_id,collect_time,update_time,field_name,field_value
+                    from  SCADA_DYU_DATA_REAL
                     ) a on b.dtu_Id = a.dtu_id
             left join SCADA_DTU_PAR_MODEL c on c.DTU_ID = a.DTU_ID
             LEFT JOIN SCADA_CUSTOM_ALARM d on d.DTU_ID = a.DTU_ID