<?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.pqs9900.mapper.DataInfo.DownEventMapper'>

    <insert id="addEventAndWave">
        insert into pqs_eventdetail (
        eventdetail_index,
        lineid,
        timeid,
        ms,
        <if test="describe!=null and describe!=''">
            describe,
        </if>
        eventvalue,
        wavetype,
        persisttime,
        eventreason,
        eventtype,
        fileflag
        )
        values
        (
        #{eventDetailIndex},
        #{lineId},
        #{timeid},
        #{ms},
        <if test="describe!=null and describe!=''">
            #{describe},
        </if>
        #{eventValue},
        #{wavetype},
        #{persisttime},
        #{eventReason},
        #{eventType},
        1
        )
    </insert>

    <select id="isRight" resultType="int">
        select count(*) from pqs_eventdetail where timeid=#{timeid} and lineid=#{lineId} and ms = #{ms}
    </select>

    <update id="updateWaveFlag">
        update pqs_eventdetail set fileflag = 1 where eventdetail_index = #{evenDetailIndex}
    </update>
</mapper>
