Parcourir la source

修复查询bug

yangjingjing il y a 5 ans
Parent
commit
e471f5f6af

+ 25 - 3
febs-server/gbd-demp-info/src/main/resources/mapper/DeviceInfoMapper.xml

@@ -99,7 +99,7 @@
     </sql>
 
     <sql id="findClickInfoSql">
-        select
+        /*select
         tdi.device_id AS deviceId,
         tdi.company_name AS companyName,
         tdi.device_name AS monitorName,
@@ -120,6 +120,28 @@
         left join t_live_data tld on tld.sensor_id = tsv.sensor_id and tld.device_id=tsv.device_id
         left join t_code_alarm_rules tcar on tcar.code = tld.status
         left join t_alarm_event tae on tae.device_id=tsv.device_id and tae.sensor_id=tsv.sensor_id
+        where 1=1*/
+        select
+        tdi.device_id AS deviceId,
+        tdi.company_name AS companyName,
+        tdi.device_name AS monitorName,
+        '0' AS ifShow,
+        '' AS videoId,
+        tsv.sensor_id AS sensorId,
+        tsi.sensor_name AS name,
+        tsi.sensor_unit AS unit,
+        tcar.value AS detail,
+        tld.data_value AS value,
+        tcar.color AS color,
+        tvi.detail_name AS videoName,
+        tvi.puid AS videoCode
+        from t_live_data tld
+        left join t_sensor_video tsv on tld.sensor_id = tsv.sensor_id and tld.device_id=tsv.device_id
+        left join t_video_info tvi on tsv.video_id = tvi.id
+        left join t_sensor_info tsi on tld.sensor_id = tsi.sensor_id and tld.device_id=tsi.device_id
+        left join t_device_info tdi on tld.device_id = tdi.device_id
+        left join t_code_alarm_rules tcar on tcar.code = tld.status
+        left join t_alarm_event tae on tld.device_id=tae.device_id and tld.sensor_id=tae.sensor_id
         where 1=1
         <!--toto  -->
         <if test="companyId != null and companyId != ''">
@@ -134,7 +156,6 @@
     </sql>
 
 
-
     <select id="findAllDeviceInfoPage" resultMap="deviceInfo">
         <include refid="findDeviceInfoSql"/>
     </select>
@@ -149,7 +170,8 @@
 
     <!--  2. 监测企业点位信息 -->
     <select id="findAll" resultMap="deviceInfo">
-        select * from t_device_info
+        select *
+        from t_device_info
     </select>