From 5476f8bcf411ce654c02fbd34b9086518adbd917 Mon Sep 17 00:00:00 2001
From: 于紫祥_1901 <email@yuzixiang_1910>
Date: Thu, 10 Sep 2020 14:25:41 +0800
Subject: [PATCH] 三天数据对比

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

diff --git a/src/main/resources/mapper/SensorUnitMapper.xml b/src/main/resources/mapper/SensorUnitMapper.xml
index a24a98f..03d19ab 100644
--- a/src/main/resources/mapper/SensorUnitMapper.xml
+++ b/src/main/resources/mapper/SensorUnitMapper.xml
@@ -35,4 +35,28 @@
 	AND su.is_delete=0
 	AND mp.id = #{id}
   </select>
+	<select id="getSensorUnitByDeviceMac" resultType="java.util.Map">
+		SELECT
+			su.* ,
+			s.sensor_key 
+		FROM
+			device d,
+			sensor_unit su,
+			organization_sensor_unit osu,
+			monitor_point mp,
+			device_version_sensor dvs,
+			sensor s 
+		WHERE
+			d.monitor_point_id = mp.id 
+			AND su.is_delete = '0'
+			AND mp.organization_id = osu.organization_id 
+			AND osu.sensor_unit_id = su.id 
+			AND su.sensor_id = s.id 
+			AND d.device_version_id = dvs.device_version_id 
+			AND su.sensor_id = dvs.sensor_id 
+			AND d.mac = #{mac}
+			<if test="sensorKey != null">
+				AND s.sensor_key = #{sensorKey}
+			</if>
+	</select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0