<?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.acci.mapper.MwrCredAcciMapper">
    <resultMap type="com.goldenwater.slaj.acci.domain.MwrCredAcci" id="MwrCredAcciResult">
        <result property="guid" column="guid"/>
        <result property="acciOccuWiun" column="acci_occu_wiun"/>
        <result property="socCreCode" column="soc_cre_code"/>
        <result property="acciOccuLoc" column="acci_occu_loc"/>
        <result property="acciOccuTime" column="acci_occu_time"/>
        <result property="casNum" column="cas_num"/>
        <result property="serInjNum" column="ser_inj_num"/>
        <result property="econLoss" column="econ_loss"/>
        <result property="acciCate" column="acci_cate"/>
        <result property="acciSitu" column="acci_situ"/>
        <result property="acciCause" column="acci_cause"/>
        <result property="wiunProp" column="wiun_prop"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
    </resultMap>
    <sql id="selectMwrCredAcciVo">
        select guid, acci_occu_wiun, soc_cre_code, acci_occu_loc, acci_occu_time,
               cas_num, ser_inj_num, econ_loss, acci_cate, acci_situ, acci_cause,
               wiun_prop, note, coll_time, upd_time
        from mwr_cred_acci
    </sql>
    <select id="selectMwrCredAcciByGuid" parameterType="String" resultMap="MwrCredAcciResult">
        <include refid="selectMwrCredAcciVo"/>
        where guid = #{guid}
    </select>
    <select id="selectMwrCredAcciList" parameterType="com.goldenwater.slaj.acci.domain.MwrCredAcci" resultMap="MwrCredAcciResult">
        <include refid="selectMwrCredAcciVo"/>
        <where>
            <if test="guid != null and guid != ''">AND guid = #{guid}</if>
            <if test="acciOccuWiun != null and acciOccuWiun != ''">AND acci_occu_wiun like '%' || #{acciOccuWiun} || '%'</if>
            <if test="socCreCode != null and socCreCode != ''">AND soc_cre_code = #{socCreCode}</if>
            <if test="acciOccuLoc != null and acciOccuLoc != ''">AND acci_occu_loc like '%' || #{acciOccuLoc} || '%'</if>
            <if test="acciOccuTime != null and acciOccuTime != ''">AND acci_occu_time = #{acciOccuTime}</if>
            <if test="acciCate != null and acciCate != ''">AND acci_cate = #{acciCate}</if>
            <if test="wiunProp != null and wiunProp != ''">AND wiun_prop = #{wiunProp}</if>
        </where>
    </select>
    <insert id="insertMwrCredAcci" parameterType="com.goldenwater.slaj.acci.domain.MwrCredAcci">
        insert into mwr_cred_acci (
            guid, acci_occu_wiun, soc_cre_code, acci_occu_loc, acci_occu_time,
            cas_num, ser_inj_num, econ_loss, acci_cate, acci_situ, acci_cause,
            wiun_prop, note, coll_time, upd_time
        ) values (
            #{guid}, #{acciOccuWiun}, #{socCreCode}, #{acciOccuLoc}, #{acciOccuTime},
            #{casNum}, #{serInjNum}, #{econLoss}, #{acciCate}, #{acciSitu}, #{acciCause},
            #{wiunProp}, #{note}, #{collTime}, #{updTime}
        )
    </insert>
    <update id="updateMwrCredAcci" parameterType="com.goldenwater.slaj.acci.domain.MwrCredAcci">
        update mwr_cred_acci
        <set>
            <if test="acciOccuWiun != null">acci_occu_wiun = #{acciOccuWiun},</if>
            <if test="socCreCode != null">soc_cre_code = #{socCreCode},</if>
            <if test="acciOccuLoc != null">acci_occu_loc = #{acciOccuLoc},</if>
            <if test="acciOccuTime != null">acci_occu_time = #{acciOccuTime},</if>
            <if test="casNum != null">cas_num = #{casNum},</if>
            <if test="serInjNum != null">ser_inj_num = #{serInjNum},</if>
            <if test="econLoss != null">econ_loss = #{econLoss},</if>
            <if test="acciCate != null">acci_cate = #{acciCate},</if>
            <if test="acciSitu != null">acci_situ = #{acciSitu},</if>
            <if test="acciCause != null">acci_cause = #{acciCause},</if>
            <if test="wiunProp != null">wiun_prop = #{wiunProp},</if>
            <if test="note != null">note = #{note},</if>
            <if test="collTime != null">coll_time = #{collTime},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteMwrCredAcciByGuid" parameterType="String">
        delete from mwr_cred_acci where guid = #{guid}
    </delete>
    <delete id="deleteMwrCredAcciByGuids" parameterType="String">
        delete from mwr_cred_acci where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
