From 2973f298e49fd8dff95065ef88d2997fe4eed338 Mon Sep 17 00:00:00 2001 From: kaiyu <404897439@qq.com> Date: Fri, 16 Oct 2020 11:18:19 +0800 Subject: [PATCH] 建立五分钟数据表以及读取一分钟表数据计算平均值到五分钟表的接口 --- src/main/resources/mapper/HistoryMapper.xml | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/main/resources/mapper/HistoryMapper.xml b/src/main/resources/mapper/HistoryMapper.xml index 19bf540..b74a825 100644 --- a/src/main/resources/mapper/HistoryMapper.xml +++ b/src/main/resources/mapper/HistoryMapper.xml @@ -170,10 +170,17 @@ <insert id="insertHistorySpecialTable"> insert into history_special(mac, value, time,version) - SELECT * from history WHERE time>=DATE_SUB(#{time}, INTERVAL 1 HOUR) and time<![CDATA[<]]>#{time} and mac in + SELECT * from history WHERE time>=#{startTime} and time<![CDATA[<]]>#{endTime} and mac in <foreach collection="macList" index="index" item="mac" open="(" separator="," close=")"> #{mac} </foreach> </insert> + <delete id="deleteHistoryData" parameterType="java.lang.String"> + delete from history where time < #{oldTime}; + </delete> + + <update id="deletePartition"> + ALTER table history drop PARTITION ${p}; + </update> </mapper> \ No newline at end of file -- Gitblit v1.8.0