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

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Led">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="ownref" column="ownref" jdbcType="VARCHAR"/>
        <result property="nam" column="nam" jdbcType="VARCHAR"/>
        <result property="ownusr" column="ownusr" jdbcType="VARCHAR"/>
        <result property="credat" column="credat" jdbcType="DATE"/>
        <result property="opndat" column="opndat" jdbcType="DATE"/>
        <result property="clsdat" column="clsdat" jdbcType="DATE"/>
        <result property="cnfdat" column="cnfdat" jdbcType="DATE"/>
        <result property="advdat" column="advdat" jdbcType="DATE"/>
        <result property="issnam" column="issnam" jdbcType="VARCHAR"/>
        <result property="issref" column="issref" jdbcType="VARCHAR"/>
        <result property="amedat" column="amedat" jdbcType="DATE"/>
        <result property="amenbr" column="amenbr" jdbcType="INTEGER"/>
        <result property="avbby" column="avbby" jdbcType="VARCHAR"/>
        <result property="avbwth" column="avbwth" jdbcType="VARCHAR"/>
        <result property="bennam" column="bennam" jdbcType="VARCHAR"/>
        <result property="benref" column="benref" jdbcType="VARCHAR"/>
        <result property="chato" column="chato" jdbcType="VARCHAR"/>
        <result property="cnfflg" column="cnfflg" jdbcType="VARCHAR"/>
        <result property="cnfdet" column="cnfdet" jdbcType="VARCHAR"/>
        <result property="cnfsta" column="cnfsta" jdbcType="VARCHAR"/>
        <result property="expdat" column="expdat" jdbcType="DATE"/>
        <result property="expplc" column="expplc" jdbcType="VARCHAR"/>
        <result property="lcrtyp" column="lcrtyp" jdbcType="VARCHAR"/>
        <result property="nomspc" column="nomspc" jdbcType="VARCHAR"/>
        <result property="nomtop" column="nomtop" jdbcType="INTEGER"/>
        <result property="nomton" column="nomton" jdbcType="INTEGER"/>
        <result property="preadvdt" column="preadvdt" jdbcType="DATE"/>
        <result property="shpdat" column="shpdat" jdbcType="DATE"/>
        <result property="shpfro" column="shpfro" jdbcType="VARCHAR"/>
        <result property="shppar" column="shppar" jdbcType="VARCHAR"/>
        <result property="shpto" column="shpto" jdbcType="VARCHAR"/>
        <result property="shptrs" column="shptrs" jdbcType="VARCHAR"/>
        <result property="stacty" column="stacty" jdbcType="VARCHAR"/>
        <result property="stagod" column="stagod" jdbcType="VARCHAR"/>
        <result property="utlnbr" column="utlnbr" jdbcType="INTEGER"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="aplbnkdirsnd" column="aplbnkdirsnd" jdbcType="VARCHAR"/>
        <result property="tenmaxday" column="tenmaxday" jdbcType="INTEGER"/>
        <result property="cnfsnd" column="cnfsnd" jdbcType="VARCHAR"/>
        <result property="revflg" column="revflg" jdbcType="VARCHAR"/>
        <result property="revnbr" column="revnbr" jdbcType="INTEGER"/>
        <result property="revtimes" column="revtimes" jdbcType="INTEGER"/>
        <result property="revdat" column="revdat" jdbcType="DATE"/>
        <result property="revcum" column="revcum" jdbcType="VARCHAR"/>
        <result property="revtyp" column="revtyp" jdbcType="VARCHAR"/>
        <result property="cnfins" column="cnfins" jdbcType="VARCHAR"/>
        <result property="redclsflg" column="redclsflg" jdbcType="VARCHAR"/>
        <result property="advnbr" column="advnbr" jdbcType="INTEGER"/>
        <result property="resflg" column="resflg" jdbcType="VARCHAR"/>
        <result property="inctrf" column="inctrf" jdbcType="VARCHAR"/>
        <result property="apprul" column="apprul" jdbcType="VARCHAR"/>
        <result property="apprultxt" column="apprultxt" jdbcType="VARCHAR"/>
        <result property="pordis" column="pordis" jdbcType="VARCHAR"/>
        <result property="porloa" column="porloa" jdbcType="VARCHAR"/>
        <result property="nonban" column="nonban" jdbcType="VARCHAR"/>
        <result property="spcrcbflg" column="spcrcbflg" jdbcType="VARCHAR"/>
        <result property="prepers18" column="prepers18" jdbcType="INTEGER"/>
        <result property="prepertxts18" column="prepertxts18" jdbcType="VARCHAR"/>
        <result property="shppars18" column="shppars18" jdbcType="VARCHAR"/>
        <result property="shptrss18" column="shptrss18" jdbcType="VARCHAR"/>
        <result property="spcbenflg" column="spcbenflg" jdbcType="VARCHAR"/>
        <result property="etyextkey" column="etyextkey" jdbcType="VARCHAR"/>
        <result property="partcon" column="partcon" jdbcType="DECIMAL"/>
        <result property="collflg" column="collflg" jdbcType="VARCHAR"/>
        <result property="teskeyunc" column="teskeyunc" jdbcType="VARCHAR"/>
        <result property="dbtflg" column="dbtflg" jdbcType="VARCHAR"/>
        <result property="branchinr" column="branchinr" jdbcType="VARCHAR"/>
        <result property="bchkeyinr" column="bchkeyinr" jdbcType="VARCHAR"/>
        <result property="rskrat" column="rskrat" jdbcType="DECIMAL"/>
        <result property="dflg" column="dflg" jdbcType="VARCHAR"/>
        <result property="tratyp" column="tratyp" jdbcType="VARCHAR"/>
        <result property="oppbnk" column="oppbnk" jdbcType="VARCHAR"/>
        <result property="mytype" column="mytype" jdbcType="VARCHAR"/>
        <result property="isyifu" column="isyifu" jdbcType="VARCHAR"/>
        <result property="goddspcn" column="goddspcn" jdbcType="VARCHAR"/>
        <result property="oppnam" column="oppnam" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,ownref,nam,ownusr,credat,opndat,clsdat,cnfdat,advdat,issnam,issref,amedat,amenbr,avbby,avbwth,bennam,benref,chato,cnfflg,cnfdet,cnfsta,expdat,expplc,lcrtyp,nomspc,nomtop,nomton,preadvdt,shpdat,shpfro,shppar,shpto,shptrs,stacty,stagod,utlnbr,ver,aplbnkdirsnd,tenmaxday,cnfsnd,revflg,revnbr,revtimes,revdat,revcum,revtyp,cnfins,redclsflg,advnbr,resflg,inctrf,apprul,apprultxt,pordis,porloa,nonban,spcrcbflg,prepers18,prepertxts18,shppars18,shptrss18,spcbenflg,etyextkey,partcon,collflg,teskeyunc,dbtflg,branchinr,bchkeyinr,rskrat,dflg,tratyp,oppbnk,mytype,isyifu,goddspcn,oppnam
    </sql>

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

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

    <insert id="insert">
        insert into led (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{ownref,jdbcType=VARCHAR},
            #{nam,jdbcType=VARCHAR},
            #{ownusr,jdbcType=VARCHAR},
            #{credat,jdbcType=DATE},
            #{opndat,jdbcType=DATE},
            #{clsdat,jdbcType=DATE},
            #{cnfdat,jdbcType=DATE},
            #{advdat,jdbcType=DATE},
            #{issnam,jdbcType=VARCHAR},
            #{issref,jdbcType=VARCHAR},
            #{amedat,jdbcType=DATE},
            #{amenbr,jdbcType=INTEGER},
            #{avbby,jdbcType=VARCHAR},
            #{avbwth,jdbcType=VARCHAR},
            #{bennam,jdbcType=VARCHAR},
            #{benref,jdbcType=VARCHAR},
            #{chato,jdbcType=VARCHAR},
            #{cnfflg,jdbcType=VARCHAR},
            #{cnfdet,jdbcType=VARCHAR},
            #{cnfsta,jdbcType=VARCHAR},
            #{expdat,jdbcType=DATE},
            #{expplc,jdbcType=VARCHAR},
            #{lcrtyp,jdbcType=VARCHAR},
            #{nomspc,jdbcType=VARCHAR},
            #{nomtop,jdbcType=INTEGER},
            #{nomton,jdbcType=INTEGER},
            #{preadvdt,jdbcType=DATE},
            #{shpdat,jdbcType=DATE},
            #{shpfro,jdbcType=VARCHAR},
            #{shppar,jdbcType=VARCHAR},
            #{shpto,jdbcType=VARCHAR},
            #{shptrs,jdbcType=VARCHAR},
            #{stacty,jdbcType=VARCHAR},
            #{stagod,jdbcType=VARCHAR},
            #{utlnbr,jdbcType=INTEGER},
            #{ver,jdbcType=VARCHAR},
            #{aplbnkdirsnd,jdbcType=VARCHAR},
            #{tenmaxday,jdbcType=INTEGER},
            #{cnfsnd,jdbcType=VARCHAR},
            #{revflg,jdbcType=VARCHAR},
            #{revnbr,jdbcType=INTEGER},
            #{revtimes,jdbcType=INTEGER},
            #{revdat,jdbcType=DATE},
            #{revcum,jdbcType=VARCHAR},
            #{revtyp,jdbcType=VARCHAR},
            #{cnfins,jdbcType=VARCHAR},
            #{redclsflg,jdbcType=VARCHAR},
            #{advnbr,jdbcType=INTEGER},
            #{resflg,jdbcType=VARCHAR},
            #{inctrf,jdbcType=VARCHAR},
            #{apprul,jdbcType=VARCHAR},
            #{apprultxt,jdbcType=VARCHAR},
            #{pordis,jdbcType=VARCHAR},
            #{porloa,jdbcType=VARCHAR},
            #{nonban,jdbcType=VARCHAR},
            #{spcrcbflg,jdbcType=VARCHAR},
            #{prepers18,jdbcType=INTEGER},
            #{prepertxts18,jdbcType=VARCHAR},
            #{shppars18,jdbcType=VARCHAR},
            #{shptrss18,jdbcType=VARCHAR},
            #{spcbenflg,jdbcType=VARCHAR},
            #{etyextkey,jdbcType=VARCHAR},
            #{partcon,jdbcType=DECIMAL},
            #{collflg,jdbcType=VARCHAR},
            #{teskeyunc,jdbcType=VARCHAR},
            #{dbtflg,jdbcType=VARCHAR},
            #{branchinr,jdbcType=VARCHAR},
            #{bchkeyinr,jdbcType=VARCHAR},
            #{rskrat,jdbcType=DECIMAL},
            #{dflg,jdbcType=VARCHAR},
            #{tratyp,jdbcType=VARCHAR},
            #{oppbnk,jdbcType=VARCHAR},
            #{mytype,jdbcType=VARCHAR},
            #{isyifu,jdbcType=VARCHAR},
            #{goddspcn,jdbcType=VARCHAR},
            #{oppnam,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into led
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="ownref != null">ownref,</if>
            <if test="nam != null">nam,</if>
            <if test="ownusr != null">ownusr,</if>
            <if test="credat != null">credat,</if>
            <if test="opndat != null">opndat,</if>
            <if test="clsdat != null">clsdat,</if>
            <if test="cnfdat != null">cnfdat,</if>
            <if test="advdat != null">advdat,</if>
            <if test="issnam != null">issnam,</if>
            <if test="issref != null">issref,</if>
            <if test="amedat != null">amedat,</if>
            <if test="amenbr != null">amenbr,</if>
            <if test="avbby != null">avbby,</if>
            <if test="avbwth != null">avbwth,</if>
            <if test="bennam != null">bennam,</if>
            <if test="benref != null">benref,</if>
            <if test="chato != null">chato,</if>
            <if test="cnfflg != null">cnfflg,</if>
            <if test="cnfdet != null">cnfdet,</if>
            <if test="cnfsta != null">cnfsta,</if>
            <if test="expdat != null">expdat,</if>
            <if test="expplc != null">expplc,</if>
            <if test="lcrtyp != null">lcrtyp,</if>
            <if test="nomspc != null">nomspc,</if>
            <if test="nomtop != null">nomtop,</if>
            <if test="nomton != null">nomton,</if>
            <if test="preadvdt != null">preadvdt,</if>
            <if test="shpdat != null">shpdat,</if>
            <if test="shpfro != null">shpfro,</if>
            <if test="shppar != null">shppar,</if>
            <if test="shpto != null">shpto,</if>
            <if test="shptrs != null">shptrs,</if>
            <if test="stacty != null">stacty,</if>
            <if test="stagod != null">stagod,</if>
            <if test="utlnbr != null">utlnbr,</if>
            <if test="ver != null">ver,</if>
            <if test="aplbnkdirsnd != null">aplbnkdirsnd,</if>
            <if test="tenmaxday != null">tenmaxday,</if>
            <if test="cnfsnd != null">cnfsnd,</if>
            <if test="revflg != null">revflg,</if>
            <if test="revnbr != null">revnbr,</if>
            <if test="revtimes != null">revtimes,</if>
            <if test="revdat != null">revdat,</if>
            <if test="revcum != null">revcum,</if>
            <if test="revtyp != null">revtyp,</if>
            <if test="cnfins != null">cnfins,</if>
            <if test="redclsflg != null">redclsflg,</if>
            <if test="advnbr != null">advnbr,</if>
            <if test="resflg != null">resflg,</if>
            <if test="inctrf != null">inctrf,</if>
            <if test="apprul != null">apprul,</if>
            <if test="apprultxt != null">apprultxt,</if>
            <if test="pordis != null">pordis,</if>
            <if test="porloa != null">porloa,</if>
            <if test="nonban != null">nonban,</if>
            <if test="spcrcbflg != null">spcrcbflg,</if>
            <if test="prepers18 != null">prepers18,</if>
            <if test="prepertxts18 != null">prepertxts18,</if>
            <if test="shppars18 != null">shppars18,</if>
            <if test="shptrss18 != null">shptrss18,</if>
            <if test="spcbenflg != null">spcbenflg,</if>
            <if test="etyextkey != null">etyextkey,</if>
            <if test="partcon != null">partcon,</if>
            <if test="collflg != null">collflg,</if>
            <if test="teskeyunc != null">teskeyunc,</if>
            <if test="dbtflg != null">dbtflg,</if>
            <if test="branchinr != null">branchinr,</if>
            <if test="bchkeyinr != null">bchkeyinr,</if>
            <if test="rskrat != null">rskrat,</if>
            <if test="dflg != null">dflg,</if>
            <if test="tratyp != null">tratyp,</if>
            <if test="oppbnk != null">oppbnk,</if>
            <if test="mytype != null">mytype,</if>
            <if test="isyifu != null">isyifu,</if>
            <if test="goddspcn != null">goddspcn,</if>
            <if test="oppnam != null">oppnam,</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="ownusr != null">#{ownusr,jdbcType=VARCHAR}, </if>
            <if test="credat != null">#{credat,jdbcType=DATE}, </if>
            <if test="opndat != null">#{opndat,jdbcType=DATE}, </if>
            <if test="clsdat != null">#{clsdat,jdbcType=DATE}, </if>
            <if test="cnfdat != null">#{cnfdat,jdbcType=DATE}, </if>
            <if test="advdat != null">#{advdat,jdbcType=DATE}, </if>
            <if test="issnam != null">#{issnam,jdbcType=VARCHAR}, </if>
            <if test="issref != null">#{issref,jdbcType=VARCHAR}, </if>
            <if test="amedat != null">#{amedat,jdbcType=DATE}, </if>
            <if test="amenbr != null">#{amenbr,jdbcType=INTEGER}, </if>
            <if test="avbby != null">#{avbby,jdbcType=VARCHAR}, </if>
            <if test="avbwth != null">#{avbwth,jdbcType=VARCHAR}, </if>
            <if test="bennam != null">#{bennam,jdbcType=VARCHAR}, </if>
            <if test="benref != null">#{benref,jdbcType=VARCHAR}, </if>
            <if test="chato != null">#{chato,jdbcType=VARCHAR}, </if>
            <if test="cnfflg != null">#{cnfflg,jdbcType=VARCHAR}, </if>
            <if test="cnfdet != null">#{cnfdet,jdbcType=VARCHAR}, </if>
            <if test="cnfsta != null">#{cnfsta,jdbcType=VARCHAR}, </if>
            <if test="expdat != null">#{expdat,jdbcType=DATE}, </if>
            <if test="expplc != null">#{expplc,jdbcType=VARCHAR}, </if>
            <if test="lcrtyp != null">#{lcrtyp,jdbcType=VARCHAR}, </if>
            <if test="nomspc != null">#{nomspc,jdbcType=VARCHAR}, </if>
            <if test="nomtop != null">#{nomtop,jdbcType=INTEGER}, </if>
            <if test="nomton != null">#{nomton,jdbcType=INTEGER}, </if>
            <if test="preadvdt != null">#{preadvdt,jdbcType=DATE}, </if>
            <if test="shpdat != null">#{shpdat,jdbcType=DATE}, </if>
            <if test="shpfro != null">#{shpfro,jdbcType=VARCHAR}, </if>
            <if test="shppar != null">#{shppar,jdbcType=VARCHAR}, </if>
            <if test="shpto != null">#{shpto,jdbcType=VARCHAR}, </if>
            <if test="shptrs != null">#{shptrs,jdbcType=VARCHAR}, </if>
            <if test="stacty != null">#{stacty,jdbcType=VARCHAR}, </if>
            <if test="stagod != null">#{stagod,jdbcType=VARCHAR}, </if>
            <if test="utlnbr != null">#{utlnbr,jdbcType=INTEGER}, </if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR}, </if>
            <if test="aplbnkdirsnd != null">#{aplbnkdirsnd,jdbcType=VARCHAR}, </if>
            <if test="tenmaxday != null">#{tenmaxday,jdbcType=INTEGER}, </if>
            <if test="cnfsnd != null">#{cnfsnd,jdbcType=VARCHAR}, </if>
            <if test="revflg != null">#{revflg,jdbcType=VARCHAR}, </if>
            <if test="revnbr != null">#{revnbr,jdbcType=INTEGER}, </if>
            <if test="revtimes != null">#{revtimes,jdbcType=INTEGER}, </if>
            <if test="revdat != null">#{revdat,jdbcType=DATE}, </if>
            <if test="revcum != null">#{revcum,jdbcType=VARCHAR}, </if>
            <if test="revtyp != null">#{revtyp,jdbcType=VARCHAR}, </if>
            <if test="cnfins != null">#{cnfins,jdbcType=VARCHAR}, </if>
            <if test="redclsflg != null">#{redclsflg,jdbcType=VARCHAR}, </if>
            <if test="advnbr != null">#{advnbr,jdbcType=INTEGER}, </if>
            <if test="resflg != null">#{resflg,jdbcType=VARCHAR}, </if>
            <if test="inctrf != null">#{inctrf,jdbcType=VARCHAR}, </if>
            <if test="apprul != null">#{apprul,jdbcType=VARCHAR}, </if>
            <if test="apprultxt != null">#{apprultxt,jdbcType=VARCHAR}, </if>
            <if test="pordis != null">#{pordis,jdbcType=VARCHAR}, </if>
            <if test="porloa != null">#{porloa,jdbcType=VARCHAR}, </if>
            <if test="nonban != null">#{nonban,jdbcType=VARCHAR}, </if>
            <if test="spcrcbflg != null">#{spcrcbflg,jdbcType=VARCHAR}, </if>
            <if test="prepers18 != null">#{prepers18,jdbcType=INTEGER}, </if>
            <if test="prepertxts18 != null">#{prepertxts18,jdbcType=VARCHAR}, </if>
            <if test="shppars18 != null">#{shppars18,jdbcType=VARCHAR}, </if>
            <if test="shptrss18 != null">#{shptrss18,jdbcType=VARCHAR}, </if>
            <if test="spcbenflg != null">#{spcbenflg,jdbcType=VARCHAR}, </if>
            <if test="etyextkey != null">#{etyextkey,jdbcType=VARCHAR}, </if>
            <if test="partcon != null">#{partcon,jdbcType=DECIMAL}, </if>
            <if test="collflg != null">#{collflg,jdbcType=VARCHAR}, </if>
            <if test="teskeyunc != null">#{teskeyunc,jdbcType=VARCHAR}, </if>
            <if test="dbtflg != null">#{dbtflg,jdbcType=VARCHAR}, </if>
            <if test="branchinr != null">#{branchinr,jdbcType=VARCHAR}, </if>
            <if test="bchkeyinr != null">#{bchkeyinr,jdbcType=VARCHAR}, </if>
            <if test="rskrat != null">#{rskrat,jdbcType=DECIMAL}, </if>
            <if test="dflg != null">#{dflg,jdbcType=VARCHAR}, </if>
            <if test="tratyp != null">#{tratyp,jdbcType=VARCHAR}, </if>
            <if test="oppbnk != null">#{oppbnk,jdbcType=VARCHAR}, </if>
            <if test="mytype != null">#{mytype,jdbcType=VARCHAR}, </if>
            <if test="isyifu != null">#{isyifu,jdbcType=VARCHAR}, </if>
            <if test="goddspcn != null">#{goddspcn,jdbcType=VARCHAR}, </if>
            <if test="oppnam != null">#{oppnam,jdbcType=VARCHAR}, </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update led
        <set>
            <if test="ownref != null">ownref = #{ownref,jdbcType=VARCHAR},</if>
            <if test="nam != null">nam = #{nam,jdbcType=VARCHAR},</if>
            <if test="ownusr != null">ownusr = #{ownusr,jdbcType=VARCHAR},</if>
            <if test="credat != null">credat = #{credat,jdbcType=DATE},</if>
            <if test="opndat != null">opndat = #{opndat,jdbcType=DATE},</if>
            clsdat = #{clsdat,jdbcType=DATE},
            <if test="cnfdat != null">cnfdat = #{cnfdat,jdbcType=DATE},</if>
            <if test="advdat != null">advdat = #{advdat,jdbcType=DATE},</if>
            <if test="issnam != null">issnam = #{issnam,jdbcType=VARCHAR},</if>
            <if test="issref != null">issref = #{issref,jdbcType=VARCHAR},</if>
            <if test="amedat != null">amedat = #{amedat,jdbcType=DATE},</if>
            <if test="amenbr != null">amenbr = #{amenbr,jdbcType=INTEGER},</if>
            <if test="avbby != null">avbby = #{avbby,jdbcType=VARCHAR},</if>
            <if test="avbwth != null">avbwth = #{avbwth,jdbcType=VARCHAR},</if>
            <if test="bennam != null">bennam = #{bennam,jdbcType=VARCHAR},</if>
            <if test="benref != null">benref = #{benref,jdbcType=VARCHAR},</if>
            <if test="chato != null">chato = #{chato,jdbcType=VARCHAR},</if>
            <if test="cnfflg != null">cnfflg = #{cnfflg,jdbcType=VARCHAR},</if>
            <if test="cnfdet != null">cnfdet = #{cnfdet,jdbcType=VARCHAR},</if>
            <if test="cnfsta != null">cnfsta = #{cnfsta,jdbcType=VARCHAR},</if>
            <if test="expdat != null">expdat = #{expdat,jdbcType=DATE},</if>
            <if test="expplc != null">expplc = #{expplc,jdbcType=VARCHAR},</if>
            <if test="lcrtyp != null">lcrtyp = #{lcrtyp,jdbcType=VARCHAR},</if>
            <if test="nomspc != null">nomspc = #{nomspc,jdbcType=VARCHAR},</if>
            <if test="nomtop != null">nomtop = #{nomtop,jdbcType=INTEGER},</if>
            <if test="nomton != null">nomton = #{nomton,jdbcType=INTEGER},</if>
            <if test="preadvdt != null">preadvdt = #{preadvdt,jdbcType=DATE},</if>
            <if test="shpdat != null">shpdat = #{shpdat,jdbcType=DATE},</if>
            <if test="shpfro != null">shpfro = #{shpfro,jdbcType=VARCHAR},</if>
            <if test="shppar != null">shppar = #{shppar,jdbcType=VARCHAR},</if>
            <if test="shpto != null">shpto = #{shpto,jdbcType=VARCHAR},</if>
            <if test="shptrs != null">shptrs = #{shptrs,jdbcType=VARCHAR},</if>
            <if test="stacty != null">stacty = #{stacty,jdbcType=VARCHAR},</if>
            <if test="stagod != null">stagod = #{stagod,jdbcType=VARCHAR},</if>
            <if test="utlnbr != null">utlnbr = #{utlnbr,jdbcType=INTEGER},</if>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            <if test="aplbnkdirsnd != null">aplbnkdirsnd = #{aplbnkdirsnd,jdbcType=VARCHAR},</if>
            <if test="tenmaxday != null">tenmaxday = #{tenmaxday,jdbcType=INTEGER},</if>
            <if test="cnfsnd != null">cnfsnd = #{cnfsnd,jdbcType=VARCHAR},</if>
            <if test="revflg != null">revflg = #{revflg,jdbcType=VARCHAR},</if>
            <if test="revnbr != null">revnbr = #{revnbr,jdbcType=INTEGER},</if>
            <if test="revtimes != null">revtimes = #{revtimes,jdbcType=INTEGER},</if>
            <if test="revdat != null">revdat = #{revdat,jdbcType=DATE},</if>
            <if test="revcum != null">revcum = #{revcum,jdbcType=VARCHAR},</if>
            <if test="revtyp != null">revtyp = #{revtyp,jdbcType=VARCHAR},</if>
            <if test="cnfins != null">cnfins = #{cnfins,jdbcType=VARCHAR},</if>
            <if test="redclsflg != null">redclsflg = #{redclsflg,jdbcType=VARCHAR},</if>
            <if test="advnbr != null">advnbr = #{advnbr,jdbcType=INTEGER},</if>
            <if test="resflg != null">resflg = #{resflg,jdbcType=VARCHAR},</if>
            <if test="inctrf != null">inctrf = #{inctrf,jdbcType=VARCHAR},</if>
            <if test="apprul != null">apprul = #{apprul,jdbcType=VARCHAR},</if>
            <if test="apprultxt != null">apprultxt = #{apprultxt,jdbcType=VARCHAR},</if>
            <if test="pordis != null">pordis = #{pordis,jdbcType=VARCHAR},</if>
            <if test="porloa != null">porloa = #{porloa,jdbcType=VARCHAR},</if>
            <if test="nonban != null">nonban = #{nonban,jdbcType=VARCHAR},</if>
            <if test="spcrcbflg != null">spcrcbflg = #{spcrcbflg,jdbcType=VARCHAR},</if>
            <if test="prepers18 != null">prepers18 = #{prepers18,jdbcType=INTEGER},</if>
            <if test="prepertxts18 != null">prepertxts18 = #{prepertxts18,jdbcType=VARCHAR},</if>
            <if test="shppars18 != null">shppars18 = #{shppars18,jdbcType=VARCHAR},</if>
            <if test="shptrss18 != null">shptrss18 = #{shptrss18,jdbcType=VARCHAR},</if>
            <if test="spcbenflg != null">spcbenflg = #{spcbenflg,jdbcType=VARCHAR},</if>
            <if test="etyextkey != null">etyextkey = #{etyextkey,jdbcType=VARCHAR},</if>
            <if test="partcon != null">partcon = #{partcon,jdbcType=DECIMAL},</if>
            <if test="collflg != null">collflg = #{collflg,jdbcType=VARCHAR},</if>
            <if test="teskeyunc != null">teskeyunc = #{teskeyunc,jdbcType=VARCHAR},</if>
            <if test="dbtflg != null">dbtflg = #{dbtflg,jdbcType=VARCHAR},</if>
            <if test="branchinr != null">branchinr = #{branchinr,jdbcType=VARCHAR},</if>
            <if test="bchkeyinr != null">bchkeyinr = #{bchkeyinr,jdbcType=VARCHAR},</if>
            <if test="rskrat != null">rskrat = #{rskrat,jdbcType=DECIMAL},</if>
            <if test="dflg != null">dflg = #{dflg,jdbcType=VARCHAR},</if>
            <if test="tratyp != null">tratyp = #{tratyp,jdbcType=VARCHAR},</if>
            <if test="oppbnk != null">oppbnk = #{oppbnk,jdbcType=VARCHAR},</if>
            <if test="mytype != null">mytype = #{mytype,jdbcType=VARCHAR},</if>
            <if test="isyifu != null">isyifu = #{isyifu,jdbcType=VARCHAR},</if>
            <if test="goddspcn != null">goddspcn = #{goddspcn,jdbcType=VARCHAR},</if>
            <if test="oppnam != null">oppnam = #{oppnam,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update led
        <set>
            ownref = #{ownref,jdbcType=VARCHAR},
            nam = #{nam,jdbcType=VARCHAR},
            ownusr = #{ownusr,jdbcType=VARCHAR},
            credat = #{credat,jdbcType=DATE},
            opndat = #{opndat,jdbcType=DATE},
            clsdat = #{clsdat,jdbcType=DATE},
            cnfdat = #{cnfdat,jdbcType=DATE},
            advdat = #{advdat,jdbcType=DATE},
            issnam = #{issnam,jdbcType=VARCHAR},
            issref = #{issref,jdbcType=VARCHAR},
            amedat = #{amedat,jdbcType=DATE},
            amenbr = #{amenbr,jdbcType=INTEGER},
            avbby = #{avbby,jdbcType=VARCHAR},
            avbwth = #{avbwth,jdbcType=VARCHAR},
            bennam = #{bennam,jdbcType=VARCHAR},
            benref = #{benref,jdbcType=VARCHAR},
            chato = #{chato,jdbcType=VARCHAR},
            cnfflg = #{cnfflg,jdbcType=VARCHAR},
            cnfdet = #{cnfdet,jdbcType=VARCHAR},
            cnfsta = #{cnfsta,jdbcType=VARCHAR},
            expdat = #{expdat,jdbcType=DATE},
            expplc = #{expplc,jdbcType=VARCHAR},
            lcrtyp = #{lcrtyp,jdbcType=VARCHAR},
            nomspc = #{nomspc,jdbcType=VARCHAR},
            nomtop = #{nomtop,jdbcType=INTEGER},
            nomton = #{nomton,jdbcType=INTEGER},
            preadvdt = #{preadvdt,jdbcType=DATE},
            shpdat = #{shpdat,jdbcType=DATE},
            shpfro = #{shpfro,jdbcType=VARCHAR},
            shppar = #{shppar,jdbcType=VARCHAR},
            shpto = #{shpto,jdbcType=VARCHAR},
            shptrs = #{shptrs,jdbcType=VARCHAR},
            stacty = #{stacty,jdbcType=VARCHAR},
            stagod = #{stagod,jdbcType=VARCHAR},
            utlnbr = #{utlnbr,jdbcType=INTEGER},
            ver = #{ver,jdbcType=VARCHAR},
            aplbnkdirsnd = #{aplbnkdirsnd,jdbcType=VARCHAR},
            tenmaxday = #{tenmaxday,jdbcType=INTEGER},
            cnfsnd = #{cnfsnd,jdbcType=VARCHAR},
            revflg = #{revflg,jdbcType=VARCHAR},
            revnbr = #{revnbr,jdbcType=INTEGER},
            revtimes = #{revtimes,jdbcType=INTEGER},
            revdat = #{revdat,jdbcType=DATE},
            revcum = #{revcum,jdbcType=VARCHAR},
            revtyp = #{revtyp,jdbcType=VARCHAR},
            cnfins = #{cnfins,jdbcType=VARCHAR},
            redclsflg = #{redclsflg,jdbcType=VARCHAR},
            advnbr = #{advnbr,jdbcType=INTEGER},
            resflg = #{resflg,jdbcType=VARCHAR},
            inctrf = #{inctrf,jdbcType=VARCHAR},
            apprul = #{apprul,jdbcType=VARCHAR},
            apprultxt = #{apprultxt,jdbcType=VARCHAR},
            pordis = #{pordis,jdbcType=VARCHAR},
            porloa = #{porloa,jdbcType=VARCHAR},
            nonban = #{nonban,jdbcType=VARCHAR},
            spcrcbflg = #{spcrcbflg,jdbcType=VARCHAR},
            prepers18 = #{prepers18,jdbcType=INTEGER},
            prepertxts18 = #{prepertxts18,jdbcType=VARCHAR},
            shppars18 = #{shppars18,jdbcType=VARCHAR},
            shptrss18 = #{shptrss18,jdbcType=VARCHAR},
            spcbenflg = #{spcbenflg,jdbcType=VARCHAR},
            etyextkey = #{etyextkey,jdbcType=VARCHAR},
            partcon = #{partcon,jdbcType=DECIMAL},
            collflg = #{collflg,jdbcType=VARCHAR},
            teskeyunc = #{teskeyunc,jdbcType=VARCHAR},
            dbtflg = #{dbtflg,jdbcType=VARCHAR},
            branchinr = #{branchinr,jdbcType=VARCHAR},
            bchkeyinr = #{bchkeyinr,jdbcType=VARCHAR},
            rskrat = #{rskrat,jdbcType=DECIMAL},
            dflg = #{dflg,jdbcType=VARCHAR},
            tratyp = #{tratyp,jdbcType=VARCHAR},
            oppbnk = #{oppbnk,jdbcType=VARCHAR},
            mytype = #{mytype,jdbcType=VARCHAR},
            isyifu = #{isyifu,jdbcType=VARCHAR},
            goddspcn = #{goddspcn,jdbcType=VARCHAR},
            oppnam = #{oppnam,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 led
        <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.ownusr != null">ownusr = #{module.ownusr,jdbcType=VARCHAR},</if>
            <if test="module.credat != null">credat = #{module.credat,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.cnfdat != null">cnfdat = #{module.cnfdat,jdbcType=DATE},</if>
            <if test="module.advdat != null">advdat = #{module.advdat,jdbcType=DATE},</if>
            <if test="module.issnam != null">issnam = #{module.issnam,jdbcType=VARCHAR},</if>
            <if test="module.issref != null">issref = #{module.issref,jdbcType=VARCHAR},</if>
            <if test="module.amedat != null">amedat = #{module.amedat,jdbcType=DATE},</if>
            <if test="module.amenbr != null">amenbr = #{module.amenbr,jdbcType=INTEGER},</if>
            <if test="module.avbby != null">avbby = #{module.avbby,jdbcType=VARCHAR},</if>
            <if test="module.avbwth != null">avbwth = #{module.avbwth,jdbcType=VARCHAR},</if>
            <if test="module.bennam != null">bennam = #{module.bennam,jdbcType=VARCHAR},</if>
            <if test="module.benref != null">benref = #{module.benref,jdbcType=VARCHAR},</if>
            <if test="module.chato != null">chato = #{module.chato,jdbcType=VARCHAR},</if>
            <if test="module.cnfflg != null">cnfflg = #{module.cnfflg,jdbcType=VARCHAR},</if>
            <if test="module.cnfdet != null">cnfdet = #{module.cnfdet,jdbcType=VARCHAR},</if>
            <if test="module.cnfsta != null">cnfsta = #{module.cnfsta,jdbcType=VARCHAR},</if>
            <if test="module.expdat != null">expdat = #{module.expdat,jdbcType=DATE},</if>
            <if test="module.expplc != null">expplc = #{module.expplc,jdbcType=VARCHAR},</if>
            <if test="module.lcrtyp != null">lcrtyp = #{module.lcrtyp,jdbcType=VARCHAR},</if>
            <if test="module.nomspc != null">nomspc = #{module.nomspc,jdbcType=VARCHAR},</if>
            <if test="module.nomtop != null">nomtop = #{module.nomtop,jdbcType=INTEGER},</if>
            <if test="module.nomton != null">nomton = #{module.nomton,jdbcType=INTEGER},</if>
            <if test="module.preadvdt != null">preadvdt = #{module.preadvdt,jdbcType=DATE},</if>
            <if test="module.shpdat != null">shpdat = #{module.shpdat,jdbcType=DATE},</if>
            <if test="module.shpfro != null">shpfro = #{module.shpfro,jdbcType=VARCHAR},</if>
            <if test="module.shppar != null">shppar = #{module.shppar,jdbcType=VARCHAR},</if>
            <if test="module.shpto != null">shpto = #{module.shpto,jdbcType=VARCHAR},</if>
            <if test="module.shptrs != null">shptrs = #{module.shptrs,jdbcType=VARCHAR},</if>
            <if test="module.stacty != null">stacty = #{module.stacty,jdbcType=VARCHAR},</if>
            <if test="module.stagod != null">stagod = #{module.stagod,jdbcType=VARCHAR},</if>
            <if test="module.utlnbr != null">utlnbr = #{module.utlnbr,jdbcType=INTEGER},</if>
            <if test="module.ver != null">ver = #{module.ver,jdbcType=VARCHAR},</if>
            <if test="module.aplbnkdirsnd != null">aplbnkdirsnd = #{module.aplbnkdirsnd,jdbcType=VARCHAR},</if>
            <if test="module.tenmaxday != null">tenmaxday = #{module.tenmaxday,jdbcType=INTEGER},</if>
            <if test="module.cnfsnd != null">cnfsnd = #{module.cnfsnd,jdbcType=VARCHAR},</if>
            <if test="module.revflg != null">revflg = #{module.revflg,jdbcType=VARCHAR},</if>
            <if test="module.revnbr != null">revnbr = #{module.revnbr,jdbcType=INTEGER},</if>
            <if test="module.revtimes != null">revtimes = #{module.revtimes,jdbcType=INTEGER},</if>
            <if test="module.revdat != null">revdat = #{module.revdat,jdbcType=DATE},</if>
            <if test="module.revcum != null">revcum = #{module.revcum,jdbcType=VARCHAR},</if>
            <if test="module.revtyp != null">revtyp = #{module.revtyp,jdbcType=VARCHAR},</if>
            <if test="module.cnfins != null">cnfins = #{module.cnfins,jdbcType=VARCHAR},</if>
            <if test="module.redclsflg != null">redclsflg = #{module.redclsflg,jdbcType=VARCHAR},</if>
            <if test="module.advnbr != null">advnbr = #{module.advnbr,jdbcType=INTEGER},</if>
            <if test="module.resflg != null">resflg = #{module.resflg,jdbcType=VARCHAR},</if>
            <if test="module.inctrf != null">inctrf = #{module.inctrf,jdbcType=VARCHAR},</if>
            <if test="module.apprul != null">apprul = #{module.apprul,jdbcType=VARCHAR},</if>
            <if test="module.apprultxt != null">apprultxt = #{module.apprultxt,jdbcType=VARCHAR},</if>
            <if test="module.pordis != null">pordis = #{module.pordis,jdbcType=VARCHAR},</if>
            <if test="module.porloa != null">porloa = #{module.porloa,jdbcType=VARCHAR},</if>
            <if test="module.nonban != null">nonban = #{module.nonban,jdbcType=VARCHAR},</if>
            <if test="module.spcrcbflg != null">spcrcbflg = #{module.spcrcbflg,jdbcType=VARCHAR},</if>
            <if test="module.prepers18 != null">prepers18 = #{module.prepers18,jdbcType=INTEGER},</if>
            <if test="module.prepertxts18 != null">prepertxts18 = #{module.prepertxts18,jdbcType=VARCHAR},</if>
            <if test="module.shppars18 != null">shppars18 = #{module.shppars18,jdbcType=VARCHAR},</if>
            <if test="module.shptrss18 != null">shptrss18 = #{module.shptrss18,jdbcType=VARCHAR},</if>
            <if test="module.spcbenflg != null">spcbenflg = #{module.spcbenflg,jdbcType=VARCHAR},</if>
            <if test="module.etyextkey != null">etyextkey = #{module.etyextkey,jdbcType=VARCHAR},</if>
            <if test="module.partcon != null">partcon = #{module.partcon,jdbcType=DECIMAL},</if>
            <if test="module.collflg != null">collflg = #{module.collflg,jdbcType=VARCHAR},</if>
            <if test="module.teskeyunc != null">teskeyunc = #{module.teskeyunc,jdbcType=VARCHAR},</if>
            <if test="module.dbtflg != null">dbtflg = #{module.dbtflg,jdbcType=VARCHAR},</if>
            <if test="module.branchinr != null">branchinr = #{module.branchinr,jdbcType=VARCHAR},</if>
            <if test="module.bchkeyinr != null">bchkeyinr = #{module.bchkeyinr,jdbcType=VARCHAR},</if>
            <if test="module.rskrat != null">rskrat = #{module.rskrat,jdbcType=DECIMAL},</if>
            <if test="module.dflg != null">dflg = #{module.dflg,jdbcType=VARCHAR},</if>
            <if test="module.tratyp != null">tratyp = #{module.tratyp,jdbcType=VARCHAR},</if>
            <if test="module.oppbnk != null">oppbnk = #{module.oppbnk,jdbcType=VARCHAR},</if>
            <if test="module.mytype != null">mytype = #{module.mytype,jdbcType=VARCHAR},</if>
            <if test="module.isyifu != null">isyifu = #{module.isyifu,jdbcType=VARCHAR},</if>
            <if test="module.goddspcn != null">goddspcn = #{module.goddspcn,jdbcType=VARCHAR},</if>
            <if test="module.oppnam != null">oppnam = #{module.oppnam,jdbcType=VARCHAR},</if>
        </set>
        ${conditions}
    </update>

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

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

    <select id="selectByAnyref" resultType="com.brilliance.isc.bo.Led">
        select
        <include refid="Base_Column_List"/>
        from led WHERE INR in ( select distinct OBJINR from PTS where OBJTYP = #{objtyp} and REF = #{ref}
        <if test="rol != null and rol != ''">
            and rol = #{rol}
        </if>
        )
        ORDER BY CREDAT desc
        limit 1
    </select>

    <select id="selectByWhere" resultType="com.brilliance.isc.bo.Led">
        select
        <include refid="Base_Column_List"/>
        from led WHERE 1=1
        <if test="ownref != null and ownref != ''"> and ownref = #{ownref,jdbcType=VARCHAR}</if>
        limit 1
    </select>
    <select id="queryLed" resultType="com.brilliance.isc.vo.lc.LedWithPtsCbbResponseVo">
        select
        led.*,
        cbb.cur cur, cbb.amt amt,pty.extkey benExtkey,pty.nam1 benName
        from led
        left join cbb on cbb.OBJINR = led.inr and cbb.OBJTYP = 'LED'  and cbb.cbc = 'MAXSUM' and cbb.extid = 'AMT1' and cbb.enddat = '2299-12-31'
        left join pts on pts.OBJINR = led.inr and pts.OBJTYP = 'LED' and pts.rol = 'BEN'
        left join pty pty on pty.inr = pts.ptyinr
        where 1 = 1
        <!--机构隔离-->
        <if test="bchinr != null and bchinr != '' ">
            AND led.bchkeyinr = #{bchinr}
        </if>
        <!--业务编号-->
        <if test="seaownref != null and seaownref != ''">
            AND UPPER(led.OWNREF) LIKE concat(concat('%', UPPER(#{seaownref})), '%')
        </if>
        <!--日期-->
        <if test="opndatfrom != null and opndatfrom != ''">
            AND led.credat &gt;= #{opndatfrom}
        </if>
        <!--日期-->
        <if test="opndatto != null and opndatto != ''">
            AND led.credat &lt;= #{opndatto}
        </if>
        <!--客户号/名称 -->
        <if test="searef != null and searef != ''">
            and exists (
            select 1 from PTS,PTY
            where led.INR = PTS.OBJINR
            AND PTY.INR = PTS.PTYINR
            AND PTS.OBJTYP = 'LED'
            AND PTS.ROL = 'BEN'
            AND (
            PTS.EXTKEY LIKE concat(concat('%', #{searef}), '%')
            or PTS.NAM LIKE concat(concat('%', #{searef}), '%')
            or PTS.CNNAM LIKE concat(concat('%', #{searef}), '%')
            or PTS.ENNAM LIKE concat(concat('%', #{searef}), '%')
            or PTY.NAM LIKE concat(concat('%', #{searef}), '%')
            )
            )
        </if>
        <!--是否闭卷 -->
        <if test="isClosed != null and isClosed != ''">
            <if test="isClosed == 'Y'.toString()">
                and led.clsdat is not null
            </if>
            <if test="isClosed == 'N'.toString()">
                and led.clsdat is  null
            </if>
        </if>
        order by led.credat desc , led.ownref desc
    </select>
    <select id="queryLedInfo" resultType="com.brilliance.isc.vo.lc.LedWithPtsCbbResponseVo">
        select
        led.*,bch.BCHNAME bchName,usr.NAM usrNam,
        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,
        apl.extkey aplExtkey,apl.nam aplName,ben.EXTKEY benExtkey,ben.nam benName,iss.EXTKEY issExtkey,iss.nam issName
        from led
        left join cbb max1 on max1.OBJINR = led.inr and max1.OBJTYP = 'LED' and max1.cbc = 'MAXSUM' and max1.extid =
        'AMT1' and max1.enddat = '2299-12-31'
        left join cbb max2 on max2.OBJINR = led.inr and max2.OBJTYP = 'LED' and max2.cbc = 'MAXSUM' and max2.extid =
        'AMT2' and max2.enddat = '2299-12-31'
        left join cbb opn1 on opn1.OBJINR = led.inr and opn1.OBJTYP = 'LED' and opn1.cbc = 'OPN' and opn1.extid = 'AMT1'
        and opn1.enddat = '2299-12-31'
        left join cbb opn2 on opn2.OBJINR = led.inr and opn2.OBJTYP = 'LED' and opn2.cbc = 'OPN' and opn2.extid = 'AMT2'
        and opn2.enddat = '2299-12-31'
        left join pts apl on apl.OBJINR = led.inr and apl.OBJTYP = 'LED' and apl.rol = 'APL'
        left join pts ben on ben.OBJINR = led.inr and ben.OBJTYP = 'LED' and ben.rol = 'BEN'
        left join pts iss on iss.OBJINR = led.inr and iss.OBJTYP = 'LED' and iss.rol = 'ISS'
        left join bch bch on bch.inr = led.BCHKEYINR
        left join usr usr on usr.EXTKEY = led.OWNUSR
        where led.flwsta = 'R'
        <!--机构隔离-->
        <if test="bchinr != null and bchinr != '' ">
            AND led.bchkeyinr = #{bchinr}
        </if>
        <!--业务编号-->
        <if test="seaownref != null and seaownref != ''">
            AND UPPER(led.OWNREF) LIKE concat(concat('%', UPPER(#{seaownref})), '%')
        </if>
        <!--日期-->
        <if test="opndatfrom != null and opndatfrom != ''">
            AND led.CREDAT &gt;= #{opndatfrom}
        </if>
        <if test="opndatto != null and opndatto != ''">
            AND led.CREDAT &lt;= #{opndatto}
        </if>
        <!--信用证类型-->
        <if test="sealcrtyp != null and sealcrtyp != '' ">
            AND led.lcrtyp = #{sealcrtyp}
        </if>
        <!--客户号/名称 -->
        <if test="ptyExtkey != null and ptyExtkey != ''">
            and exists (
            select 1 from PTS
            where led.INR = PTS.OBJINR
            AND PTS.OBJTYP = 'LED'
            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 led.INR = PTS.OBJINR
            AND PTS.OBJTYP = 'LED'
            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 led.INR = PTS.OBJINR
            AND PTS.OBJTYP = 'LED'
            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 = 'LED'
            AND INFCONCBS.OBJINR = LED.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 led.clsdat is not null
            </if>
            <if test="seasta == 'O'.toString()">
                and led.clsdat is null
            </if>
        </if>

        <if test='column != null and column!="" '>
            order by  ${column}  ${order}
        </if>
        <if test='column == null or column=="" '>
            order by led.opndat desc , led.ownref desc
        </if>
    </select>

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

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