<?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.BisHachStorMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.BisHachStor" id="BisHachStorResult">
        <result property="guid" column="guid"/>
        <result property="hachGuid" column="hach_guid"/>
        <result property="storDate" column="stor_date"/>
        <result property="storType" column="stor_type"/>
        <result property="supplier" column="supplier"/>
        <result property="quantity" column="quantity"/>
        <result property="handle" column="handle"/>
        <result property="acceptor" column="acceptor"/>
        <result property="storLoc" column="stor_loc"/>
        <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="selectBisHachStorVo">
        select guid, hach_guid, stor_date, stor_type, supplier, quantity,
               handle, acceptor, stor_loc, note, coll_time, upd_time,
               rec_pers, to_date
        from bis_hach_stor
    </sql>
    <select id="selectBisHachStorByGuid" parameterType="String" resultMap="BisHachStorResult">
        <include refid="selectBisHachStorVo"/>
        where guid = #{guid}
    </select>
    <select id="selectBisHachStorList" parameterType="com.goldenwater.slaj.hazard.domain.BisHachStor" resultMap="BisHachStorResult">
        <include refid="selectBisHachStorVo"/>
        <where>
            <if test="hachGuid != null and hachGuid != ''">AND hach_guid = #{hachGuid}</if>
            <if test="guid != null and guid != ''">AND guid = #{guid}</if>
        </where>
    </select>
    <insert id="insertBisHachStor" parameterType="com.goldenwater.slaj.hazard.domain.BisHachStor">
        insert into bis_hach_stor (
            guid, hach_guid, stor_date, stor_type, supplier, quantity,
            handle, acceptor, stor_loc, note, coll_time, upd_time,
            rec_pers, to_date
        ) values (
            #{guid}, #{hachGuid}, #{storDate}, #{storType}, #{supplier}, #{quantity},
            #{handle}, #{acceptor}, #{storLoc}, #{note}, #{collTime}, #{updTime},
            #{recPers}, #{toDate}
        )
    </insert>
    <update id="updateBisHachStor" parameterType="com.goldenwater.slaj.hazard.domain.BisHachStor">
        update bis_hach_stor
        <set>
            <if test="hachGuid != null">hach_guid = #{hachGuid},</if>
            <if test="storDate != null">stor_date = #{storDate},</if>
            <if test="storType != null">stor_type = #{storType},</if>
            <if test="supplier != null">supplier = #{supplier},</if>
            <if test="quantity != null">quantity = #{quantity},</if>
            <if test="handle != null">handle = #{handle},</if>
            <if test="acceptor != null">acceptor = #{acceptor},</if>
            <if test="storLoc != null">stor_loc = #{storLoc},</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="deleteBisHachStorByGuid" parameterType="String">
        delete from bis_hach_stor where guid = #{guid}
    </delete>
    <delete id="deleteBisHachStorByGuids" parameterType="String">
        delete from bis_hach_stor where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
