From 6b9938b5faf4a1b66f1c8886adc402d42bd447c1 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Tue, 31 Jul 2018 11:43:03 +0800
Subject: [PATCH] 增加 null判断
---
src/main/resources/mapper/HistoryMinutelyMapper.xml | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/mapper/HistoryMinutelyMapper.xml b/src/main/resources/mapper/HistoryMinutelyMapper.xml
index ff3b4fc..1509a27 100644
--- a/src/main/resources/mapper/HistoryMinutelyMapper.xml
+++ b/src/main/resources/mapper/HistoryMinutelyMapper.xml
@@ -13,12 +13,25 @@
FROM
history_minutely
WHERE
- mac = #{mac}
+ mac IN
+ (SELECT
+ d.mac
+ FROM
+ device d
+ WHERE
+ d.is_delete = 0
+ <if test="monitorPointId != null">
+ AND d.monitor_point_id = #{monitorPointId}
+ </if>
+ <if test="mac != null">
+ AND d.mac = #{mac}
+ </if>
+ )
AND time >= #{start}
AND time < #{end}
</select>
- <select id="getMonitorPointOrDeviceAvgData" resultType="java.util.Map">
+ <select id="getMonitorPointOrDeviceAvgData" resultType="java.util.LinkedHashMap">
SELECT
DATE_FORMAT(time, #{typeFormat}) time
<foreach collection="sensorKeys" open="," separator="," item="sensorKey">
@@ -53,6 +66,9 @@
<if test="monitorPointId != null">
AND mp.id = #{monitorPointId}
</if>
+ <if test="professionId != null">
+ AND d.profession_id = #{professionId}
+ </if>
)
</if>
--
Gitblit v1.8.0