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

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.bopdecbo.Dbh">
        <result property="inr" column="inr" jdbcType="VARCHAR" />
        <result property="tmpref" column="tmpref" jdbcType="VARCHAR" />
        <result property="ownextkey" column="ownextkey" jdbcType="VARCHAR" />
        <result property="ver" column="ver" jdbcType="VARCHAR" />
        <result property="actiontype" column="actiontype" jdbcType="VARCHAR" />
        <result property="actiondesc" column="actiondesc" jdbcType="VARCHAR" />
        <result property="rptno" column="rptno" jdbcType="VARCHAR" />
        <result property="country" column="country" jdbcType="VARCHAR" />
        <result property="paytype" column="paytype" jdbcType="VARCHAR" />
        <result property="txcode" column="txcode" jdbcType="VARCHAR" />
        <result property="tc1amt" column="tc1amt" jdbcType="DECIMAL" />
        <result property="txrem" column="txrem" jdbcType="VARCHAR" />
        <result property="txcode2" column="txcode2" jdbcType="VARCHAR" />
        <result property="tc2amt" column="tc2amt" jdbcType="DECIMAL" />
        <result property="tx2rem" column="tx2rem" jdbcType="VARCHAR" />
        <result property="isref" column="isref" jdbcType="VARCHAR" />
        <result property="crtuser" column="crtuser" jdbcType="VARCHAR" />
        <result property="inptelc" column="inptelc" jdbcType="VARCHAR" />
        <result property="rptdate" column="rptdate" jdbcType="DATE" />
        <result property="regno" column="regno" jdbcType="VARCHAR" />
    </resultMap>

    <sql id="Base_Column_List">
        inr,tmpref,ownextkey,ver,actiontype,actiondesc,rptno,country,paytype,txcode,tc1amt,txrem,txcode2,tc2amt,tx2rem,isref,crtuser,inptelc,rptdate,regno
    </sql>

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

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

    <insert id="insert">
        insert into dbh (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{tmpref,jdbcType=VARCHAR},
            #{ownextkey,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            #{actiontype,jdbcType=VARCHAR},
            #{actiondesc,jdbcType=VARCHAR},
            #{rptno,jdbcType=VARCHAR},
            #{country,jdbcType=VARCHAR},
            #{paytype,jdbcType=VARCHAR},
            #{txcode,jdbcType=VARCHAR},
            #{tc1amt,jdbcType=DECIMAL},
            #{txrem,jdbcType=VARCHAR},
            #{txcode2,jdbcType=VARCHAR},
            #{tc2amt,jdbcType=DECIMAL},
            #{tx2rem,jdbcType=VARCHAR},
            #{isref,jdbcType=VARCHAR},
            #{crtuser,jdbcType=VARCHAR},
            #{inptelc,jdbcType=VARCHAR},
            #{rptdate,jdbcType=DATE},
            #{regno,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into dbh
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="tmpref != null">tmpref,</if>
            <if test="ownextkey != null">ownextkey,</if>
            <if test="ver != null">ver,</if>
            <if test="actiontype != null">actiontype,</if>
            <if test="actiondesc != null">actiondesc,</if>
            <if test="rptno != null">rptno,</if>
            <if test="country != null">country,</if>
            <if test="paytype != null">paytype,</if>
            <if test="txcode != null">txcode,</if>
            <if test="tc1amt != null">tc1amt,</if>
            <if test="txrem != null">txrem,</if>
            <if test="txcode2 != null">txcode2,</if>
            <if test="tc2amt != null">tc2amt,</if>
            <if test="tx2rem != null">tx2rem,</if>
            <if test="isref != null">isref,</if>
            <if test="crtuser != null">crtuser,</if>
            <if test="inptelc != null">inptelc,</if>
            <if test="rptdate != null">rptdate,</if>
            <if test="regno != null">regno,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR}, </if>
            <if test="tmpref != null">#{tmpref,jdbcType=VARCHAR}, </if>
            <if test="ownextkey != null">#{ownextkey,jdbcType=VARCHAR}, </if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR}, </if>
            <if test="actiontype != null">#{actiontype,jdbcType=VARCHAR}, </if>
            <if test="actiondesc != null">#{actiondesc,jdbcType=VARCHAR}, </if>
            <if test="rptno != null">#{rptno,jdbcType=VARCHAR}, </if>
            <if test="country != null">#{country,jdbcType=VARCHAR}, </if>
            <if test="paytype != null">#{paytype,jdbcType=VARCHAR}, </if>
            <if test="txcode != null">#{txcode,jdbcType=VARCHAR}, </if>
            <if test="tc1amt != null">#{tc1amt,jdbcType=DECIMAL}, </if>
            <if test="txrem != null">#{txrem,jdbcType=VARCHAR}, </if>
            <if test="txcode2 != null">#{txcode2,jdbcType=VARCHAR}, </if>
            <if test="tc2amt != null">#{tc2amt,jdbcType=DECIMAL}, </if>
            <if test="tx2rem != null">#{tx2rem,jdbcType=VARCHAR}, </if>
            <if test="isref != null">#{isref,jdbcType=VARCHAR}, </if>
            <if test="crtuser != null">#{crtuser,jdbcType=VARCHAR}, </if>
            <if test="inptelc != null">#{inptelc,jdbcType=VARCHAR}, </if>
            <if test="rptdate != null">#{rptdate,jdbcType=DATE}, </if>
            <if test="regno != null">#{regno,jdbcType=VARCHAR}, </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update dbh
        <set>
            <if test="tmpref != null">tmpref = #{tmpref,jdbcType=VARCHAR},</if>
            <if test="ownextkey != null">ownextkey = #{ownextkey,jdbcType=VARCHAR},</if>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            <if test="actiontype != null">actiontype = #{actiontype,jdbcType=VARCHAR},</if>
            <if test="actiondesc != null">actiondesc = #{actiondesc,jdbcType=VARCHAR},</if>
            <if test="rptno != null">rptno = #{rptno,jdbcType=VARCHAR},</if>
            <if test="country != null">country = #{country,jdbcType=VARCHAR},</if>
            <if test="paytype != null">paytype = #{paytype,jdbcType=VARCHAR},</if>
            <if test="txcode != null">txcode = #{txcode,jdbcType=VARCHAR},</if>
            <if test="tc1amt != null">tc1amt = #{tc1amt,jdbcType=DECIMAL},</if>
            <if test="txrem != null">txrem = #{txrem,jdbcType=VARCHAR},</if>
            <if test="txcode2 != null">txcode2 = #{txcode2,jdbcType=VARCHAR},</if>
            <if test="tc2amt != null">tc2amt = #{tc2amt,jdbcType=DECIMAL},</if>
            <if test="tx2rem != null">tx2rem = #{tx2rem,jdbcType=VARCHAR},</if>
            <if test="isref != null">isref = #{isref,jdbcType=VARCHAR},</if>
            <if test="crtuser != null">crtuser = #{crtuser,jdbcType=VARCHAR},</if>
            <if test="inptelc != null">inptelc = #{inptelc,jdbcType=VARCHAR},</if>
            <if test="rptdate != null">rptdate = #{rptdate,jdbcType=DATE},</if>
            <if test="regno != null">regno = #{regno,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update dbh
        <set>
            tmpref = #{tmpref,jdbcType=VARCHAR},
            ownextkey = #{ownextkey,jdbcType=VARCHAR},
            ver = #{ver,jdbcType=VARCHAR},
            actiontype = #{actiontype,jdbcType=VARCHAR},
            actiondesc = #{actiondesc,jdbcType=VARCHAR},
            rptno = #{rptno,jdbcType=VARCHAR},
            country = #{country,jdbcType=VARCHAR},
            paytype = #{paytype,jdbcType=VARCHAR},
            txcode = #{txcode,jdbcType=VARCHAR},
            tc1amt = #{tc1amt,jdbcType=DECIMAL},
            txrem = #{txrem,jdbcType=VARCHAR},
            txcode2 = #{txcode2,jdbcType=VARCHAR},
            tc2amt = #{tc2amt,jdbcType=DECIMAL},
            tx2rem = #{tx2rem,jdbcType=VARCHAR},
            isref = #{isref,jdbcType=VARCHAR},
            crtuser = #{crtuser,jdbcType=VARCHAR},
            inptelc = #{inptelc,jdbcType=VARCHAR},
            rptdate = #{rptdate,jdbcType=DATE},
            regno = #{regno,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>

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

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

    <select id="selectByRptnoAndTmpref" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from dbh
        where rptno = #{rptno} and tmpref=#{tmpref}
    </select>

    <select id="selectByTmpref" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from dbh
        where tmpref=#{tmpref}
    </select>

</mapper>