From e294ea312fe1994c3ddfe26595ee414e6612eb0c Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Fri, 04 Dec 2020 11:37:36 +0800 Subject: [PATCH] 大屏report_avg_datas接口24点无数据处理 --- src/main/resources/mapper/HistoryFiveMinutelyMapper.xml | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml b/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml index 1ff92ee..642d314 100644 --- a/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml +++ b/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml @@ -9,4 +9,27 @@ #{mac} </foreach> </select> + + <select id="getFiveMinutesDataByMac" resultType="java.util.LinkedHashMap"> + select + <foreach collection="sensorKeys" separator="," item="sensorKey"> + json->'$.${sensorKey}' AS '${sensorKey}' + </foreach> + FROM + history_five_minutely_${yearAndMonth} h + where h.time = #{time} + and h.mac = #{mac} + </select> + + <select id="getFiveMinutesSersorDataByMacsAndTime" resultType="map"> + SELECT h.mac,h.time, + <foreach collection="sensorKeys" separator="," item="sensorKey"> + json->'$.${sensorKey}' AS '${sensorKey}' + </foreach> + from history_five_minutely_${yearAndMonth} h + where time = #{time} and mac IN + <foreach collection="macs" separator="," open="(" close=")" item="mac"> + #{mac} + </foreach> + </select> </mapper> \ No newline at end of file -- Gitblit v1.8.0