<?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.EquipDivergenceAlarmEventMapper">
	<select id="getEventList" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipDivergenceAlarmEvent">
		SELECT
        *
        FROM
        equip_divergence_alarm_event
		<where>
			<if test="gatewayId != null and gatewayId != ''">
               AND gateway_id = #{gatewayId}
            </if>
			<if test="equipName!= null and equipName != ''">
               AND equip_name LIKE #{equipName}
            </if>
			<if test="frontModule!= null and frontModule != ''">
               AND front_module = #{frontModule}
            </if>
			AND #{time} &lt;= created_time
		</where>
		ORDER BY created_time DESC
	</select>
	<insert id="save">
		INSERT INTO
        equip_divergence_alarm_event(created_time,staion_name,staion_id,gateway_id,equip_index,event_desc,equip_name,front_module,value,alarm_group_name)
        VALUES
		<foreach collection="list" item="item" separator=",">
         (NOW(),#{item.stationName},#{item.stationId},#{item.gatewayId},#{item.equipIndex},'#{item.eventDesc}','#{item.equipName}',#{item.frontModule},'#{item.value}','#{item.alarmGroupName}')
		</foreach>
	</insert>
</mapper>
