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

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Trd">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="ownref" column="ownref" jdbcType="VARCHAR"/>
        <result property="nam" column="nam" jdbcType="VARCHAR"/>
        <result property="credat" column="credat" jdbcType="DATE"/>
        <result property="pnttyp" column="pnttyp" jdbcType="VARCHAR"/>
        <result property="pntinr" column="pntinr" jdbcType="VARCHAR"/>
        <result property="pntnam" column="pntnam" jdbcType="VARCHAR"/>
        <result property="pntref" column="pntref" jdbcType="VARCHAR"/>
        <result property="issdat" column="issdat" jdbcType="DATE"/>
        <result property="matdat" column="matdat" jdbcType="DATE"/>
        <result property="lstintdat" column="lstintdat" jdbcType="DATE"/>
        <result property="stttendat" column="stttendat" jdbcType="DATE"/>
        <result property="spddat" column="spddat" jdbcType="DATE"/>
        <result property="opndat" column="opndat" jdbcType="DATE"/>
        <result property="clsdat" column="clsdat" jdbcType="DATE"/>
        <result property="tenday" column="tenday" jdbcType="NUMERIC"/>
        <result property="actfinday" column="actfinday" jdbcType="INTEGER"/>
        <result property="intrat" column="intrat" jdbcType="DECIMAL"/>
        <result property="ownusr" column="ownusr" jdbcType="VARCHAR"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="irtcod" column="irtcod" jdbcType="VARCHAR"/>
        <result property="extnmb" column="extnmb" jdbcType="INTEGER"/>
        <result property="fintyp" column="fintyp" jdbcType="VARCHAR"/>
        <result property="pctfin" column="pctfin" jdbcType="DECIMAL"/>
        <result property="stagod" column="stagod" jdbcType="VARCHAR"/>
        <result property="stacty" column="stacty" jdbcType="VARCHAR"/>
        <result property="jzllgz" column="jzllgz" jdbcType="VARCHAR"/>
        <result property="etyextkey" column="etyextkey" jdbcType="VARCHAR"/>
        <result property="marrat" column="marrat" jdbcType="DECIMAL"/>
        <result property="grarat" column="grarat" jdbcType="DECIMAL"/>
        <result property="actrat" column="actrat" jdbcType="DECIMAL"/>
        <result property="bchkeyinr" column="bchkeyinr" jdbcType="VARCHAR"/>
        <result property="branchinr" column="branchinr" jdbcType="VARCHAR"/>
        <result property="fincod" column="fincod" jdbcType="VARCHAR"/>
        <result property="finact" column="finact" jdbcType="VARCHAR"/>
        <result property="finblk" column="finblk" jdbcType="VARCHAR"/>
        <result property="itfblk" column="itfblk" jdbcType="VARCHAR"/>
        <result property="ovddat" column="ovddat" jdbcType="DATE"/>
        <result property="ovdflg" column="ovdflg" jdbcType="VARCHAR"/>
        <result property="feetyp" column="feetyp" jdbcType="VARCHAR"/>
        <result property="feeamt" column="feeamt" jdbcType="DECIMAL"/>
        <result property="actyld" column="actyld" jdbcType="DECIMAL"/>
        <result property="guaflg" column="guaflg" jdbcType="VARCHAR"/>
        <result property="oseflg" column="oseflg" jdbcType="VARCHAR"/>
        <result property="oseday" column="oseday" jdbcType="INTEGER"/>
        <result property="dinjdm" column="dinjdm" jdbcType="VARCHAR"/>
        <result property="trntyp" column="trntyp" jdbcType="VARCHAR"/>
        <result property="oppacc" column="oppacc" jdbcType="VARCHAR"/>
        <result property="flowflag" column="flowflag" jdbcType="VARCHAR"/>
        <result property="recaccount" column="recaccount" jdbcType="VARCHAR"/>
        <result property="recname" column="recname" jdbcType="VARCHAR"/>
        <result property="reccountrycode" column="reccountrycode" jdbcType="VARCHAR"/>
        <result property="recdistrictcode" column="recdistrictcode" jdbcType="VARCHAR"/>
        <result property="shuilv" column="shuilv" jdbcType="DECIMAL"/>
        <result property="invtyp" column="invtyp" jdbcType="VARCHAR"/>
        <result property="lprtyp" column="lprtyp" jdbcType="VARCHAR"/>
        <result property="mycontno" column="mycontno" jdbcType="VARCHAR"/>
        <result property="ffaflg" column="ffaflg" jdbcType="VARCHAR"/>
        <result property="tenorday" column="tenorday" jdbcType="INTEGER"/>
        <result property="avbby" column="avbby" jdbcType="VARCHAR"/>
        <result property="matpretyp" column="matpretyp" jdbcType="VARCHAR"/>
        <result property="goddspcn" column="goddspcn" jdbcType="VARCHAR"/>
        <result property="invref" column="invref" jdbcType="VARCHAR"/>
        <result property="prbkbic" column="prbkbic" jdbcType="VARCHAR"/>
        <result property="prbkname" column="prbkname" jdbcType="VARCHAR"/>
        <result property="sellername" column="sellername" jdbcType="VARCHAR"/>
        <result property="stzfdxzh" column="stzfdxzh" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,ownref,nam,credat,pnttyp,pntinr,pntnam,pntref,issdat,matdat,lstintdat,stttendat,spddat,opndat,clsdat,tenday,actfinday,intrat,ownusr,ver,irtcod,extnmb,fintyp,pctfin,stagod,stacty,jzllgz,etyextkey,marrat,grarat,actrat,bchkeyinr,branchinr,fincod,finact,finblk,itfblk,ovddat,ovdflg,feetyp,feeamt,actyld,guaflg,oseflg,oseday,dinjdm,trntyp,oppacc,flowflag,recaccount,recname,reccountrycode,recdistrictcode,shuilv,invtyp,lprtyp,mycontno,ffaflg,tenorday,avbby,matpretyp,goddspcn,invref,prbkbic,prbkname,sellername,stzfdxzh
    </sql>

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

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

    <insert id="insert">
        insert into trd (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{ownref,jdbcType=VARCHAR},
            #{nam,jdbcType=VARCHAR},
            #{credat,jdbcType=DATE},
            #{pnttyp,jdbcType=VARCHAR},
            #{pntinr,jdbcType=VARCHAR},
            #{pntnam,jdbcType=VARCHAR},
            #{pntref,jdbcType=VARCHAR},
            #{issdat,jdbcType=DATE},
            #{matdat,jdbcType=DATE},
            #{lstintdat,jdbcType=DATE},
            #{stttendat,jdbcType=DATE},
            #{spddat,jdbcType=DATE},
            #{opndat,jdbcType=DATE},
            #{clsdat,jdbcType=DATE},
            #{tenday,jdbcType=NUMERIC},
            #{actfinday,jdbcType=INTEGER},
            #{intrat,jdbcType=DECIMAL},
            #{ownusr,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            #{irtcod,jdbcType=VARCHAR},
            #{extnmb,jdbcType=INTEGER},
            #{fintyp,jdbcType=VARCHAR},
            #{pctfin,jdbcType=DECIMAL},
            #{stagod,jdbcType=VARCHAR},
            #{stacty,jdbcType=VARCHAR},
            #{jzllgz,jdbcType=VARCHAR},
            #{etyextkey,jdbcType=VARCHAR},
            #{marrat,jdbcType=DECIMAL},
            #{grarat,jdbcType=DECIMAL},
            #{actrat,jdbcType=DECIMAL},
            #{bchkeyinr,jdbcType=VARCHAR},
            #{branchinr,jdbcType=VARCHAR},
            #{fincod,jdbcType=VARCHAR},
            #{finact,jdbcType=VARCHAR},
            #{finblk,jdbcType=VARCHAR},
            #{itfblk,jdbcType=VARCHAR},
            #{ovddat,jdbcType=DATE},
            #{ovdflg,jdbcType=VARCHAR},
            #{feetyp,jdbcType=VARCHAR},
            #{feeamt,jdbcType=DECIMAL},
            #{actyld,jdbcType=DECIMAL},
            #{guaflg,jdbcType=VARCHAR},
            #{oseflg,jdbcType=VARCHAR},
            #{oseday,jdbcType=INTEGER},
            #{dinjdm,jdbcType=VARCHAR},
            #{trntyp,jdbcType=VARCHAR},
            #{oppacc,jdbcType=VARCHAR},
            #{flowflag,jdbcType=VARCHAR},
            #{recaccount,jdbcType=VARCHAR},
            #{recname,jdbcType=VARCHAR},
            #{reccountrycode,jdbcType=VARCHAR},
            #{recdistrictcode,jdbcType=VARCHAR},
            #{shuilv,jdbcType=DECIMAL},
            #{invtyp,jdbcType=VARCHAR},
            #{lprtyp,jdbcType=VARCHAR},
            #{mycontno,jdbcType=VARCHAR},
            #{ffaflg,jdbcType=VARCHAR},
            #{tenorday,jdbcType=INTEGER},
            #{avbby,jdbcType=VARCHAR},
            #{matpretyp,jdbcType=VARCHAR},
            #{goddspcn,jdbcType=VARCHAR},
            #{invref,jdbcType=VARCHAR},
            #{prbkbic,jdbcType=VARCHAR},
            #{prbkname,jdbcType=VARCHAR},
            #{sellername,jdbcType=VARCHAR},
            #{stzfdxzh,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into trd
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="ownref != null">ownref,</if>
            <if test="nam != null">nam,</if>
            <if test="credat != null">credat,</if>
            <if test="pnttyp != null">pnttyp,</if>
            <if test="pntinr != null">pntinr,</if>
            <if test="pntnam != null">pntnam,</if>
            <if test="pntref != null">pntref,</if>
            <if test="issdat != null">issdat,</if>
            <if test="matdat != null">matdat,</if>
            <if test="lstintdat != null">lstintdat,</if>
            <if test="stttendat != null">stttendat,</if>
            <if test="spddat != null">spddat,</if>
            <if test="opndat != null">opndat,</if>
            <if test="clsdat != null">clsdat,</if>
            <if test="tenday != null">tenday,</if>
            <if test="actfinday != null">actfinday,</if>
            <if test="intrat != null">intrat,</if>
            <if test="ownusr != null">ownusr,</if>
            <if test="ver != null">ver,</if>
            <if test="irtcod != null">irtcod,</if>
            <if test="extnmb != null">extnmb,</if>
            <if test="fintyp != null">fintyp,</if>
            <if test="pctfin != null">pctfin,</if>
            <if test="stagod != null">stagod,</if>
            <if test="stacty != null">stacty,</if>
            <if test="jzllgz != null">jzllgz,</if>
            <if test="etyextkey != null">etyextkey,</if>
            <if test="marrat != null">marrat,</if>
            <if test="grarat != null">grarat,</if>
            <if test="actrat != null">actrat,</if>
            <if test="bchkeyinr != null">bchkeyinr,</if>
            <if test="branchinr != null">branchinr,</if>
            <if test="fincod != null">fincod,</if>
            <if test="finact != null">finact,</if>
            <if test="finblk != null">finblk,</if>
            <if test="itfblk != null">itfblk,</if>
            <if test="ovddat != null">ovddat,</if>
            <if test="ovdflg != null">ovdflg,</if>
            <if test="feetyp != null">feetyp,</if>
            <if test="feeamt != null">feeamt,</if>
            <if test="actyld != null">actyld,</if>
            <if test="guaflg != null">guaflg,</if>
            <if test="oseflg != null">oseflg,</if>
            <if test="oseday != null">oseday,</if>
            <if test="dinjdm != null">dinjdm,</if>
            <if test="trntyp != null">trntyp,</if>
            <if test="oppacc != null">oppacc,</if>
            <if test="flowflag != null">flowflag,</if>
            <if test="recaccount != null">recaccount,</if>
            <if test="recname != null">recname,</if>
            <if test="reccountrycode != null">reccountrycode,</if>
            <if test="recdistrictcode != null">recdistrictcode,</if>
            <if test="shuilv != null">shuilv,</if>
            <if test="invtyp != null">invtyp,</if>
            <if test="lprtyp != null">lprtyp,</if>
            <if test="mycontno != null">mycontno,</if>
            <if test="ffaflg != null">ffaflg,</if>
            <if test="tenorday != null">tenorday,</if>
            <if test="avbby != null">avbby,</if>
            <if test="matpretyp != null">matpretyp,</if>
            <if test="goddspcn != null">goddspcn,</if>
            <if test="invref != null">invref,</if>
            <if test="prbkbic != null">prbkbic,</if>
            <if test="prbkname != null">prbkname,</if>
            <if test="sellername != null">sellername,</if>
            <if test="stzfdxzh != null">stzfdxzh,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR}, </if>
            <if test="ownref != null">#{ownref,jdbcType=VARCHAR}, </if>
            <if test="nam != null">#{nam,jdbcType=VARCHAR}, </if>
            <if test="credat != null">#{credat,jdbcType=DATE}, </if>
            <if test="pnttyp != null">#{pnttyp,jdbcType=VARCHAR}, </if>
            <if test="pntinr != null">#{pntinr,jdbcType=VARCHAR}, </if>
            <if test="pntnam != null">#{pntnam,jdbcType=VARCHAR}, </if>
            <if test="pntref != null">#{pntref,jdbcType=VARCHAR}, </if>
            <if test="issdat != null">#{issdat,jdbcType=DATE}, </if>
            <if test="matdat != null">#{matdat,jdbcType=DATE}, </if>
            <if test="lstintdat != null">#{lstintdat,jdbcType=DATE}, </if>
            <if test="stttendat != null">#{stttendat,jdbcType=DATE}, </if>
            <if test="spddat != null">#{spddat,jdbcType=DATE}, </if>
            <if test="opndat != null">#{opndat,jdbcType=DATE}, </if>
            <if test="clsdat != null">#{clsdat,jdbcType=DATE}, </if>
            <if test="tenday != null">#{tenday,jdbcType=NUMERIC}, </if>
            <if test="actfinday != null">#{actfinday,jdbcType=INTEGER}, </if>
            <if test="intrat != null">#{intrat,jdbcType=DECIMAL}, </if>
            <if test="ownusr != null">#{ownusr,jdbcType=VARCHAR}, </if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR}, </if>
            <if test="irtcod != null">#{irtcod,jdbcType=VARCHAR}, </if>
            <if test="extnmb != null">#{extnmb,jdbcType=INTEGER}, </if>
            <if test="fintyp != null">#{fintyp,jdbcType=VARCHAR}, </if>
            <if test="pctfin != null">#{pctfin,jdbcType=DECIMAL}, </if>
            <if test="stagod != null">#{stagod,jdbcType=VARCHAR}, </if>
            <if test="stacty != null">#{stacty,jdbcType=VARCHAR}, </if>
            <if test="jzllgz != null">#{jzllgz,jdbcType=VARCHAR}, </if>
            <if test="etyextkey != null">#{etyextkey,jdbcType=VARCHAR}, </if>
            <if test="marrat != null">#{marrat,jdbcType=DECIMAL}, </if>
            <if test="grarat != null">#{grarat,jdbcType=DECIMAL}, </if>
            <if test="actrat != null">#{actrat,jdbcType=DECIMAL}, </if>
            <if test="bchkeyinr != null">#{bchkeyinr,jdbcType=VARCHAR}, </if>
            <if test="branchinr != null">#{branchinr,jdbcType=VARCHAR}, </if>
            <if test="fincod != null">#{fincod,jdbcType=VARCHAR}, </if>
            <if test="finact != null">#{finact,jdbcType=VARCHAR}, </if>
            <if test="finblk != null">#{finblk,jdbcType=VARCHAR}, </if>
            <if test="itfblk != null">#{itfblk,jdbcType=VARCHAR}, </if>
            <if test="ovddat != null">#{ovddat,jdbcType=DATE}, </if>
            <if test="ovdflg != null">#{ovdflg,jdbcType=VARCHAR}, </if>
            <if test="feetyp != null">#{feetyp,jdbcType=VARCHAR}, </if>
            <if test="feeamt != null">#{feeamt,jdbcType=DECIMAL}, </if>
            <if test="actyld != null">#{actyld,jdbcType=DECIMAL}, </if>
            <if test="guaflg != null">#{guaflg,jdbcType=VARCHAR}, </if>
            <if test="oseflg != null">#{oseflg,jdbcType=VARCHAR}, </if>
            <if test="oseday != null">#{oseday,jdbcType=INTEGER}, </if>
            <if test="dinjdm != null">#{dinjdm,jdbcType=VARCHAR}, </if>
            <if test="trntyp != null">#{trntyp,jdbcType=VARCHAR}, </if>
            <if test="oppacc != null">#{oppacc,jdbcType=VARCHAR}, </if>
            <if test="flowflag != null">#{flowflag,jdbcType=VARCHAR}, </if>
            <if test="recaccount != null">#{recaccount,jdbcType=VARCHAR}, </if>
            <if test="recname != null">#{recname,jdbcType=VARCHAR}, </if>
            <if test="reccountrycode != null">#{reccountrycode,jdbcType=VARCHAR}, </if>
            <if test="recdistrictcode != null">#{recdistrictcode,jdbcType=VARCHAR}, </if>
            <if test="shuilv != null">#{shuilv,jdbcType=DECIMAL}, </if>
            <if test="invtyp != null">#{invtyp,jdbcType=VARCHAR}, </if>
            <if test="lprtyp != null">#{lprtyp,jdbcType=VARCHAR}, </if>
            <if test="mycontno != null">#{mycontno,jdbcType=VARCHAR}, </if>
            <if test="ffaflg != null">#{ffaflg,jdbcType=VARCHAR}, </if>
            <if test="tenorday != null">#{tenorday,jdbcType=INTEGER}, </if>
            <if test="avbby != null">#{avbby,jdbcType=VARCHAR}, </if>
            <if test="matpretyp != null">#{matpretyp,jdbcType=VARCHAR}, </if>
            <if test="goddspcn != null">#{goddspcn,jdbcType=VARCHAR}, </if>
            <if test="invref != null">#{invref,jdbcType=VARCHAR}, </if>
            <if test="prbkbic != null">#{prbkbic,jdbcType=VARCHAR}, </if>
            <if test="prbkname != null">#{prbkname,jdbcType=VARCHAR}, </if>
            <if test="sellername != null">#{sellername,jdbcType=VARCHAR}, </if>
            <if test="stzfdxzh != null">#{stzfdxzh,jdbcType=VARCHAR}, </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update trd
        <set>
            <if test="ownref != null">ownref = #{ownref,jdbcType=VARCHAR},</if>
            <if test="nam != null">nam = #{nam,jdbcType=VARCHAR},</if>
            <if test="credat != null">credat = #{credat,jdbcType=DATE},</if>
            <if test="pnttyp != null">pnttyp = #{pnttyp,jdbcType=VARCHAR},</if>
            <if test="pntinr != null">pntinr = #{pntinr,jdbcType=VARCHAR},</if>
            <if test="pntnam != null">pntnam = #{pntnam,jdbcType=VARCHAR},</if>
            <if test="pntref != null">pntref = #{pntref,jdbcType=VARCHAR},</if>
            <if test="issdat != null">issdat = #{issdat,jdbcType=DATE},</if>
            <if test="matdat != null">matdat = #{matdat,jdbcType=DATE},</if>
            <if test="lstintdat != null">lstintdat = #{lstintdat,jdbcType=DATE},</if>
            <if test="stttendat != null">stttendat = #{stttendat,jdbcType=DATE},</if>
            <if test="spddat != null">spddat = #{spddat,jdbcType=DATE},</if>
            <if test="opndat != null">opndat = #{opndat,jdbcType=DATE},</if>
            <if test="clsdat != null">clsdat = #{clsdat,jdbcType=DATE},</if>
            <if test="tenday != null">tenday = #{tenday,jdbcType=NUMERIC},</if>
            <if test="actfinday != null">actfinday = #{actfinday,jdbcType=INTEGER},</if>
            <if test="intrat != null">intrat = #{intrat,jdbcType=DECIMAL},</if>
            <if test="ownusr != null">ownusr = #{ownusr,jdbcType=VARCHAR},</if>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            <if test="irtcod != null">irtcod = #{irtcod,jdbcType=VARCHAR},</if>
            <if test="extnmb != null">extnmb = #{extnmb,jdbcType=INTEGER},</if>
            <if test="fintyp != null">fintyp = #{fintyp,jdbcType=VARCHAR},</if>
            <if test="pctfin != null">pctfin = #{pctfin,jdbcType=DECIMAL},</if>
            <if test="stagod != null">stagod = #{stagod,jdbcType=VARCHAR},</if>
            <if test="stacty != null">stacty = #{stacty,jdbcType=VARCHAR},</if>
            <if test="jzllgz != null">jzllgz = #{jzllgz,jdbcType=VARCHAR},</if>
            <if test="etyextkey != null">etyextkey = #{etyextkey,jdbcType=VARCHAR},</if>
            <if test="marrat != null">marrat = #{marrat,jdbcType=DECIMAL},</if>
            <if test="grarat != null">grarat = #{grarat,jdbcType=DECIMAL},</if>
            <if test="actrat != null">actrat = #{actrat,jdbcType=DECIMAL},</if>
            <if test="bchkeyinr != null">bchkeyinr = #{bchkeyinr,jdbcType=VARCHAR},</if>
            <if test="branchinr != null">branchinr = #{branchinr,jdbcType=VARCHAR},</if>
            <if test="fincod != null">fincod = #{fincod,jdbcType=VARCHAR},</if>
            <if test="finact != null">finact = #{finact,jdbcType=VARCHAR},</if>
            <if test="finblk != null">finblk = #{finblk,jdbcType=VARCHAR},</if>
            <if test="itfblk != null">itfblk = #{itfblk,jdbcType=VARCHAR},</if>
            <if test="ovddat != null">ovddat = #{ovddat,jdbcType=DATE},</if>
            <if test="ovdflg != null">ovdflg = #{ovdflg,jdbcType=VARCHAR},</if>
            <if test="feetyp != null">feetyp = #{feetyp,jdbcType=VARCHAR},</if>
            <if test="feeamt != null">feeamt = #{feeamt,jdbcType=DECIMAL},</if>
            <if test="actyld != null">actyld = #{actyld,jdbcType=DECIMAL},</if>
            <if test="guaflg != null">guaflg = #{guaflg,jdbcType=VARCHAR},</if>
            <if test="oseflg != null">oseflg = #{oseflg,jdbcType=VARCHAR},</if>
            <if test="oseday != null">oseday = #{oseday,jdbcType=INTEGER},</if>
            <if test="dinjdm != null">dinjdm = #{dinjdm,jdbcType=VARCHAR},</if>
            <if test="trntyp != null">trntyp = #{trntyp,jdbcType=VARCHAR},</if>
            <if test="oppacc != null">oppacc = #{oppacc,jdbcType=VARCHAR},</if>
            <if test="flowflag != null">flowflag = #{flowflag,jdbcType=VARCHAR},</if>
            <if test="recaccount != null">recaccount = #{recaccount,jdbcType=VARCHAR},</if>
            <if test="recname != null">recname = #{recname,jdbcType=VARCHAR},</if>
            <if test="reccountrycode != null">reccountrycode = #{reccountrycode,jdbcType=VARCHAR},</if>
            <if test="recdistrictcode != null">recdistrictcode = #{recdistrictcode,jdbcType=VARCHAR},</if>
            <if test="shuilv != null">shuilv = #{shuilv,jdbcType=DECIMAL},</if>
            <if test="invtyp != null">invtyp = #{invtyp,jdbcType=VARCHAR},</if>
            <if test="lprtyp != null">lprtyp = #{lprtyp,jdbcType=VARCHAR},</if>
            <if test="mycontno != null">mycontno = #{mycontno,jdbcType=VARCHAR},</if>
            <if test="ffaflg != null">ffaflg = #{ffaflg,jdbcType=VARCHAR},</if>
            <if test="tenorday != null">tenorday = #{tenorday,jdbcType=INTEGER},</if>
            <if test="avbby != null">avbby = #{avbby,jdbcType=VARCHAR},</if>
            <if test="matpretyp != null">matpretyp = #{matpretyp,jdbcType=VARCHAR},</if>
            <if test="goddspcn != null">goddspcn = #{goddspcn,jdbcType=VARCHAR},</if>
            <if test="invref != null">invref = #{invref,jdbcType=VARCHAR},</if>
            <if test="prbkbic != null">prbkbic = #{prbkbic,jdbcType=VARCHAR},</if>
            <if test="prbkname != null">prbkname = #{prbkname,jdbcType=VARCHAR},</if>
            <if test="sellername != null">sellername = #{sellername,jdbcType=VARCHAR},</if>
            <if test="stzfdxzh != null">stzfdxzh = #{stzfdxzh,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update trd
        <set>
            ownref = #{ownref,jdbcType=VARCHAR},
            nam = #{nam,jdbcType=VARCHAR},
            credat = #{credat,jdbcType=DATE},
            pnttyp = #{pnttyp,jdbcType=VARCHAR},
            pntinr = #{pntinr,jdbcType=VARCHAR},
            pntnam = #{pntnam,jdbcType=VARCHAR},
            pntref = #{pntref,jdbcType=VARCHAR},
            issdat = #{issdat,jdbcType=DATE},
            matdat = #{matdat,jdbcType=DATE},
            lstintdat = #{lstintdat,jdbcType=DATE},
            stttendat = #{stttendat,jdbcType=DATE},
            spddat = #{spddat,jdbcType=DATE},
            opndat = #{opndat,jdbcType=DATE},
            clsdat = #{clsdat,jdbcType=DATE},
            tenday = #{tenday,jdbcType=NUMERIC},
            actfinday = #{actfinday,jdbcType=INTEGER},
            intrat = #{intrat,jdbcType=DECIMAL},
            ownusr = #{ownusr,jdbcType=VARCHAR},
            ver = #{ver,jdbcType=VARCHAR},
            irtcod = #{irtcod,jdbcType=VARCHAR},
            extnmb = #{extnmb,jdbcType=INTEGER},
            fintyp = #{fintyp,jdbcType=VARCHAR},
            pctfin = #{pctfin,jdbcType=DECIMAL},
            stagod = #{stagod,jdbcType=VARCHAR},
            stacty = #{stacty,jdbcType=VARCHAR},
            jzllgz = #{jzllgz,jdbcType=VARCHAR},
            etyextkey = #{etyextkey,jdbcType=VARCHAR},
            marrat = #{marrat,jdbcType=DECIMAL},
            grarat = #{grarat,jdbcType=DECIMAL},
            actrat = #{actrat,jdbcType=DECIMAL},
            bchkeyinr = #{bchkeyinr,jdbcType=VARCHAR},
            branchinr = #{branchinr,jdbcType=VARCHAR},
            fincod = #{fincod,jdbcType=VARCHAR},
            finact = #{finact,jdbcType=VARCHAR},
            finblk = #{finblk,jdbcType=VARCHAR},
            itfblk = #{itfblk,jdbcType=VARCHAR},
            ovddat = #{ovddat,jdbcType=DATE},
            ovdflg = #{ovdflg,jdbcType=VARCHAR},
            feetyp = #{feetyp,jdbcType=VARCHAR},
            feeamt = #{feeamt,jdbcType=DECIMAL},
            actyld = #{actyld,jdbcType=DECIMAL},
            guaflg = #{guaflg,jdbcType=VARCHAR},
            oseflg = #{oseflg,jdbcType=VARCHAR},
            oseday = #{oseday,jdbcType=INTEGER},
            dinjdm = #{dinjdm,jdbcType=VARCHAR},
            trntyp = #{trntyp,jdbcType=VARCHAR},
            oppacc = #{oppacc,jdbcType=VARCHAR},
            flowflag = #{flowflag,jdbcType=VARCHAR},
            recaccount = #{recaccount,jdbcType=VARCHAR},
            recname = #{recname,jdbcType=VARCHAR},
            reccountrycode = #{reccountrycode,jdbcType=VARCHAR},
            recdistrictcode = #{recdistrictcode,jdbcType=VARCHAR},
            shuilv = #{shuilv,jdbcType=DECIMAL},
            invtyp = #{invtyp,jdbcType=VARCHAR},
            lprtyp = #{lprtyp,jdbcType=VARCHAR},
            mycontno = #{mycontno,jdbcType=VARCHAR},
            ffaflg = #{ffaflg,jdbcType=VARCHAR},
            tenorday = #{tenorday,jdbcType=INTEGER},
            avbby = #{avbby,jdbcType=VARCHAR},
            matpretyp = #{matpretyp,jdbcType=VARCHAR},
            goddspcn = #{goddspcn,jdbcType=VARCHAR},
            invref = #{invref,jdbcType=VARCHAR},
            prbkbic = #{prbkbic,jdbcType=VARCHAR},
            prbkname = #{prbkname,jdbcType=VARCHAR},
            sellername = #{sellername,jdbcType=VARCHAR},
            stzfdxzh = #{stzfdxzh,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 trd
        <set>
            <if test="module.ownref != null">ownref = #{module.ownref,jdbcType=VARCHAR},</if>
            <if test="module.nam != null">nam = #{module.nam,jdbcType=VARCHAR},</if>
            <if test="module.credat != null">credat = #{module.credat,jdbcType=DATE},</if>
            <if test="module.pnttyp != null">pnttyp = #{module.pnttyp,jdbcType=VARCHAR},</if>
            <if test="module.pntinr != null">pntinr = #{module.pntinr,jdbcType=VARCHAR},</if>
            <if test="module.pntnam != null">pntnam = #{module.pntnam,jdbcType=VARCHAR},</if>
            <if test="module.pntref != null">pntref = #{module.pntref,jdbcType=VARCHAR},</if>
            <if test="module.issdat != null">issdat = #{module.issdat,jdbcType=DATE},</if>
            <if test="module.matdat != null">matdat = #{module.matdat,jdbcType=DATE},</if>
            <if test="module.lstintdat != null">lstintdat = #{module.lstintdat,jdbcType=DATE},</if>
            <if test="module.stttendat != null">stttendat = #{module.stttendat,jdbcType=DATE},</if>
            <if test="module.spddat != null">spddat = #{module.spddat,jdbcType=DATE},</if>
            <if test="module.opndat != null">opndat = #{module.opndat,jdbcType=DATE},</if>
            <if test="module.clsdat != null">clsdat = #{module.clsdat,jdbcType=DATE},</if>
            <if test="module.tenday != null">tenday = #{module.tenday,jdbcType=NUMERIC},</if>
            <if test="module.actfinday != null">actfinday = #{module.actfinday,jdbcType=INTEGER},</if>
            <if test="module.intrat != null">intrat = #{module.intrat,jdbcType=DECIMAL},</if>
            <if test="module.ownusr != null">ownusr = #{module.ownusr,jdbcType=VARCHAR},</if>
            <if test="module.ver != null">ver = #{module.ver,jdbcType=VARCHAR},</if>
            <if test="module.irtcod != null">irtcod = #{module.irtcod,jdbcType=VARCHAR},</if>
            <if test="module.extnmb != null">extnmb = #{module.extnmb,jdbcType=INTEGER},</if>
            <if test="module.fintyp != null">fintyp = #{module.fintyp,jdbcType=VARCHAR},</if>
            <if test="module.pctfin != null">pctfin = #{module.pctfin,jdbcType=DECIMAL},</if>
            <if test="module.stagod != null">stagod = #{module.stagod,jdbcType=VARCHAR},</if>
            <if test="module.stacty != null">stacty = #{module.stacty,jdbcType=VARCHAR},</if>
            <if test="module.jzllgz != null">jzllgz = #{module.jzllgz,jdbcType=VARCHAR},</if>
            <if test="module.etyextkey != null">etyextkey = #{module.etyextkey,jdbcType=VARCHAR},</if>
            <if test="module.marrat != null">marrat = #{module.marrat,jdbcType=DECIMAL},</if>
            <if test="module.grarat != null">grarat = #{module.grarat,jdbcType=DECIMAL},</if>
            <if test="module.actrat != null">actrat = #{module.actrat,jdbcType=DECIMAL},</if>
            <if test="module.bchkeyinr != null">bchkeyinr = #{module.bchkeyinr,jdbcType=VARCHAR},</if>
            <if test="module.branchinr != null">branchinr = #{module.branchinr,jdbcType=VARCHAR},</if>
            <if test="module.fincod != null">fincod = #{module.fincod,jdbcType=VARCHAR},</if>
            <if test="module.finact != null">finact = #{module.finact,jdbcType=VARCHAR},</if>
            <if test="module.finblk != null">finblk = #{module.finblk,jdbcType=VARCHAR},</if>
            <if test="module.itfblk != null">itfblk = #{module.itfblk,jdbcType=VARCHAR},</if>
            <if test="module.ovddat != null">ovddat = #{module.ovddat,jdbcType=DATE},</if>
            <if test="module.ovdflg != null">ovdflg = #{module.ovdflg,jdbcType=VARCHAR},</if>
            <if test="module.feetyp != null">feetyp = #{module.feetyp,jdbcType=VARCHAR},</if>
            <if test="module.feeamt != null">feeamt = #{module.feeamt,jdbcType=DECIMAL},</if>
            <if test="module.actyld != null">actyld = #{module.actyld,jdbcType=DECIMAL},</if>
            <if test="module.guaflg != null">guaflg = #{module.guaflg,jdbcType=VARCHAR},</if>
            <if test="module.oseflg != null">oseflg = #{module.oseflg,jdbcType=VARCHAR},</if>
            <if test="module.oseday != null">oseday = #{module.oseday,jdbcType=INTEGER},</if>
            <if test="module.dinjdm != null">dinjdm = #{module.dinjdm,jdbcType=VARCHAR},</if>
            <if test="module.trntyp != null">trntyp = #{module.trntyp,jdbcType=VARCHAR},</if>
            <if test="module.oppacc != null">oppacc = #{module.oppacc,jdbcType=VARCHAR},</if>
            <if test="module.flowflag != null">flowflag = #{module.flowflag,jdbcType=VARCHAR},</if>
            <if test="module.recaccount != null">recaccount = #{module.recaccount,jdbcType=VARCHAR},</if>
            <if test="module.recname != null">recname = #{module.recname,jdbcType=VARCHAR},</if>
            <if test="module.reccountrycode != null">reccountrycode = #{module.reccountrycode,jdbcType=VARCHAR},</if>
            <if test="module.recdistrictcode != null">recdistrictcode = #{module.recdistrictcode,jdbcType=VARCHAR},</if>
            <if test="module.shuilv != null">shuilv = #{module.shuilv,jdbcType=DECIMAL},</if>
            <if test="module.invtyp != null">invtyp = #{module.invtyp,jdbcType=VARCHAR},</if>
            <if test="module.lprtyp != null">lprtyp = #{module.lprtyp,jdbcType=VARCHAR},</if>
            <if test="module.mycontno != null">mycontno = #{module.mycontno,jdbcType=VARCHAR},</if>
            <if test="module.ffaflg != null">ffaflg = #{module.ffaflg,jdbcType=VARCHAR},</if>
            <if test="module.tenorday != null">tenorday = #{module.tenorday,jdbcType=INTEGER},</if>
            <if test="module.avbby != null">avbby = #{module.avbby,jdbcType=VARCHAR},</if>
            <if test="module.matpretyp != null">matpretyp = #{module.matpretyp,jdbcType=VARCHAR},</if>
            <if test="module.goddspcn != null">goddspcn = #{module.goddspcn,jdbcType=VARCHAR},</if>
            <if test="module.invref != null">invref = #{module.invref,jdbcType=VARCHAR},</if>
            <if test="module.prbkbic != null">prbkbic = #{module.prbkbic,jdbcType=VARCHAR},</if>
            <if test="module.prbkname != null">prbkname = #{module.prbkname,jdbcType=VARCHAR},</if>
            <if test="module.sellername != null">sellername = #{module.sellername,jdbcType=VARCHAR},</if>
            <if test="module.stzfdxzh != null">stzfdxzh = #{module.stzfdxzh,jdbcType=VARCHAR},</if>
        </set>
        ${conditions}
    </update>

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

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

    <select id="getTrdByParentInrAndType" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from trd
        where pnttyp = #{pnttyp,jdbcType=VARCHAR}
        and pntinr = #{pntinr,jdbcType=VARCHAR}
        limit 1
    </select>

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

    <select id="getCountByRef" resultType="java.lang.Integer">
        select count(*) from trd where ownref like #{ref} || '%'
    </select>

    <select id="getBddCountByPntinr" resultType="java.lang.Integer">
        select count(*) from trd where pnttyp='BDD' and pntinr = #{pntinr}
    </select>

    <select id="getCpdCountByRef" resultType="java.lang.Integer">
        select count(*) from cpd where ownref = #{ref}
    </select>

    <select id="getCpdCountByRefBchkeyinr" resultType="java.lang.Integer">
        select count(*) from cpd where ownref=#{ref} and bchkeyinr=#{bchinr}
    </select>

    <select id="selectByownref" resultType="java.lang.String">
    </select>

    <select id="queryTrd" resultType="com.brilliance.isc.vo.finance.TrdWithPtsCbbResponseVo">
        select
        trd.*,
        cbb.cur cur, cbb.amt amt,cbb1.amt opnamt,pty.extkey fipExtkey,pty.nam1 fipName,pty.JUSCOD,bch.BCHNAME
        from trd
        left join cbb on cbb.OBJINR = trd.inr and cbb.OBJTYP = 'TRD'  and cbb.cbc = 'MAXSUM' and cbb.extid = 'AMT1' and cbb.enddat = '2299-12-31'
        left join cbb cbb1 on cbb1.OBJINR = trd.inr and cbb1.OBJTYP = 'TRD'  and cbb1.cbc = 'OPN' and cbb1.extid = 'AMT1' and cbb1.enddat = '2299-12-31'
        left join pts on pts.OBJINR = trd.inr and pts.OBJTYP = 'TRD' and pts.rol = 'FIP'
        left join pty on pts.PTYINR = pty.inr
        left join bch on trd.BRANCHINR = bch.inr
        where 1 = 1
        <!--单据INR-->
        <if test="pntinr != null and pntinr != '' ">
            AND trd.PNTINR = #{pntinr}
        </if>
        <!--机构隔离-->
        <if test="bchinr != null and bchinr != '' ">
            AND trd.BCHKEYINR = #{bchinr}
        </if>
        <!--融资业务编号-->
        <if test="trownref != null and trownref != ''">
            AND UPPER(trd.OWNREF) LIKE concat(concat('%', UPPER(#{trownref})), '%')
        </if>
        <!--单据业务编号-->
        <if test="pntref != null and pntref != ''">
            AND UPPER(trd.PNTREF) LIKE concat(concat('%', UPPER(#{pntref})), '%')
        </if>
        <!--起息日-->
        <if test="opndatfrom != null and opndatfrom != ''">
            AND trd.CREDAT &gt;= #{opndatfrom}
        </if>
        <!--起息日-->
        <if test="opndatto != null and opndatto != ''">
            AND trd.CREDAT &lt;= #{opndatto}
        </if>
        <!--到期日-->
        <if test="matdatfrom != null and matdatfrom != ''">
            AND trd.MATDAT &gt;= #{matdatfrom}
        </if>
        <if test="matdatto != null and matdatto != ''">
            AND trd.MATDAT &lt;= #{matdatto}
        </if>
        <!--业务类型-->
        <if test="pnttyp != null and pnttyp != ''">
            AND trd.PNTTYP = #{pnttyp}
        </if>
        <!--进口融资入口去掉国内进口融资业务-->
        <if test="isTrd != null and isTrd != ''">
            AND trd.PNTTYP != 'BDD'
        </if>
          <!--客户号/名称 或申请人-->
        <if test="searef != null and searef != ''">
            and exists (
            select 1 from PTS,PTY
            where trd.INR = PTS.OBJINR
            AND PTY.INR = PTS.PTYINR
            AND PTS.OBJTYP = 'TRD'
            AND PTS.ROL = 'FIP'
            AND (
            PTS.EXTKEY LIKE concat(concat('%', #{searef}), '%')
            or replace(PTS.NAM,'\n',' ') LIKE concat(concat('%', #{searef}), '%')
            or replace(PTS.CNNAM,'\n',' ') LIKE concat(concat('%', #{searef}), '%')
            or replace(PTS.ENNAM,'\n',' ') LIKE concat(concat('%', #{searef}), '%')
            or replace(PTY.NAM,'\n',' ') LIKE concat(concat('%', #{searef}), '%')
            )
            )
        </if>
        <!--客户号/名称 或受益人-->
        <if test="benref != null and benref != ''">
            and exists (
            select 1 from PTS,PTY
            where trd.INR = PTS.OBJINR
            AND PTY.INR = PTS.PTYINR
            AND PTS.OBJTYP = 'TRD'
            AND PTS.ROL = 'BEN'
            AND (
            PTS.EXTKEY LIKE concat(concat('%', #{benref}), '%')
            or replace(PTS.NAM,'\n',' ') LIKE concat(concat('%', #{benref}), '%')
            or replace(PTS.CNNAM,'\n',' ') LIKE concat(concat('%', #{benref}), '%')
            or replace(PTS.ENNAM,'\n',' ') LIKE concat(concat('%', #{benref}), '%')
            or replace(PTY.NAM,'\n',' ') LIKE concat(concat('%', #{benref}), '%')
            )
            )
        </if>
        <!--是否闭卷 -->
        <if test="isClosed != null and isClosed != ''">
            <if test="isClosed == 'Y'.toString()">
                and trd.CLSDAT is not null
            </if>
            <if test="isClosed == 'N'.toString()">
                and trd.CLSDAT is  null
            </if>
        </if>
        order by trd.CREDAT desc , trd.OWNREF desc
    </select>

    <select id="selectByfincod" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from trd
        where fincod = #{fincod,jdbcType=VARCHAR}
    </select>
    <select id="selectByPnttypAndPntinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from trd
        where
        pnttyp = #{pnttyp,jdbcType=VARCHAR}
        AND pntinr = #{pntinr,jdbcType=VARCHAR}
        order by inr desc limit 1
    </select>
    <select id="queryTrdInfo" resultType="com.brilliance.isc.vo.finance.TrdWithPtsCbbResponseVo">
        select
        trd.*,bch.BCHNAME bchName,usr.NAM usrNam,pty.JUSCOD,
        max1.cur cur, case when max2.amt is not null then (max1.amt + max2.amt ) else max1.amt end amt,
        opn1.cur opncur,case when opn2.amt is not null then (opn1.amt + opn2.amt) else opn1.amt end opnamt,
        fip.extkey fipExtkey,fip.nam fipName,ose.EXTKEY oseExtkey,ose.nam oseName
        from trd
        left join cbb max1 on max1.OBJINR = trd.inr and max1.OBJTYP = 'TRD' and max1.cbc = 'MAXSUM' and max1.extid =
        'AMT1' and max1.enddat = '2299-12-31'
        left join cbb max2 on max2.OBJINR = trd.inr and max2.OBJTYP = 'TRD' and max2.cbc = 'MAXSUM' and max2.extid =
        'AMT2' and max2.enddat = '2299-12-31'
        left join cbb opn1 on opn1.OBJINR = trd.inr and opn1.OBJTYP = 'TRD' and opn1.cbc = 'OPN' and opn1.extid = 'AMT1'
        and opn1.enddat = '2299-12-31'
        left join cbb opn2 on opn2.OBJINR = trd.inr and opn2.OBJTYP = 'TRD' and opn2.cbc = 'OPN' and opn2.extid = 'AMT2'
        and opn2.enddat = '2299-12-31'
        left join pts fip on fip.OBJINR = trd.inr and fip.OBJTYP = 'TRD' and fip.rol = 'FIP'
        left join pts ose on ose.OBJINR = trd.inr and ose.OBJTYP = 'TRD' and ose.rol = 'OSE'
        left join bch bch on bch.inr = trd.BCHKEYINR
        left join usr usr on usr.EXTKEY = trd.OWNUSR
        left join pty on fip.PTYINR = pty.inr
        where trd.flwsta = 'R'
        <!--机构隔离-->
        <if test="bchinr != null and bchinr != '' ">
            AND trd.bchkeyinr = #{bchinr}
        </if>
        <!--业务编号-->
        <if test="seaownref != null and seaownref != ''">
            AND UPPER(trd.OWNREF) LIKE concat(concat('%', UPPER(#{seaownref})), '%')
        </if>
        <!--日期-->
        <if test="opndatfrom != null and opndatfrom != ''">
            AND trd.CREDAT &gt;= #{opndatfrom}
        </if>
        <if test="opndatto != null and opndatto != ''">
            AND trd.CREDAT &lt;= #{opndatto}
        </if>
        <!--客户号/名称 -->
        <if test="ptyExtkey != null and ptyExtkey != ''">
            and exists (
            select 1 from PTS
            where trd.INR = PTS.OBJINR
            AND PTS.OBJTYP = 'TRD'
            AND (
            PTS.EXTKEY LIKE concat(concat('%', #{ptyExtkey}), '%')
            or PTS.NAM LIKE concat(concat('%', #{ptyExtkey}), '%')
            or PTS.CNNAM LIKE concat(concat('%', #{ptyExtkey}), '%')
            or PTS.ENNAM LIKE concat(concat('%', #{ptyExtkey}), '%')
            )
            )
        </if>
        <!--当事人BIC/名称 -->
        <if test="seapty != null and seapty != ''">
            and exists (
            select 1 from PTS,PTA
            where trd.INR = PTS.OBJINR
            AND PTS.OBJTYP = 'TRD'
            AND PTA.INR = PTS.PTAINR
            AND (
            PTA.PTYEXTKEY LIKE concat(concat('%', #{seapty}), '%')
            or PTA.NAM LIKE concat(concat('%', #{seapty}), '%')
            or PTA.BIC LIKE concat(concat('%', #{seapty}), '%')
            )
            )
        </if>
        <!--当事人参考号 -->
        <if test="searef != null and searef != ''">
            and exists (
            select 1 from PTS
            where trd.INR = PTS.OBJINR
            AND PTS.OBJTYP = 'TRD'
            AND
            PTS.REF LIKE concat(concat('%', #{searef}), '%')
            )
        </if>
        <!-- 币种以及金额-->
        <if test="seacur != null and seacur != ''">
            AND EXISTS (
            select 1 from CBB INFCONCBS where
            UPPER(INFCONCBS.CUR ) = UPPER(#{seacur})
            <if test="seaamtfr != null and seaamtfr != ''">
                AND INFCONCBS.AMT >= #{seaamtfr}
            </if>
            <if test="seaamtto != null and seaamtto != ''">
                AND INFCONCBS.AMT &lt;= #{seaamtto}
            </if>
            AND (INFCONCBS.OBJTYP = 'TRD'
            AND INFCONCBS.OBJINR = TRD.INR
            AND (INFCONCBS.BEGDAT &lt;= STR_TO_DATE('2299-12-30', '%Y-%m-%d')
            AND INFCONCBS.ENDDAT &gt; STR_TO_DATE('2299-12-30', '%Y-%m-%d'))
            AND INFCONCBS.EXTID IN (' ', 'AMT1')
            AND INFCONCBS.CBC IN ('MAXSUM', 'PRESUM', 'NOMSUM', 'OPN'))
            )
        </if>

        <!--业务状态  -->
        <if test="seasta != null and seasta != ''">
            <if test="seasta == 'C'.toString()">
                and trd.clsdat is not null
            </if>
            <if test="seasta == 'O'.toString()">
                and trd.clsdat is null
            </if>
        </if>
        <!--货物类型-->
        <if test="seagodcod != null and seagodcod != '' ">
            AND trd.stagod = #{seagodcod}
        </if>
        <!--融资类型-->
        <if test="seafintyp != null and seafintyp != '' ">
            AND trd.fintyp = #{seafintyp}
        </if>
        <if test="seafintyps != null and seafintyps.size() >0">
            and trd.fintyp in
            <foreach item="seafintyp" collection="seafintyps" open="(" separator="," close=")">
                #{seafintyp}
            </foreach>
        </if>
        <!--融资状态-->
        <if test="ovdflg != null and ovdflg != '' ">
            AND trd.ovdflg = #{ovdflg}
        </if>
        <!--海外代付-->
        <if test="oseflg != null and oseflg != '' ">
            AND trd.oseflg = #{oseflg}
        </if>
        <if test='column != null and column!="" '>
            order by  ${column}  ${order}
        </if>
        <if test='column == null or column=="" '>
            order by trd.opndat desc , trd.ownref desc
        </if>
    </select>
    <select id="getReportX" resultType="com.brilliance.isc.vo.report.DfdReportVo">
        select bb.bchname,
        t.ownref,
        <choose>
            <when test="objtyp != null and objtyp != ''">
                b.ownref pntref,
            </when>
            <otherwise>
                t.pntref pntref,
            </otherwise>
        </choose>
        t.oseday tenday,
        <choose>
            <when test="objtyp == 'BRD'">
                b.tenmaxday,
                b.tenmaxday + t.oseday tenaddday,
            </when>
            <otherwise>
                0 tenmaxday,
                0 + t.oseday tenaddday,
            </otherwise>
        </choose>
        c.cur comcur,
        c.amt comamt,
        t.opndat stttendat,
        t.opndat + t.oseday matdat,
        pb.extkey dfextkey,
        pb.nam dfnam,
        pa.extkey ,
        pt.nam1 ptyname
        <if test="objtyp == 'BRD'">
            ,pc.extkey advExtkey
        </if>
        from
        <if test="objtyp != null and objtyp != ''">
            ${objtyp} b,
        </if>
        <if test="objtyp == 'BRD'">
            PTS pc,
        </if>
        trd t, CBB c, BCH ba, BCH bb,
        PTS pa,PTS pb,PTA pt
        where
        <choose>
            <when test="objtyp == 'BRD'">
                t.pntinr = b.inr
                and t.pnttyp = 'BRD'
                and pc.objinr = b.pntinr
                and pc.ROL = 'ADV'
                and pc.objtyp = 'LID'
            </when>
            <when test="objtyp == 'BCD'">
                t.pntinr = b.inr
                and t.pnttyp = 'BCD'
            </when>
            <otherwise>
                (t.pnttyp = 'CPD' or trim(t.pntinr) is null)
            </otherwise>
        </choose>
        and t.clsdat is null
        and t.oseflg != ' '
        and c.objinr = t.inr
        and c.objtyp = 'TRD'
        and c.cbc = 'OPN'
        and c.extid = 'AMT1'
        and c.amt > 0
        and ba.inr = t.branchinr
        and bb.branch = ba.bchkey
        and pa.objinr = t.inr
        and pa.objtyp = 'TRD'
        and pa.rol = 'FIP'
        and pa.ptainr = pt.inr
        and pb.objinr = t.inr
        and pb.objtyp = 'TRD'
        and pb.rol = 'OSE'
        <if test="bchLst != null and bchLst.size() >0 and branch != '1000'.toString()">
            and t.BRANCHINR in
            <foreach item="bch" collection="bchLst" open="(" separator="," close=")">
                #{bch.inr}
            </foreach>
        </if>
        <if test="begdat != null ">
            and t.credat >= #{begdat}
        </if>
        <if test="enddat != null ">
            and t.credat &lt;= #{enddat}
        </if>
    </select>

    <select id="selectByOwnref" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from trd
        where ownref = #{ownref}
    </select>

    <select id="selectBchByFincod" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from trd
        where BCHKEYINR in (select BRANCHINR from pilotbch p2 where ISPILOT ='Y') and fincod = #{fincod}
    </select>
    <select id="getTrdCntByPnttypAndPntinr" resultType="java.lang.Integer">
        select
            count(*)
        from trd
        where pntinr = #{pntinr,jdbcType=VARCHAR}
          and pnttyp = #{pnttyp,jdbcType=VARCHAR}
    </select>
</mapper>