<?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="com.moral.api.mapper.AlarmInfoMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.moral.api.entity.AlarmInfo">
|
<id column="id" property="id" />
|
<result column="alarm_time" property="alarmTime" />
|
<result column="index" property="index" />
|
<result column="device_id" property="deviceId" />
|
<result column="alarm_type" property="alarmType" />
|
<result column="alarm_information" property="alarmInformation" />
|
<result column="create_time" property="createTime" />
|
</resultMap>
|
|
<update id="createTable" parameterType="String">
|
CREATE TABLE IF NOT EXISTS `alarm_info_${timeUnits}` (
|
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
`alarm_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '报警时间',
|
`index` varchar(255) NOT NULL COMMENT '指标(因子)',
|
`device_id` int(11) NOT NULL COMMENT '点位(设备)',
|
`alarm_type` varchar(255) NOT NULL COMMENT '报警类型',
|
`alarm_information` varchar(255) NOT NULL COMMENT '报警信息',
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
PRIMARY KEY (`id`)
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '报警信息小时表';
|
</update>
|
|
<insert id="insertAlarmInfo">
|
insert into alarm_info_${timeUnits}
|
(alarm_time,`index`,device_id,alarm_type,alarm_information)
|
values (#{map.alarmTime},#{map.index},#{map.deviceId},#{map.alarmType},#{map.alarmInformation})
|
</insert>
|
|
</mapper>
|