From c0d88c1f82394c0374d2d592f4d2bca951d6334e Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Mon, 14 May 2018 15:58:07 +0800
Subject: [PATCH] 报表展示 增加行业筛选

---
 src/main/resources/mapper/DeviceMapper.xml |   38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/src/main/resources/mapper/DeviceMapper.xml b/src/main/resources/mapper/DeviceMapper.xml
index 3fb35f3..4905b25 100644
--- a/src/main/resources/mapper/DeviceMapper.xml
+++ b/src/main/resources/mapper/DeviceMapper.xml
@@ -131,7 +131,7 @@
 		ORDER BY
 			s.id
 	</select>
-	<select id="getDeviceVersionIdByMonitorPoint" resultType="map">
+	<select id="getDeviceVersionIdByMonitorPoint" resultType="java.util.Map">
 		SELECT
 			device_version_id deviceVersionId
 		FROM
@@ -141,7 +141,7 @@
 		GROUP BY
 			device_version_id
 	</select>
-	<select id="getDeviceVersionIdByAreaCode" resultType="int">
+	<select id="getDeviceVersionIdByAreaCode" resultType="java.lang.Integer">
 		SELECT DISTINCT
 			d.device_version_id 
 		FROM
@@ -157,7 +157,7 @@
 			</foreach>
 		</if>
 	</select>
-	<select id="getDeviceMacByMonitorPointAndDeviceVersion" resultType="string">
+	<select id="getDeviceMacByMonitorPointAndDeviceVersion" resultType="java.lang.String">
 		SELECT
 			mac
 		FROM
@@ -248,5 +248,37 @@
 					AND mp.area_code = #{areaCode}
 					</if>
 			)
+			<if test="professionId != null">
+			AND d.profession_id = #{professionId}
+			</if>
+	</select>
+
+	<select id="getDevicesByProfession" resultType="com.moral.entity.Device">
+		SELECT
+			* 
+		FROM
+			device d 
+		WHERE
+			d.is_delete = 0 
+			AND d.monitor_point_id IN (
+				SELECT
+					mp.id 
+				FROM
+					monitor_point mp 
+				WHERE
+					mp.is_delete = 0 
+					<if test="provinceCode != null">
+					AND mp.province_code = #{provinceCode}
+					</if>
+					<if test="cityCode != null">
+					AND mp.city_code = #{cityCode}
+					</if>
+					<if test="areaCode != null">
+					AND mp.area_code = #{areaCode}
+					</if>
+			)
+			<if test="professionId != null">
+			AND d.profession_id = #{professionId}
+			</if>
 	</select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0