物联网平台 +Web 组态
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 lines
1.3 KiB

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="System">
<select id="selectMaxHistoryInfo" resultType="com.lp.bean.TableSystem">
SELECT TABLE_NAME as table_name FROM information_schema.TABLES WHERE
TABLE_NAME LIKE '%iot_history_sensor_data%'
ORDER BY TABLE_NAME DESC LIMIT 1 ;
</select>
<select id="selectHistoryInfo" resultType="com.lp.bean.TableSystem" parameterType="com.lp.bean.TableSystem" >
SELECT TABLE_NAME as table_name FROM information_schema.TABLES WHERE
TABLE_NAME LIKE '%iot_history_sensor_data%'
AND table_schema= #{db_name}
</select>
<update id="createHistoryTable" parameterType="com.lp.bean.TableSystem" statementType="STATEMENT">
CREATE TABLE iot_history_sensor_data_${table_index} LIKE iot_history_sensor_data_1;
</update>
<update id="modifyHistoryTable" parameterType="com.lp.bean.TableSystem" statementType="STATEMENT">
ALTER TABLE iot_history_sensor_data UNION(${table_names}) ;
</update>
<select id="selectHistoryCount" parameterType="com.lp.bean.TableSystem" resultType="java.lang.Integer" statementType="STATEMENT" >
SELECT COUNT(1) as num FROM iot_history_sensor_data_${table_index}
</select>
</mapper>