From fc1e6566611aa9f4311272aeb0e2da1d03d6c9bd Mon Sep 17 00:00:00 2001
From: 于紫祥_1901 <email@yuzixiang_1910>
Date: Wed, 18 Nov 2020 11:30:42 +0800
Subject: [PATCH] 风场更新

---
 src/main/resources/mapper/SensorMapper.xml |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/SensorMapper.xml b/src/main/resources/mapper/SensorMapper.xml
index b50c240..74a078e 100644
--- a/src/main/resources/mapper/SensorMapper.xml
+++ b/src/main/resources/mapper/SensorMapper.xml
@@ -137,6 +137,15 @@
 		AND d.id = #{id}
 	</select>
 
+    <select id="getSensorByDId" resultType="java.util.Map">
+		SELECT DISTINCT d.monitor_point_id,s.*
+		FROM device d,device_version dv,device_version_sensor dvs,sensor s
+		WHERE d.device_version_id = dvs.device_version_id
+		AND dvs.sensor_id = s.id
+		AND d.id = #{id}
+	</select>
+
+
     <select id="getSensorByMonitorPointId" resultType="java.util.Map">
 		SELECT DISTINCT s.sensor_key sensorKey,s.unit,s.name,s.description,s.id
 		FROM device d,device_version dv,device_version_sensor dvs,sensor s
@@ -174,4 +183,35 @@
             AND d.mac = #{mac}
         </if>
     </select>
+
+    <select id="selectSenosrsByOrgId" resultMap="BaseResultMap">
+        select
+        distinct dvs.sensor_id as id,
+        s.name,s.sensor_key,s.unit,s.description
+        from
+        device_version_sensor dvs,
+        sensor s
+        where
+        dvs.device_version_id
+        in(
+        select
+        distinct d.device_version_id
+        from
+        device d
+        where
+        d.mac in
+        <foreach collection="macs" open="(" separator="," close=")"
+                 item="mac">
+            #{mac}
+        </foreach>
+        )
+        and dvs.sensor_id=s.id
+    </select>
+
+    <select id="getSensorKeys" resultType="java.lang.String">
+        select
+        sensor_key
+        from
+        sensor
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0