<?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.BisHachDelMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.BisHachDel" id="BisHachDelResult">
        <result property="guid" column="guid"/>
        <result property="hachGuid" column="hach_guid"/>
        <result property="delTime" column="del_time"/>
        <result property="delType" column="del_type"/>
        <result property="quantity" column="quantity"/>
        <result property="handle" column="handle"/>
        <result property="auditor" column="auditor"/>
        <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="selectBisHachDelVo">
        select guid, hach_guid, del_time, del_type, quantity, handle,
               auditor, note, coll_time, upd_time, rec_pers, to_date
        from bis_hach_del
    </sql>
    <select id="selectBisHachDelByGuid" parameterType="String" resultMap="BisHachDelResult">
        <include refid="selectBisHachDelVo"/>
        where guid = #{guid}
    </select>
    <select id="selectBisHachDelList" parameterType="com.goldenwater.slaj.hazard.domain.BisHachDel" resultMap="BisHachDelResult">
        <include refid="selectBisHachDelVo"/>
        <where>
            <if test="hachGuid != null and hachGuid != ''">AND hach_guid = #{hachGuid}</if>
            <if test="delType != null and delType != ''">AND del_type like '%' || #{delType} || '%'</if>
            <if test="guid != null and guid != ''">AND guid = #{guid}</if>
        </where>
    </select>
    <insert id="insertBisHachDel" parameterType="com.goldenwater.slaj.hazard.domain.BisHachDel">
        insert into bis_hach_del (
            guid, hach_guid, del_time, del_type, quantity, handle,
            auditor, note, coll_time, upd_time, rec_pers, to_date
        ) values (
            #{guid}, #{hachGuid}, #{delTime}, #{delType}, #{quantity}, #{handle},
            #{auditor}, #{note}, #{collTime}, #{updTime}, #{recPers}, #{toDate}
        )
    </insert>
    <update id="updateBisHachDel" parameterType="com.goldenwater.slaj.hazard.domain.BisHachDel">
        update bis_hach_del
        <set>
            <if test="hachGuid != null">hach_guid = #{hachGuid},</if>
            <if test="delTime != null">del_time = #{delTime},</if>
            <if test="delType != null">del_type = #{delType},</if>
            <if test="quantity != null">quantity = #{quantity},</if>
            <if test="handle != null">handle = #{handle},</if>
            <if test="auditor != null">auditor = #{auditor},</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="deleteBisHachDelByGuid" parameterType="String">
        delete from bis_hach_del where guid = #{guid}
    </delete>
    <delete id="deleteBisHachDelByGuids" parameterType="String">
        delete from bis_hach_del where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
