From 9b33e93fccddea356c3d686684fc58ceb176ff39 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Fri, 30 Mar 2018 15:01:26 +0800
Subject: [PATCH] 增加 省市区 查询条件

---
 src/main/resources/mapper/HistoryMinutelyMapper.xml |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/main/resources/mapper/HistoryMinutelyMapper.xml b/src/main/resources/mapper/HistoryMinutelyMapper.xml
index 9fb4382..4e9e4c3 100644
--- a/src/main/resources/mapper/HistoryMinutelyMapper.xml
+++ b/src/main/resources/mapper/HistoryMinutelyMapper.xml
@@ -34,10 +34,26 @@
 		</if>
 		<if test="mac == null">
 		AND	h.mac IN
-			<foreach  collection="macs" open="(" separator="," close=")" item="listItem">
-				#{listItem}
-			</foreach>
-		
+			(SELECT
+				d.mac 
+			FROM
+				device d,
+				monitor_point mp 
+			WHERE
+				d.monitor_point_id = mp.id 
+				<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="monitorPointId != null">
+				AND mp.id =	#{monitorPointId}
+				</if>
+			)	
 		</if>
 		
 		GROUP BY

--
Gitblit v1.8.0