<?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.TdbMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.common.rmbbop.entity.Tdb">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="sta" column="sta" jdbcType="VARCHAR"/>
        <result property="levyno" column="levyno" jdbcType="VARCHAR"/>
        <result property="opertype" column="opertype" jdbcType="VARCHAR"/>
        <result property="actiondesc" column="actiondesc" jdbcType="VARCHAR"/>
        <result property="bankorgcode" column="bankorgcode" jdbcType="VARCHAR"/>
        <result property="payername" column="payername" jdbcType="VARCHAR"/>
        <result property="payerattr" column="payerattr" jdbcType="VARCHAR"/>
        <result property="payerorgcode" column="payerorgcode" jdbcType="VARCHAR"/>
        <result property="payeracct" column="payeracct" jdbcType="VARCHAR"/>
        <result property="payeename" column="payeename" jdbcType="VARCHAR"/>
        <result property="payeecountrycode" column="payeecountrycode" jdbcType="VARCHAR"/>
        <result property="recebankcode" column="recebankcode" jdbcType="VARCHAR"/>
        <result property="payeeaccttype" column="payeeaccttype" jdbcType="VARCHAR"/>
        <result property="payeeacct" column="payeeacct" jdbcType="VARCHAR"/>
        <result property="allamt" column="allamt" jdbcType="DECIMAL"/>
        <result property="payerdate" column="payerdate" jdbcType="DATE"/>
        <result property="balancemode" column="balancemode" jdbcType="VARCHAR"/>
        <result property="payercny" column="payercny" jdbcType="VARCHAR"/>
        <result property="ifrefund" column="ifrefund" jdbcType="VARCHAR"/>
        <result property="oriinclevyno" column="oriinclevyno" jdbcType="VARCHAR"/>
        <result property="banktrano" column="banktrano" jdbcType="VARCHAR"/>
        <result property="paymentlist" column="paymentlist" jdbcType="INTEGER"/>
        <result property="payflg" column="payflg" jdbcType="VARCHAR"/>
        <result property="ownextkey" column="ownextkey" jdbcType="VARCHAR"/>
        <result property="sbankname" column="sbankname" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,ver,sta,levyno,opertype,actiondesc,bankorgcode,payername,payerattr,payerorgcode,payeracct,payeename,payeecountrycode,recebankcode,payeeaccttype,payeeacct,allamt,payerdate,balancemode,payercny,ifrefund,oriinclevyno,banktrano,paymentlist,payflg,ownextkey,sbankname
    </sql>

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

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

    <insert id="insert">
        insert into tdb (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            #{sta,jdbcType=VARCHAR},
            #{levyno,jdbcType=VARCHAR},
            #{opertype,jdbcType=VARCHAR},
            #{actiondesc,jdbcType=VARCHAR},
            #{bankorgcode,jdbcType=VARCHAR},
            #{payername,jdbcType=VARCHAR},
            #{payerattr,jdbcType=VARCHAR},
            #{payerorgcode,jdbcType=VARCHAR},
            #{payeracct,jdbcType=VARCHAR},
            #{payeename,jdbcType=VARCHAR},
            #{payeecountrycode,jdbcType=VARCHAR},
            #{recebankcode,jdbcType=VARCHAR},
            #{payeeaccttype,jdbcType=VARCHAR},
            #{payeeacct,jdbcType=VARCHAR},
            #{allamt,jdbcType=DECIMAL},
            #{payerdate,jdbcType=DATE},
            #{balancemode,jdbcType=VARCHAR},
            #{payercny,jdbcType=VARCHAR},
            #{ifrefund,jdbcType=VARCHAR},
            #{oriinclevyno,jdbcType=VARCHAR},
            #{banktrano,jdbcType=VARCHAR},
            #{paymentlist,jdbcType=INTEGER},
            #{payflg,jdbcType=VARCHAR},
            #{ownextkey,jdbcType=VARCHAR},
            #{sbankname,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into tdb
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="ver != null">ver,</if>
            <if test="sta != null">sta,</if>
            <if test="levyno != null">levyno,</if>
            <if test="opertype != null">opertype,</if>
            <if test="actiondesc != null">actiondesc,</if>
            <if test="bankorgcode != null">bankorgcode,</if>
            <if test="payername != null">payername,</if>
            <if test="payerattr != null">payerattr,</if>
            <if test="payerorgcode != null">payerorgcode,</if>
            <if test="payeracct != null">payeracct,</if>
            <if test="payeename != null">payeename,</if>
            <if test="payeecountrycode != null">payeecountrycode,</if>
            <if test="recebankcode != null">recebankcode,</if>
            <if test="payeeaccttype != null">payeeaccttype,</if>
            <if test="payeeacct != null">payeeacct,</if>
            <if test="allamt != null">allamt,</if>
            <if test="payerdate != null">payerdate,</if>
            <if test="balancemode != null">balancemode,</if>
            <if test="payercny != null">payercny,</if>
            <if test="ifrefund != null">ifrefund,</if>
            <if test="oriinclevyno != null">oriinclevyno,</if>
            <if test="banktrano != null">banktrano,</if>
            <if test="paymentlist != null">paymentlist,</if>
            <if test="payflg != null">payflg,</if>
            <if test="ownextkey != null">ownextkey,</if>
            <if test="sbankname != null">sbankname,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR}, </if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR}, </if>
            <if test="sta != null">#{sta,jdbcType=VARCHAR}, </if>
            <if test="levyno != null">#{levyno,jdbcType=VARCHAR}, </if>
            <if test="opertype != null">#{opertype,jdbcType=VARCHAR}, </if>
            <if test="actiondesc != null">#{actiondesc,jdbcType=VARCHAR}, </if>
            <if test="bankorgcode != null">#{bankorgcode,jdbcType=VARCHAR}, </if>
            <if test="payername != null">#{payername,jdbcType=VARCHAR}, </if>
            <if test="payerattr != null">#{payerattr,jdbcType=VARCHAR}, </if>
            <if test="payerorgcode != null">#{payerorgcode,jdbcType=VARCHAR}, </if>
            <if test="payeracct != null">#{payeracct,jdbcType=VARCHAR}, </if>
            <if test="payeename != null">#{payeename,jdbcType=VARCHAR}, </if>
            <if test="payeecountrycode != null">#{payeecountrycode,jdbcType=VARCHAR}, </if>
            <if test="recebankcode != null">#{recebankcode,jdbcType=VARCHAR}, </if>
            <if test="payeeaccttype != null">#{payeeaccttype,jdbcType=VARCHAR}, </if>
            <if test="payeeacct != null">#{payeeacct,jdbcType=VARCHAR}, </if>
            <if test="allamt != null">#{allamt,jdbcType=DECIMAL}, </if>
            <if test="payerdate != null">#{payerdate,jdbcType=DATE}, </if>
            <if test="balancemode != null">#{balancemode,jdbcType=VARCHAR}, </if>
            <if test="payercny != null">#{payercny,jdbcType=VARCHAR}, </if>
            <if test="ifrefund != null">#{ifrefund,jdbcType=VARCHAR}, </if>
            <if test="oriinclevyno != null">#{oriinclevyno,jdbcType=VARCHAR}, </if>
            <if test="banktrano != null">#{banktrano,jdbcType=VARCHAR}, </if>
            <if test="paymentlist != null">#{paymentlist,jdbcType=INTEGER}, </if>
            <if test="payflg != null">#{payflg,jdbcType=VARCHAR}, </if>
            <if test="ownextkey != null">#{ownextkey,jdbcType=VARCHAR}, </if>
            <if test="sbankname != null">#{sbankname,jdbcType=VARCHAR}, </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update tdb
        <set>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            <if test="sta != null">sta = #{sta,jdbcType=VARCHAR},</if>
            <if test="levyno != null">levyno = #{levyno,jdbcType=VARCHAR},</if>
            <if test="opertype != null">opertype = #{opertype,jdbcType=VARCHAR},</if>
            <if test="actiondesc != null">actiondesc = #{actiondesc,jdbcType=VARCHAR},</if>
            <if test="bankorgcode != null">bankorgcode = #{bankorgcode,jdbcType=VARCHAR},</if>
            <if test="payername != null">payername = #{payername,jdbcType=VARCHAR},</if>
            <if test="payerattr != null">payerattr = #{payerattr,jdbcType=VARCHAR},</if>
            <if test="payerorgcode != null">payerorgcode = #{payerorgcode,jdbcType=VARCHAR},</if>
            <if test="payeracct != null">payeracct = #{payeracct,jdbcType=VARCHAR},</if>
            <if test="payeename != null">payeename = #{payeename,jdbcType=VARCHAR},</if>
            <if test="payeecountrycode != null">payeecountrycode = #{payeecountrycode,jdbcType=VARCHAR},</if>
            <if test="recebankcode != null">recebankcode = #{recebankcode,jdbcType=VARCHAR},</if>
            <if test="payeeaccttype != null">payeeaccttype = #{payeeaccttype,jdbcType=VARCHAR},</if>
            <if test="payeeacct != null">payeeacct = #{payeeacct,jdbcType=VARCHAR},</if>
            <if test="allamt != null">allamt = #{allamt,jdbcType=DECIMAL},</if>
            <if test="payerdate != null">payerdate = #{payerdate,jdbcType=DATE},</if>
            <if test="balancemode != null">balancemode = #{balancemode,jdbcType=VARCHAR},</if>
            <if test="payercny != null">payercny = #{payercny,jdbcType=VARCHAR},</if>
            <if test="ifrefund != null">ifrefund = #{ifrefund,jdbcType=VARCHAR},</if>
            <if test="oriinclevyno != null">oriinclevyno = #{oriinclevyno,jdbcType=VARCHAR},</if>
            <if test="banktrano != null">banktrano = #{banktrano,jdbcType=VARCHAR},</if>
            <if test="paymentlist != null">paymentlist = #{paymentlist,jdbcType=INTEGER},</if>
            <if test="payflg != null">payflg = #{payflg,jdbcType=VARCHAR},</if>
            <if test="ownextkey != null">ownextkey = #{ownextkey,jdbcType=VARCHAR},</if>
            <if test="sbankname != null">sbankname = #{sbankname,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update tdb
        <set>
            ver = #{ver,jdbcType=VARCHAR},
            sta = #{sta,jdbcType=VARCHAR},
            levyno = #{levyno,jdbcType=VARCHAR},
            opertype = #{opertype,jdbcType=VARCHAR},
            actiondesc = #{actiondesc,jdbcType=VARCHAR},
            bankorgcode = #{bankorgcode,jdbcType=VARCHAR},
            payername = #{payername,jdbcType=VARCHAR},
            payerattr = #{payerattr,jdbcType=VARCHAR},
            payerorgcode = #{payerorgcode,jdbcType=VARCHAR},
            payeracct = #{payeracct,jdbcType=VARCHAR},
            payeename = #{payeename,jdbcType=VARCHAR},
            payeecountrycode = #{payeecountrycode,jdbcType=VARCHAR},
            recebankcode = #{recebankcode,jdbcType=VARCHAR},
            payeeaccttype = #{payeeaccttype,jdbcType=VARCHAR},
            payeeacct = #{payeeacct,jdbcType=VARCHAR},
            allamt = #{allamt,jdbcType=DECIMAL},
            payerdate = #{payerdate,jdbcType=DATE},
            balancemode = #{balancemode,jdbcType=VARCHAR},
            payercny = #{payercny,jdbcType=VARCHAR},
            ifrefund = #{ifrefund,jdbcType=VARCHAR},
            oriinclevyno = #{oriinclevyno,jdbcType=VARCHAR},
            banktrano = #{banktrano,jdbcType=VARCHAR},
            paymentlist = #{paymentlist,jdbcType=INTEGER},
            payflg = #{payflg,jdbcType=VARCHAR},
            ownextkey = #{ownextkey,jdbcType=VARCHAR},
            sbankname = #{sbankname,jdbcType=VARCHAR},
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <delete id="deleteByIds">
        delete from act where inr in
        <foreach item="item" index="index" collection="collection" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

    <update id="dyncUpdate">
        update tdb
        <set>
            <if test="module.ver != null">ver = #{module.ver,jdbcType=VARCHAR},</if>
            <if test="module.sta != null">sta = #{module.sta,jdbcType=VARCHAR},</if>
            <if test="module.levyno != null">levyno = #{module.levyno,jdbcType=VARCHAR},</if>
            <if test="module.opertype != null">opertype = #{module.opertype,jdbcType=VARCHAR},</if>
            <if test="module.actiondesc != null">actiondesc = #{module.actiondesc,jdbcType=VARCHAR},</if>
            <if test="module.bankorgcode != null">bankorgcode = #{module.bankorgcode,jdbcType=VARCHAR},</if>
            <if test="module.payername != null">payername = #{module.payername,jdbcType=VARCHAR},</if>
            <if test="module.payerattr != null">payerattr = #{module.payerattr,jdbcType=VARCHAR},</if>
            <if test="module.payerorgcode != null">payerorgcode = #{module.payerorgcode,jdbcType=VARCHAR},</if>
            <if test="module.payeracct != null">payeracct = #{module.payeracct,jdbcType=VARCHAR},</if>
            <if test="module.payeename != null">payeename = #{module.payeename,jdbcType=VARCHAR},</if>
            <if test="module.payeecountrycode != null">payeecountrycode = #{module.payeecountrycode,jdbcType=VARCHAR},</if>
            <if test="module.recebankcode != null">recebankcode = #{module.recebankcode,jdbcType=VARCHAR},</if>
            <if test="module.payeeaccttype != null">payeeaccttype = #{module.payeeaccttype,jdbcType=VARCHAR},</if>
            <if test="module.payeeacct != null">payeeacct = #{module.payeeacct,jdbcType=VARCHAR},</if>
            <if test="module.allamt != null">allamt = #{module.allamt,jdbcType=DECIMAL},</if>
            <if test="module.payerdate != null">payerdate = #{module.payerdate,jdbcType=DATE},</if>
            <if test="module.balancemode != null">balancemode = #{module.balancemode,jdbcType=VARCHAR},</if>
            <if test="module.payercny != null">payercny = #{module.payercny,jdbcType=VARCHAR},</if>
            <if test="module.ifrefund != null">ifrefund = #{module.ifrefund,jdbcType=VARCHAR},</if>
            <if test="module.oriinclevyno != null">oriinclevyno = #{module.oriinclevyno,jdbcType=VARCHAR},</if>
            <if test="module.banktrano != null">banktrano = #{module.banktrano,jdbcType=VARCHAR},</if>
            <if test="module.paymentlist != null">paymentlist = #{module.paymentlist,jdbcType=INTEGER},</if>
            <if test="module.payflg != null">payflg = #{module.payflg,jdbcType=VARCHAR},</if>
            <if test="module.ownextkey != null">ownextkey = #{module.ownextkey,jdbcType=VARCHAR},</if>
            <if test="module.sbankname != null">sbankname = #{module.sbankname,jdbcType=VARCHAR},</if>
        </set>
        ${conditions}
    </update>

    <delete id="dyncDelete">
        ${sql}
    </delete>

    <select id="dyncRead" resultMap="BaseResultMap">
        ${sql}
    </select>

    <select id="selectTdbByOwnref" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from tdb
        where banktrano = #{banktrano,jdbcType=VARCHAR}
        order by id desc
        limit 0,1
    </select>

</mapper>