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

    <resultMap id="BaseResultMap" type="com.brilliance.isc.common.rmbbop.entity.Tdo">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="sta" column="sta" jdbcType="VARCHAR"/>
        <result property="opertype" column="opertype" jdbcType="VARCHAR"/>
        <result property="levyno" column="levyno" jdbcType="VARCHAR"/>
        <result property="actiondesc" column="actiondesc" jdbcType="VARCHAR"/>
        <result property="leorgcode" column="leorgcode" jdbcType="VARCHAR"/>
        <result property="guaappname" column="guaappname" jdbcType="VARCHAR"/>
        <result property="guaappcode" column="guaappcode" jdbcType="VARCHAR"/>
        <result property="voucherswiftbic" column="voucherswiftbic" jdbcType="VARCHAR"/>
        <result property="vouchername" column="vouchername" jdbcType="VARCHAR"/>
        <result property="vouchertype" column="vouchertype" jdbcType="VARCHAR"/>
        <result property="vouchercountrycode" column="vouchercountrycode" jdbcType="VARCHAR"/>
        <result property="voucheeorgcode" column="voucheeorgcode" jdbcType="VARCHAR"/>
        <result property="voucheename" column="voucheename" jdbcType="VARCHAR"/>
        <result property="voucheetype" column="voucheetype" jdbcType="VARCHAR"/>
        <result property="voucheecountrycode" column="voucheecountrycode" jdbcType="VARCHAR"/>
        <result property="debtororgcode" column="debtororgcode" jdbcType="VARCHAR"/>
        <result property="debtorname" column="debtorname" jdbcType="VARCHAR"/>
        <result property="debtorcountrycode" column="debtorcountrycode" jdbcType="VARCHAR"/>
        <result property="reverseorgcode" column="reverseorgcode" jdbcType="VARCHAR"/>
        <result property="reversename" column="reversename" jdbcType="VARCHAR"/>
        <result property="reversecountrycode" column="reversecountrycode" jdbcType="VARCHAR"/>
        <result property="propertycountrycode" column="propertycountrycode" jdbcType="VARCHAR"/>
        <result property="vouchtype" column="vouchtype" jdbcType="VARCHAR"/>
        <result property="vouchmode" column="vouchmode" jdbcType="VARCHAR"/>
        <result property="currencycode" column="currencycode" jdbcType="VARCHAR"/>
        <result property="vouchamt" column="vouchamt" jdbcType="DECIMAL"/>
        <result property="vouchefficientdate" column="vouchefficientdate" jdbcType="DATE"/>
        <result property="vouchenddate" column="vouchenddate" jdbcType="DATE"/>
        <result property="contractno" column="contractno" jdbcType="VARCHAR"/>
        <result property="vouchno" column="vouchno" jdbcType="VARCHAR"/>
        <result property="banktrano" column="banktrano" jdbcType="VARCHAR"/>
        <result property="addword" column="addword" 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,opertype,levyno,actiondesc,leorgcode,guaappname,guaappcode,voucherswiftbic,vouchername,vouchertype,vouchercountrycode,voucheeorgcode,voucheename,voucheetype,voucheecountrycode,debtororgcode,debtorname,debtorcountrycode,reverseorgcode,reversename,reversecountrycode,propertycountrycode,vouchtype,vouchmode,currencycode,vouchamt,vouchefficientdate,vouchenddate,contractno,vouchno,banktrano,addword,ownextkey,sbankname
    </sql>

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

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

    <insert id="insert">
        insert into tdo (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            #{sta,jdbcType=VARCHAR},
            #{opertype,jdbcType=VARCHAR},
            #{levyno,jdbcType=VARCHAR},
            #{actiondesc,jdbcType=VARCHAR},
            #{leorgcode,jdbcType=VARCHAR},
            #{guaappname,jdbcType=VARCHAR},
            #{guaappcode,jdbcType=VARCHAR},
            #{voucherswiftbic,jdbcType=VARCHAR},
            #{vouchername,jdbcType=VARCHAR},
            #{vouchertype,jdbcType=VARCHAR},
            #{vouchercountrycode,jdbcType=VARCHAR},
            #{voucheeorgcode,jdbcType=VARCHAR},
            #{voucheename,jdbcType=VARCHAR},
            #{voucheetype,jdbcType=VARCHAR},
            #{voucheecountrycode,jdbcType=VARCHAR},
            #{debtororgcode,jdbcType=VARCHAR},
            #{debtorname,jdbcType=VARCHAR},
            #{debtorcountrycode,jdbcType=VARCHAR},
            #{reverseorgcode,jdbcType=VARCHAR},
            #{reversename,jdbcType=VARCHAR},
            #{reversecountrycode,jdbcType=VARCHAR},
            #{propertycountrycode,jdbcType=VARCHAR},
            #{vouchtype,jdbcType=VARCHAR},
            #{vouchmode,jdbcType=VARCHAR},
            #{currencycode,jdbcType=VARCHAR},
            #{vouchamt,jdbcType=DECIMAL},
            #{vouchefficientdate,jdbcType=DATE},
            #{vouchenddate,jdbcType=DATE},
            #{contractno,jdbcType=VARCHAR},
            #{vouchno,jdbcType=VARCHAR},
            #{banktrano,jdbcType=VARCHAR},
            #{addword,jdbcType=VARCHAR},
            #{ownextkey,jdbcType=VARCHAR},
            #{sbankname,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into tdo
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="ver != null">ver,</if>
            <if test="sta != null">sta,</if>
            <if test="opertype != null">opertype,</if>
            <if test="levyno != null">levyno,</if>
            <if test="actiondesc != null">actiondesc,</if>
            <if test="leorgcode != null">leorgcode,</if>
            <if test="guaappname != null">guaappname,</if>
            <if test="guaappcode != null">guaappcode,</if>
            <if test="voucherswiftbic != null">voucherswiftbic,</if>
            <if test="vouchername != null">vouchername,</if>
            <if test="vouchertype != null">vouchertype,</if>
            <if test="vouchercountrycode != null">vouchercountrycode,</if>
            <if test="voucheeorgcode != null">voucheeorgcode,</if>
            <if test="voucheename != null">voucheename,</if>
            <if test="voucheetype != null">voucheetype,</if>
            <if test="voucheecountrycode != null">voucheecountrycode,</if>
            <if test="debtororgcode != null">debtororgcode,</if>
            <if test="debtorname != null">debtorname,</if>
            <if test="debtorcountrycode != null">debtorcountrycode,</if>
            <if test="reverseorgcode != null">reverseorgcode,</if>
            <if test="reversename != null">reversename,</if>
            <if test="reversecountrycode != null">reversecountrycode,</if>
            <if test="propertycountrycode != null">propertycountrycode,</if>
            <if test="vouchtype != null">vouchtype,</if>
            <if test="vouchmode != null">vouchmode,</if>
            <if test="currencycode != null">currencycode,</if>
            <if test="vouchamt != null">vouchamt,</if>
            <if test="vouchefficientdate != null">vouchefficientdate,</if>
            <if test="vouchenddate != null">vouchenddate,</if>
            <if test="contractno != null">contractno,</if>
            <if test="vouchno != null">vouchno,</if>
            <if test="banktrano != null">banktrano,</if>
            <if test="addword != null">addword,</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="opertype != null">#{opertype,jdbcType=VARCHAR}, </if>
            <if test="levyno != null">#{levyno,jdbcType=VARCHAR}, </if>
            <if test="actiondesc != null">#{actiondesc,jdbcType=VARCHAR}, </if>
            <if test="leorgcode != null">#{leorgcode,jdbcType=VARCHAR}, </if>
            <if test="guaappname != null">#{guaappname,jdbcType=VARCHAR}, </if>
            <if test="guaappcode != null">#{guaappcode,jdbcType=VARCHAR}, </if>
            <if test="voucherswiftbic != null">#{voucherswiftbic,jdbcType=VARCHAR}, </if>
            <if test="vouchername != null">#{vouchername,jdbcType=VARCHAR}, </if>
            <if test="vouchertype != null">#{vouchertype,jdbcType=VARCHAR}, </if>
            <if test="vouchercountrycode != null">#{vouchercountrycode,jdbcType=VARCHAR}, </if>
            <if test="voucheeorgcode != null">#{voucheeorgcode,jdbcType=VARCHAR}, </if>
            <if test="voucheename != null">#{voucheename,jdbcType=VARCHAR}, </if>
            <if test="voucheetype != null">#{voucheetype,jdbcType=VARCHAR}, </if>
            <if test="voucheecountrycode != null">#{voucheecountrycode,jdbcType=VARCHAR}, </if>
            <if test="debtororgcode != null">#{debtororgcode,jdbcType=VARCHAR}, </if>
            <if test="debtorname != null">#{debtorname,jdbcType=VARCHAR}, </if>
            <if test="debtorcountrycode != null">#{debtorcountrycode,jdbcType=VARCHAR}, </if>
            <if test="reverseorgcode != null">#{reverseorgcode,jdbcType=VARCHAR}, </if>
            <if test="reversename != null">#{reversename,jdbcType=VARCHAR}, </if>
            <if test="reversecountrycode != null">#{reversecountrycode,jdbcType=VARCHAR}, </if>
            <if test="propertycountrycode != null">#{propertycountrycode,jdbcType=VARCHAR}, </if>
            <if test="vouchtype != null">#{vouchtype,jdbcType=VARCHAR}, </if>
            <if test="vouchmode != null">#{vouchmode,jdbcType=VARCHAR}, </if>
            <if test="currencycode != null">#{currencycode,jdbcType=VARCHAR}, </if>
            <if test="vouchamt != null">#{vouchamt,jdbcType=DECIMAL}, </if>
            <if test="vouchefficientdate != null">#{vouchefficientdate,jdbcType=DATE}, </if>
            <if test="vouchenddate != null">#{vouchenddate,jdbcType=DATE}, </if>
            <if test="contractno != null">#{contractno,jdbcType=VARCHAR}, </if>
            <if test="vouchno != null">#{vouchno,jdbcType=VARCHAR}, </if>
            <if test="banktrano != null">#{banktrano,jdbcType=VARCHAR}, </if>
            <if test="addword != null">#{addword,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 tdo
        <set>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            <if test="sta != null">sta = #{sta,jdbcType=VARCHAR},</if>
            <if test="opertype != null">opertype = #{opertype,jdbcType=VARCHAR},</if>
            <if test="levyno != null">levyno = #{levyno,jdbcType=VARCHAR},</if>
            <if test="actiondesc != null">actiondesc = #{actiondesc,jdbcType=VARCHAR},</if>
            <if test="leorgcode != null">leorgcode = #{leorgcode,jdbcType=VARCHAR},</if>
            <if test="guaappname != null">guaappname = #{guaappname,jdbcType=VARCHAR},</if>
            <if test="guaappcode != null">guaappcode = #{guaappcode,jdbcType=VARCHAR},</if>
            <if test="voucherswiftbic != null">voucherswiftbic = #{voucherswiftbic,jdbcType=VARCHAR},</if>
            <if test="vouchername != null">vouchername = #{vouchername,jdbcType=VARCHAR},</if>
            <if test="vouchertype != null">vouchertype = #{vouchertype,jdbcType=VARCHAR},</if>
            <if test="vouchercountrycode != null">vouchercountrycode = #{vouchercountrycode,jdbcType=VARCHAR},</if>
            <if test="voucheeorgcode != null">voucheeorgcode = #{voucheeorgcode,jdbcType=VARCHAR},</if>
            <if test="voucheename != null">voucheename = #{voucheename,jdbcType=VARCHAR},</if>
            <if test="voucheetype != null">voucheetype = #{voucheetype,jdbcType=VARCHAR},</if>
            <if test="voucheecountrycode != null">voucheecountrycode = #{voucheecountrycode,jdbcType=VARCHAR},</if>
            <if test="debtororgcode != null">debtororgcode = #{debtororgcode,jdbcType=VARCHAR},</if>
            <if test="debtorname != null">debtorname = #{debtorname,jdbcType=VARCHAR},</if>
            <if test="debtorcountrycode != null">debtorcountrycode = #{debtorcountrycode,jdbcType=VARCHAR},</if>
            <if test="reverseorgcode != null">reverseorgcode = #{reverseorgcode,jdbcType=VARCHAR},</if>
            <if test="reversename != null">reversename = #{reversename,jdbcType=VARCHAR},</if>
            <if test="reversecountrycode != null">reversecountrycode = #{reversecountrycode,jdbcType=VARCHAR},</if>
            <if test="propertycountrycode != null">propertycountrycode = #{propertycountrycode,jdbcType=VARCHAR},</if>
            <if test="vouchtype != null">vouchtype = #{vouchtype,jdbcType=VARCHAR},</if>
            <if test="vouchmode != null">vouchmode = #{vouchmode,jdbcType=VARCHAR},</if>
            <if test="currencycode != null">currencycode = #{currencycode,jdbcType=VARCHAR},</if>
            <if test="vouchamt != null">vouchamt = #{vouchamt,jdbcType=DECIMAL},</if>
            <if test="vouchefficientdate != null">vouchefficientdate = #{vouchefficientdate,jdbcType=DATE},</if>
            <if test="vouchenddate != null">vouchenddate = #{vouchenddate,jdbcType=DATE},</if>
            <if test="contractno != null">contractno = #{contractno,jdbcType=VARCHAR},</if>
            <if test="vouchno != null">vouchno = #{vouchno,jdbcType=VARCHAR},</if>
            <if test="banktrano != null">banktrano = #{banktrano,jdbcType=VARCHAR},</if>
            <if test="addword != null">addword = #{addword,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 tdo
        <set>
            ver = #{ver,jdbcType=VARCHAR},
            sta = #{sta,jdbcType=VARCHAR},
            opertype = #{opertype,jdbcType=VARCHAR},
            levyno = #{levyno,jdbcType=VARCHAR},
            actiondesc = #{actiondesc,jdbcType=VARCHAR},
            leorgcode = #{leorgcode,jdbcType=VARCHAR},
            guaappname = #{guaappname,jdbcType=VARCHAR},
            guaappcode = #{guaappcode,jdbcType=VARCHAR},
            voucherswiftbic = #{voucherswiftbic,jdbcType=VARCHAR},
            vouchername = #{vouchername,jdbcType=VARCHAR},
            vouchertype = #{vouchertype,jdbcType=VARCHAR},
            vouchercountrycode = #{vouchercountrycode,jdbcType=VARCHAR},
            voucheeorgcode = #{voucheeorgcode,jdbcType=VARCHAR},
            voucheename = #{voucheename,jdbcType=VARCHAR},
            voucheetype = #{voucheetype,jdbcType=VARCHAR},
            voucheecountrycode = #{voucheecountrycode,jdbcType=VARCHAR},
            debtororgcode = #{debtororgcode,jdbcType=VARCHAR},
            debtorname = #{debtorname,jdbcType=VARCHAR},
            debtorcountrycode = #{debtorcountrycode,jdbcType=VARCHAR},
            reverseorgcode = #{reverseorgcode,jdbcType=VARCHAR},
            reversename = #{reversename,jdbcType=VARCHAR},
            reversecountrycode = #{reversecountrycode,jdbcType=VARCHAR},
            propertycountrycode = #{propertycountrycode,jdbcType=VARCHAR},
            vouchtype = #{vouchtype,jdbcType=VARCHAR},
            vouchmode = #{vouchmode,jdbcType=VARCHAR},
            currencycode = #{currencycode,jdbcType=VARCHAR},
            vouchamt = #{vouchamt,jdbcType=DECIMAL},
            vouchefficientdate = #{vouchefficientdate,jdbcType=DATE},
            vouchenddate = #{vouchenddate,jdbcType=DATE},
            contractno = #{contractno,jdbcType=VARCHAR},
            vouchno = #{vouchno,jdbcType=VARCHAR},
            banktrano = #{banktrano,jdbcType=VARCHAR},
            addword = #{addword,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 tdo
        <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.opertype != null">opertype = #{module.opertype,jdbcType=VARCHAR},</if>
            <if test="module.levyno != null">levyno = #{module.levyno,jdbcType=VARCHAR},</if>
            <if test="module.actiondesc != null">actiondesc = #{module.actiondesc,jdbcType=VARCHAR},</if>
            <if test="module.leorgcode != null">leorgcode = #{module.leorgcode,jdbcType=VARCHAR},</if>
            <if test="module.guaappname != null">guaappname = #{module.guaappname,jdbcType=VARCHAR},</if>
            <if test="module.guaappcode != null">guaappcode = #{module.guaappcode,jdbcType=VARCHAR},</if>
            <if test="module.voucherswiftbic != null">voucherswiftbic = #{module.voucherswiftbic,jdbcType=VARCHAR},</if>
            <if test="module.vouchername != null">vouchername = #{module.vouchername,jdbcType=VARCHAR},</if>
            <if test="module.vouchertype != null">vouchertype = #{module.vouchertype,jdbcType=VARCHAR},</if>
            <if test="module.vouchercountrycode != null">vouchercountrycode = #{module.vouchercountrycode,jdbcType=VARCHAR},</if>
            <if test="module.voucheeorgcode != null">voucheeorgcode = #{module.voucheeorgcode,jdbcType=VARCHAR},</if>
            <if test="module.voucheename != null">voucheename = #{module.voucheename,jdbcType=VARCHAR},</if>
            <if test="module.voucheetype != null">voucheetype = #{module.voucheetype,jdbcType=VARCHAR},</if>
            <if test="module.voucheecountrycode != null">voucheecountrycode = #{module.voucheecountrycode,jdbcType=VARCHAR},</if>
            <if test="module.debtororgcode != null">debtororgcode = #{module.debtororgcode,jdbcType=VARCHAR},</if>
            <if test="module.debtorname != null">debtorname = #{module.debtorname,jdbcType=VARCHAR},</if>
            <if test="module.debtorcountrycode != null">debtorcountrycode = #{module.debtorcountrycode,jdbcType=VARCHAR},</if>
            <if test="module.reverseorgcode != null">reverseorgcode = #{module.reverseorgcode,jdbcType=VARCHAR},</if>
            <if test="module.reversename != null">reversename = #{module.reversename,jdbcType=VARCHAR},</if>
            <if test="module.reversecountrycode != null">reversecountrycode = #{module.reversecountrycode,jdbcType=VARCHAR},</if>
            <if test="module.propertycountrycode != null">propertycountrycode = #{module.propertycountrycode,jdbcType=VARCHAR},</if>
            <if test="module.vouchtype != null">vouchtype = #{module.vouchtype,jdbcType=VARCHAR},</if>
            <if test="module.vouchmode != null">vouchmode = #{module.vouchmode,jdbcType=VARCHAR},</if>
            <if test="module.currencycode != null">currencycode = #{module.currencycode,jdbcType=VARCHAR},</if>
            <if test="module.vouchamt != null">vouchamt = #{module.vouchamt,jdbcType=DECIMAL},</if>
            <if test="module.vouchefficientdate != null">vouchefficientdate = #{module.vouchefficientdate,jdbcType=DATE},</if>
            <if test="module.vouchenddate != null">vouchenddate = #{module.vouchenddate,jdbcType=DATE},</if>
            <if test="module.contractno != null">contractno = #{module.contractno,jdbcType=VARCHAR},</if>
            <if test="module.vouchno != null">vouchno = #{module.vouchno,jdbcType=VARCHAR},</if>
            <if test="module.banktrano != null">banktrano = #{module.banktrano,jdbcType=VARCHAR},</if>
            <if test="module.addword != null">addword = #{module.addword,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="selectTdoByOwnref" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from tdo
        where banktrano = #{banktrano,jdbcType=VARCHAR}
        order by id desc
        limit 0,1
    </select>

</mapper>