From 4108fd24ac888934a23e9b9129c4392baa2ffb94 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Tue, 23 Nov 2021 15:27:43 +0800
Subject: [PATCH] 设备掉线,小时和昨日邮件发送
---
src/main/resources/mapper/HistoryMapper.xml | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/src/main/resources/mapper/HistoryMapper.xml b/src/main/resources/mapper/HistoryMapper.xml
index 0827a7e..743b83f 100644
--- a/src/main/resources/mapper/HistoryMapper.xml
+++ b/src/main/resources/mapper/HistoryMapper.xml
@@ -107,7 +107,7 @@
</choose>
</foreach>
FROM
- history h
+ history_${yearAndMonthDay} h
WHERE
h.time >= #{start}
AND h.time <![CDATA[<]]> #{end}
@@ -247,4 +247,20 @@
<update id="deletePartition">
ALTER table history drop PARTITION ${p};
</update>
+
+ <update id="createHistoryTable" parameterType="String">
+ CREATE TABLE history_${yearMonthDay} (
+ `mac` varchar(20) DEFAULT NULL,
+ `value` json DEFAULT NULL,
+ `time` datetime DEFAULT NULL,
+ `version` int(11) DEFAULT NULL,
+ KEY `_idx_mac_time` (`mac`,`time`) USING BTREE,
+ KEY `_idx_mac` (`mac`) USING BTREE,
+ KEY `_idx_time` (`time`) USING BTREE
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC
+ </update>
+
+ <delete id="dropHistoryTable" parameterType="String">
+ drop table history_${yearMonthDay}
+ </delete>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0