<?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.ttsa.mapper.BisTtsaApplWiunMapper">
    <resultMap type="com.goldenwater.slaj.ttsa.domain.BisTtsaApplWiun" id="BisTtsaApplWiunResult">
        <result property="guid" column="guid"/>
        <result property="applOrgGuid" column="appl_org_guid"/>
        <result property="orgAccount" column="org_account"/>
        <result property="contaPersTel" column="conta_pers_tel"/>
        <result property="postCode" column="post_code"/>
        <result property="contaPersEmail" column="conta_pers_email"/>
        <result property="applType" column="appl_type"/>
        <result property="applSituStat" column="appl_situ_stat"/>
        <result property="veriOrgGuid" column="veri_org_guid"/>
        <result property="veriTime" column="veri_time"/>
        <result property="veriOpin" column="veri_opin"/>
        <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="orgSource" column="org_source"/>
    </resultMap>

    <sql id="selectBisTtsaApplWiunVo">
        select guid, appl_org_guid, org_account, conta_pers_tel, post_code,
               conta_pers_email, appl_type, appl_situ_stat, veri_org_guid, veri_time,
               veri_opin, note, coll_time, upd_time, rec_pers, org_source
        from bis_ttsa_appl_wiun
    </sql>

    <select id="selectBisTtsaApplWiunByGuid" parameterType="String" resultMap="BisTtsaApplWiunResult">
        <include refid="selectBisTtsaApplWiunVo"/> where guid = #{guid}
    </select>

    <select id="selectBisTtsaApplWiunList" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaApplWiun" resultMap="BisTtsaApplWiunResult">
        <include refid="selectBisTtsaApplWiunVo"/>
        <where>
            <if test="applOrgGuid != null and applOrgGuid != ''">and appl_org_guid = #{applOrgGuid}</if>
            <if test="applType != null and applType != ''">and appl_type = #{applType}</if>
            <if test="applSituStat != null and applSituStat != ''">and appl_situ_stat = #{applSituStat}</if>
        </where>
    </select>

    <insert id="insertBisTtsaApplWiun" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaApplWiun">
        insert into bis_ttsa_appl_wiun (
            guid, appl_org_guid, org_account, conta_pers_tel, post_code,
            conta_pers_email, appl_type, appl_situ_stat, veri_org_guid, veri_time,
            veri_opin, note, coll_time, upd_time, rec_pers, org_source
        ) values (
            #{guid}, #{applOrgGuid}, #{orgAccount}, #{contaPersTel}, #{postCode},
            #{contaPersEmail}, #{applType}, #{applSituStat}, #{veriOrgGuid}, #{veriTime},
            #{veriOpin}, #{note}, #{collTime}, #{updTime}, #{recPers}, #{orgSource}
        )
    </insert>

    <update id="updateBisTtsaApplWiun" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaApplWiun">
        update bis_ttsa_appl_wiun
        <set>
            <if test="applOrgGuid != null">appl_org_guid = #{applOrgGuid},</if>
            <if test="orgAccount != null">org_account = #{orgAccount},</if>
            <if test="contaPersTel != null">conta_pers_tel = #{contaPersTel},</if>
            <if test="postCode != null">post_code = #{postCode},</if>
            <if test="contaPersEmail != null">conta_pers_email = #{contaPersEmail},</if>
            <if test="applType != null">appl_type = #{applType},</if>
            <if test="applSituStat != null">appl_situ_stat = #{applSituStat},</if>
            <if test="veriOrgGuid != null">veri_org_guid = #{veriOrgGuid},</if>
            <if test="veriTime != null">veri_time = #{veriTime},</if>
            <if test="veriOpin != null">veri_opin = #{veriOpin},</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="orgSource != null">org_source = #{orgSource},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteBisTtsaApplWiunByGuid" parameterType="String">
        delete from bis_ttsa_appl_wiun where guid = #{guid}
    </delete>

    <delete id="deleteBisTtsaApplWiunByGuids" parameterType="String">
        delete from bis_ttsa_appl_wiun where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
