From 6f5dc4ff458a78ec4ff341ca33b5bd5e99fbc8e5 Mon Sep 17 00:00:00 2001 From: xufenglei <xufenglei> Date: Fri, 13 Jul 2018 14:38:18 +0800 Subject: [PATCH] demo --- 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