<?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.yeejoin.amos.boot.module.jxiop.biz.tdmapper.AlarmEventMapper">
	<select id="getEventList" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.AlarmEvent">
		SELECT
        *
        FROM
        fault_alarm_event
		<where>
			<if test="gatewayId != null and gatewayId != ''">
                gateway_id = #{gatewayId}
            </if>
			AND #{time} &lt;= created_time
		</where>
		ORDER BY created_time DESC
	</select>
	<insert id="save">
		INSERT INTO
        fault_alarm_event(created_time,station_name,station_id,gateway_id,event_desc,alarm_group_name,value)
        VALUES
		<foreach collection = "list" item = "item" separator=",">
         (NOW(),#{item.stationName},#{item.stationId},#{item.gatewayId},'#{item.eventDesc}','#{item.alarmGroupName}',#{item.value})
		</foreach>
	</insert>
</mapper>
