<?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.brilliance.isc.mda.dao.TxflogMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Txflog">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="txforminr" column="txforminr" jdbcType="VARCHAR"/>
        <result property="txpayminr" column="txpayminr" jdbcType="VARCHAR"/>
        <result property="rcrdno" column="rcrdno" jdbcType="VARCHAR"/>
        <result property="bsnsrlno" column="bsnsrlno" jdbcType="VARCHAR"/>
        <result property="updtyp" column="updtyp" jdbcType="VARCHAR"/>
        <result property="updusr" column="updusr" jdbcType="VARCHAR"/>
        <result property="updtim" column="updtim" jdbcType="DATE"/>
        <result property="inifrm" column="inifrm" jdbcType="VARCHAR"/>
        <result property="branch" column="branch" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,txforminr,txpayminr,rcrdno,bsnsrlno,updtyp,updusr,updtim,inifrm,branch
    </sql>

    <select id="selectByPrimaryKey" resultMap="BaseResultMap">
        select
            <include refid="Base_Column_List" />
        from txflog
        where inr = #{inr,jdbcType=VARCHAR}
    </select>

    <delete id="deleteByPrimaryKey">
        delete from txflog
        where inr = #{inr,jdbcType=VARCHAR}
    </delete>

    <insert id="insert">
        insert into txflog (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{txforminr,jdbcType=VARCHAR},
            #{txpayminr,jdbcType=VARCHAR},
            #{rcrdno,jdbcType=VARCHAR},
            #{bsnsrlno,jdbcType=VARCHAR},
            #{updtyp,jdbcType=VARCHAR},
            #{updusr,jdbcType=VARCHAR},
            #{updtim,jdbcType=DATE},
            #{inifrm,jdbcType=VARCHAR},
            #{branch,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into txflog
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="txforminr != null">txforminr,</if>
            <if test="txpayminr != null">txpayminr,</if>
            <if test="rcrdno != null">rcrdno,</if>
            <if test="bsnsrlno != null">bsnsrlno,</if>
            <if test="updtyp != null">updtyp,</if>
            <if test="updusr != null">updusr,</if>
            <if test="updtim != null">updtim,</if>
            <if test="inifrm != null">inifrm,</if>
            <if test="branch != null">branch,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR}, </if>
            <if test="txforminr != null">#{txforminr,jdbcType=VARCHAR}, </if>
            <if test="txpayminr != null">#{txpayminr,jdbcType=VARCHAR}, </if>
            <if test="rcrdno != null">#{rcrdno,jdbcType=VARCHAR}, </if>
            <if test="bsnsrlno != null">#{bsnsrlno,jdbcType=VARCHAR}, </if>
            <if test="updtyp != null">#{updtyp,jdbcType=VARCHAR}, </if>
            <if test="updusr != null">#{updusr,jdbcType=VARCHAR}, </if>
            <if test="updtim != null">#{updtim,jdbcType=DATE}, </if>
            <if test="inifrm != null">#{inifrm,jdbcType=VARCHAR}, </if>
            <if test="branch != null">#{branch,jdbcType=VARCHAR}, </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update txflog
        <set>
            <if test="txforminr != null">txforminr = #{txforminr,jdbcType=VARCHAR},</if>
            <if test="txpayminr != null">txpayminr = #{txpayminr,jdbcType=VARCHAR},</if>
            <if test="rcrdno != null">rcrdno = #{rcrdno,jdbcType=VARCHAR},</if>
            <if test="bsnsrlno != null">bsnsrlno = #{bsnsrlno,jdbcType=VARCHAR},</if>
            <if test="updtyp != null">updtyp = #{updtyp,jdbcType=VARCHAR},</if>
            <if test="updusr != null">updusr = #{updusr,jdbcType=VARCHAR},</if>
            <if test="updtim != null">updtim = #{updtim,jdbcType=DATE},</if>
            <if test="inifrm != null">inifrm = #{inifrm,jdbcType=VARCHAR},</if>
            <if test="branch != null">branch = #{branch,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update txflog
        <set>
            txforminr = #{txforminr,jdbcType=VARCHAR},
            txpayminr = #{txpayminr,jdbcType=VARCHAR},
            rcrdno = #{rcrdno,jdbcType=VARCHAR},
            bsnsrlno = #{bsnsrlno,jdbcType=VARCHAR},
            updtyp = #{updtyp,jdbcType=VARCHAR},
            updusr = #{updusr,jdbcType=VARCHAR},
            updtim = #{updtim,jdbcType=DATE},
            inifrm = #{inifrm,jdbcType=VARCHAR},
            branch = #{branch,jdbcType=VARCHAR},
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <select id="selectByBsnsrlno" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from txflog
        where bsnsrlno = #{bsnsrlno,jdbcType=VARCHAR} and UPDTYP='业务受理' ORDER BY INR DESC
    </select>

    <select id="selectByBsnsrlnoAndUpdtyp" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from txflog
        where bsnsrlno = #{bsnsrlno,jdbcType=VARCHAR} and UPDTYP in ('付汇确认','付汇修改','付汇取消') ORDER BY INR DESC
    </select>

</mapper>