<?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.goldenwater.slaj.hazard.mapper.BisHazPatRecMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.BisHazPatRec" id="BisHazPatRecResult">
        <result property="guid" column="guid"/>
        <result property="hazGuid" column="haz_guid"/>
        <result property="patTime" column="pat_time"/>
        <result property="patPers" column="pat_pers"/>
        <result property="probFound" column="prob_found"/>
        <result property="treaMeas" column="trea_meas"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
        <result property="toDate" column="to_date"/>
    </resultMap>
    <sql id="selectBisHazPatRecVo">
        select guid, haz_guid, pat_time, pat_pers, prob_found, trea_meas,
               note, coll_time, upd_time, rec_pers, to_date
        from bis_haz_pat_rec
    </sql>
    <select id="selectBisHazPatRecByGuid" parameterType="String" resultMap="BisHazPatRecResult">
        <include refid="selectBisHazPatRecVo"/>
        where guid = #{guid}
    </select>
    <select id="selectBisHazPatRecList" parameterType="com.goldenwater.slaj.hazard.domain.BisHazPatRec" resultMap="BisHazPatRecResult">
        <include refid="selectBisHazPatRecVo"/>
        <where>
            <if test="hazGuid != null and hazGuid != ''">AND haz_guid = #{hazGuid}</if>
            <if test="guid != null and guid != ''">AND guid = #{guid}</if>
        </where>
    </select>
    <insert id="insertBisHazPatRec" parameterType="com.goldenwater.slaj.hazard.domain.BisHazPatRec">
        insert into bis_haz_pat_rec (
            guid, haz_guid, pat_time, pat_pers, prob_found, trea_meas,
            note, coll_time, upd_time, rec_pers, to_date
        ) values (
            #{guid}, #{hazGuid}, #{patTime}, #{patPers}, #{probFound}, #{treaMeas},
            #{note}, #{collTime}, #{updTime}, #{recPers}, #{toDate}
        )
    </insert>
    <update id="updateBisHazPatRec" parameterType="com.goldenwater.slaj.hazard.domain.BisHazPatRec">
        update bis_haz_pat_rec
        <set>
            <if test="hazGuid != null">haz_guid = #{hazGuid},</if>
            <if test="patTime != null">pat_time = #{patTime},</if>
            <if test="patPers != null">pat_pers = #{patPers},</if>
            <if test="probFound != null">prob_found = #{probFound},</if>
            <if test="treaMeas != null">trea_meas = #{treaMeas},</if>
            <if test="note != null">note = #{note},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null">rec_pers = #{recPers},</if>
            <if test="toDate != null">to_date = #{toDate},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteBisHazPatRecByGuid" parameterType="String">
        delete from bis_haz_pat_rec where guid = #{guid}
    </delete>
    <delete id="deleteBisHazPatRecByGuids" parameterType="String">
        delete from bis_haz_pat_rec where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
