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

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Brd">
        <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="pnttyp" column="pnttyp" jdbcType="VARCHAR"/>
        <result property="pntinr" column="pntinr" jdbcType="VARCHAR"/>
        <result property="predat" column="predat" jdbcType="DATE"/>
        <result property="shpdat" column="shpdat" jdbcType="DATE"/>
        <result property="spddat" column="spddat" jdbcType="DATE"/>
        <result property="totdat" column="totdat" jdbcType="DATE"/>
        <result property="advdat" column="advdat" jdbcType="DATE"/>
        <result property="matdat" column="matdat" jdbcType="DATE"/>
        <result property="rcvdat" column="rcvdat" jdbcType="DATE"/>
        <result property="disdat" column="disdat" jdbcType="DATE"/>
        <result property="docflg" column="docflg" jdbcType="VARCHAR"/>
        <result property="rejflg" column="rejflg" jdbcType="VARCHAR"/>
        <result property="approvcod" column="approvcod" jdbcType="VARCHAR"/>
        <result property="relgodflg" column="relgodflg" jdbcType="VARCHAR"/>
        <result property="relgoddat" column="relgoddat" jdbcType="DATE"/>
        <result property="trpdocnum" column="trpdocnum" jdbcType="VARCHAR"/>
        <result property="frepayflg" column="frepayflg" jdbcType="VARCHAR"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="advtyp" column="advtyp" jdbcType="VARCHAR"/>
        <result property="reltyp" column="reltyp" jdbcType="VARCHAR"/>
        <result property="expdat" column="expdat" jdbcType="DATE"/>
        <result property="rtoaplflg" column="rtoaplflg" jdbcType="VARCHAR"/>
        <result property="trpdoctyp" column="trpdoctyp" jdbcType="VARCHAR"/>
        <result property="tradat" column="tradat" jdbcType="DATE"/>
        <result property="tramod" column="tramod" jdbcType="VARCHAR"/>
        <result property="mattxtflg" column="mattxtflg" jdbcType="VARCHAR"/>
        <result property="dscinsflg" column="dscinsflg" jdbcType="VARCHAR"/>
        <result property="docprbrol" column="docprbrol" jdbcType="VARCHAR"/>
        <result property="docsta" column="docsta" jdbcType="VARCHAR"/>
        <result property="igndisflg" column="igndisflg" jdbcType="VARCHAR"/>
        <result property="totcur" column="totcur" jdbcType="VARCHAR"/>
        <result property="totamt" column="totamt" jdbcType="DECIMAL"/>
        <result property="payrol" column="payrol" jdbcType="VARCHAR"/>
        <result property="acpnowflg" column="acpnowflg" jdbcType="VARCHAR"/>
        <result property="orddat" column="orddat" jdbcType="DATE"/>
        <result property="advdocflg" column="advdocflg" jdbcType="VARCHAR"/>
        <result property="etyextkey" column="etyextkey" jdbcType="VARCHAR"/>
        <result property="bchkeyinr" column="bchkeyinr" jdbcType="VARCHAR"/>
        <result property="branchinr" column="branchinr" jdbcType="VARCHAR"/>
        <result property="ngrcod" column="ngrcod" jdbcType="VARCHAR"/>
        <result property="sgdinr" column="sgdinr" jdbcType="VARCHAR"/>
        <result property="blnum" column="blnum" jdbcType="VARCHAR"/>
        <result property="shgref" column="shgref" jdbcType="VARCHAR"/>
        <result property="guaflg" column="guaflg" jdbcType="VARCHAR"/>
        <result property="tenmaxday" column="tenmaxday" jdbcType="INTEGER"/>
        <result property="stadat" column="stadat" jdbcType="DATE"/>
        <result property="rptref" column="rptref" jdbcType="VARCHAR"/>
        <result property="invref" column="invref" jdbcType="VARCHAR"/>
        <result property="prechkdat" column="prechkdat" jdbcType="DATE"/>
        <result property="ischktyp" column="ischktyp" jdbcType="VARCHAR"/>
        <result property="cfabrtflg" column="cfabrtflg" jdbcType="VARCHAR"/>
        <result property="cfabrttxt" column="cfabrttxt" jdbcType="VARCHAR"/>
        <result property="invtyp" column="invtyp" jdbcType="VARCHAR"/>
        <result property="oppnam" column="oppnam" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,ownref,nam,ownusr,credat,opndat,clsdat,pnttyp,pntinr,predat,shpdat,spddat,totdat,advdat,matdat,rcvdat,disdat,docflg,rejflg,approvcod,relgodflg,relgoddat,trpdocnum,frepayflg,ver,advtyp,reltyp,expdat,rtoaplflg,trpdoctyp,tradat,tramod,mattxtflg,dscinsflg,docprbrol,docsta,igndisflg,totcur,totamt,payrol,acpnowflg,orddat,advdocflg,etyextkey,bchkeyinr,branchinr,ngrcod,sgdinr,blnum,shgref,guaflg,tenmaxday,stadat,rptref,invref,prechkdat,ischktyp,cfabrtflg,cfabrttxt,invtyp,oppnam
    </sql>

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

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

    <insert id="insert">
        insert into brd (<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},
            #{pnttyp,jdbcType=VARCHAR},
            #{pntinr,jdbcType=VARCHAR},
            #{predat,jdbcType=DATE},
            #{shpdat,jdbcType=DATE},
            #{spddat,jdbcType=DATE},
            #{totdat,jdbcType=DATE},
            #{advdat,jdbcType=DATE},
            #{matdat,jdbcType=DATE},
            #{rcvdat,jdbcType=DATE},
            #{disdat,jdbcType=DATE},
            #{docflg,jdbcType=VARCHAR},
            #{rejflg,jdbcType=VARCHAR},
            #{approvcod,jdbcType=VARCHAR},
            #{relgodflg,jdbcType=VARCHAR},
            #{relgoddat,jdbcType=DATE},
            #{trpdocnum,jdbcType=VARCHAR},
            #{frepayflg,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            #{advtyp,jdbcType=VARCHAR},
            #{reltyp,jdbcType=VARCHAR},
            #{expdat,jdbcType=DATE},
            #{rtoaplflg,jdbcType=VARCHAR},
            #{trpdoctyp,jdbcType=VARCHAR},
            #{tradat,jdbcType=DATE},
            #{tramod,jdbcType=VARCHAR},
            #{mattxtflg,jdbcType=VARCHAR},
            #{dscinsflg,jdbcType=VARCHAR},
            #{docprbrol,jdbcType=VARCHAR},
            #{docsta,jdbcType=VARCHAR},
            #{igndisflg,jdbcType=VARCHAR},
            #{totcur,jdbcType=VARCHAR},
            #{totamt,jdbcType=DECIMAL},
            #{payrol,jdbcType=VARCHAR},
            #{acpnowflg,jdbcType=VARCHAR},
            #{orddat,jdbcType=DATE},
            #{advdocflg,jdbcType=VARCHAR},
            #{etyextkey,jdbcType=VARCHAR},
            #{bchkeyinr,jdbcType=VARCHAR},
            #{branchinr,jdbcType=VARCHAR},
            #{ngrcod,jdbcType=VARCHAR},
            #{sgdinr,jdbcType=VARCHAR},
            #{blnum,jdbcType=VARCHAR},
            #{shgref,jdbcType=VARCHAR},
            #{guaflg,jdbcType=VARCHAR},
            #{tenmaxday,jdbcType=INTEGER},
            #{stadat,jdbcType=DATE},
            #{rptref,jdbcType=VARCHAR},
            #{invref,jdbcType=VARCHAR},
            #{prechkdat,jdbcType=DATE},
            #{ischktyp,jdbcType=VARCHAR},
            #{cfabrtflg,jdbcType=VARCHAR},
            #{cfabrttxt,jdbcType=VARCHAR},
            #{invtyp,jdbcType=VARCHAR},
            #{oppnam,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into brd
        <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="pnttyp != null">pnttyp,</if>
            <if test="pntinr != null">pntinr,</if>
            <if test="predat != null">predat,</if>
            <if test="shpdat != null">shpdat,</if>
            <if test="spddat != null">spddat,</if>
            <if test="totdat != null">totdat,</if>
            <if test="advdat != null">advdat,</if>
            <if test="matdat != null">matdat,</if>
            <if test="rcvdat != null">rcvdat,</if>
            <if test="disdat != null">disdat,</if>
            <if test="docflg != null">docflg,</if>
            <if test="rejflg != null">rejflg,</if>
            <if test="approvcod != null">approvcod,</if>
            <if test="relgodflg != null">relgodflg,</if>
            <if test="relgoddat != null">relgoddat,</if>
            <if test="trpdocnum != null">trpdocnum,</if>
            <if test="frepayflg != null">frepayflg,</if>
            <if test="ver != null">ver,</if>
            <if test="advtyp != null">advtyp,</if>
            <if test="reltyp != null">reltyp,</if>
            <if test="expdat != null">expdat,</if>
            <if test="rtoaplflg != null">rtoaplflg,</if>
            <if test="trpdoctyp != null">trpdoctyp,</if>
            <if test="tradat != null">tradat,</if>
            <if test="tramod != null">tramod,</if>
            <if test="mattxtflg != null">mattxtflg,</if>
            <if test="dscinsflg != null">dscinsflg,</if>
            <if test="docprbrol != null">docprbrol,</if>
            <if test="docsta != null">docsta,</if>
            <if test="igndisflg != null">igndisflg,</if>
            <if test="totcur != null">totcur,</if>
            <if test="totamt != null">totamt,</if>
            <if test="payrol != null">payrol,</if>
            <if test="acpnowflg != null">acpnowflg,</if>
            <if test="orddat != null">orddat,</if>
            <if test="advdocflg != null">advdocflg,</if>
            <if test="etyextkey != null">etyextkey,</if>
            <if test="bchkeyinr != null">bchkeyinr,</if>
            <if test="branchinr != null">branchinr,</if>
            <if test="ngrcod != null">ngrcod,</if>
            <if test="sgdinr != null">sgdinr,</if>
            <if test="blnum != null">blnum,</if>
            <if test="shgref != null">shgref,</if>
            <if test="guaflg != null">guaflg,</if>
            <if test="tenmaxday != null">tenmaxday,</if>
            <if test="stadat != null">stadat,</if>
            <if test="rptref != null">rptref,</if>
            <if test="invref != null">invref,</if>
            <if test="prechkdat != null">prechkdat,</if>
            <if test="ischktyp != null">ischktyp,</if>
            <if test="cfabrtflg != null">cfabrtflg,</if>
            <if test="cfabrttxt != null">cfabrttxt,</if>
            <if test="invtyp != null">invtyp,</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="pnttyp != null">#{pnttyp,jdbcType=VARCHAR},</if>
            <if test="pntinr != null">#{pntinr,jdbcType=VARCHAR},</if>
            <if test="predat != null">#{predat,jdbcType=DATE},</if>
            <if test="shpdat != null">#{shpdat,jdbcType=DATE},</if>
            <if test="spddat != null">#{spddat,jdbcType=DATE},</if>
            <if test="totdat != null">#{totdat,jdbcType=DATE},</if>
            <if test="advdat != null">#{advdat,jdbcType=DATE},</if>
            <if test="matdat != null">#{matdat,jdbcType=DATE},</if>
            <if test="rcvdat != null">#{rcvdat,jdbcType=DATE},</if>
            <if test="disdat != null">#{disdat,jdbcType=DATE},</if>
            <if test="docflg != null">#{docflg,jdbcType=VARCHAR},</if>
            <if test="rejflg != null">#{rejflg,jdbcType=VARCHAR},</if>
            <if test="approvcod != null">#{approvcod,jdbcType=VARCHAR},</if>
            <if test="relgodflg != null">#{relgodflg,jdbcType=VARCHAR},</if>
            <if test="relgoddat != null">#{relgoddat,jdbcType=DATE},</if>
            <if test="trpdocnum != null">#{trpdocnum,jdbcType=VARCHAR},</if>
            <if test="frepayflg != null">#{frepayflg,jdbcType=VARCHAR},</if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR},</if>
            <if test="advtyp != null">#{advtyp,jdbcType=VARCHAR},</if>
            <if test="reltyp != null">#{reltyp,jdbcType=VARCHAR},</if>
            <if test="expdat != null">#{expdat,jdbcType=DATE},</if>
            <if test="rtoaplflg != null">#{rtoaplflg,jdbcType=VARCHAR},</if>
            <if test="trpdoctyp != null">#{trpdoctyp,jdbcType=VARCHAR},</if>
            <if test="tradat != null">#{tradat,jdbcType=DATE},</if>
            <if test="tramod != null">#{tramod,jdbcType=VARCHAR},</if>
            <if test="mattxtflg != null">#{mattxtflg,jdbcType=VARCHAR},</if>
            <if test="dscinsflg != null">#{dscinsflg,jdbcType=VARCHAR},</if>
            <if test="docprbrol != null">#{docprbrol,jdbcType=VARCHAR},</if>
            <if test="docsta != null">#{docsta,jdbcType=VARCHAR},</if>
            <if test="igndisflg != null">#{igndisflg,jdbcType=VARCHAR},</if>
            <if test="totcur != null">#{totcur,jdbcType=VARCHAR},</if>
            <if test="totamt != null">#{totamt,jdbcType=DECIMAL},</if>
            <if test="payrol != null">#{payrol,jdbcType=VARCHAR},</if>
            <if test="acpnowflg != null">#{acpnowflg,jdbcType=VARCHAR},</if>
            <if test="orddat != null">#{orddat,jdbcType=DATE},</if>
            <if test="advdocflg != null">#{advdocflg,jdbcType=VARCHAR},</if>
            <if test="etyextkey != null">#{etyextkey,jdbcType=VARCHAR},</if>
            <if test="bchkeyinr != null">#{bchkeyinr,jdbcType=VARCHAR},</if>
            <if test="branchinr != null">#{branchinr,jdbcType=VARCHAR},</if>
            <if test="ngrcod != null">#{ngrcod,jdbcType=VARCHAR},</if>
            <if test="sgdinr != null">#{sgdinr,jdbcType=VARCHAR},</if>
            <if test="blnum != null">#{blnum,jdbcType=VARCHAR},</if>
            <if test="shgref != null">#{shgref,jdbcType=VARCHAR},</if>
            <if test="guaflg != null">#{guaflg,jdbcType=VARCHAR},</if>
            <if test="tenmaxday != null">#{tenmaxday,jdbcType=INTEGER},</if>
            <if test="stadat != null">#{stadat,jdbcType=DATE},</if>
            <if test="rptref != null">#{rptref,jdbcType=VARCHAR},</if>
            <if test="invref != null">#{invref,jdbcType=VARCHAR},</if>
            <if test="prechkdat != null">#{prechkdat,jdbcType=DATE},</if>
            <if test="ischktyp != null">#{ischktyp,jdbcType=VARCHAR},</if>
            <if test="cfabrtflg != null">#{cfabrtflg,jdbcType=VARCHAR},</if>
            <if test="cfabrttxt != null">#{cfabrttxt,jdbcType=VARCHAR},</if>
            <if test="invtyp != null">#{invtyp,jdbcType=VARCHAR},</if>
            <if test="oppnam != null">#{oppnam,jdbcType=VARCHAR},</if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update brd
        <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="pnttyp != null">pnttyp = #{pnttyp,jdbcType=VARCHAR},</if>
            <if test="pntinr != null">pntinr = #{pntinr,jdbcType=VARCHAR},</if>
            <if test="predat != null">predat = #{predat,jdbcType=DATE},</if>
            <if test="shpdat != null">shpdat = #{shpdat,jdbcType=DATE},</if>
            <if test="spddat != null">spddat = #{spddat,jdbcType=DATE},</if>
            <if test="totdat != null">totdat = #{totdat,jdbcType=DATE},</if>
            <if test="advdat != null">advdat = #{advdat,jdbcType=DATE},</if>
            <if test="matdat != null">matdat = #{matdat,jdbcType=DATE},</if>
            <if test="rcvdat != null">rcvdat = #{rcvdat,jdbcType=DATE},</if>
            <if test="disdat != null">disdat = #{disdat,jdbcType=DATE},</if>
            <if test="docflg != null">docflg = #{docflg,jdbcType=VARCHAR},</if>
            <if test="rejflg != null">rejflg = #{rejflg,jdbcType=VARCHAR},</if>
            <if test="approvcod != null">approvcod = #{approvcod,jdbcType=VARCHAR},</if>
            <if test="relgodflg != null">relgodflg = #{relgodflg,jdbcType=VARCHAR},</if>
            <if test="relgoddat != null">relgoddat = #{relgoddat,jdbcType=DATE},</if>
            <if test="trpdocnum != null">trpdocnum = #{trpdocnum,jdbcType=VARCHAR},</if>
            <if test="frepayflg != null">frepayflg = #{frepayflg,jdbcType=VARCHAR},</if>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            <if test="advtyp != null">advtyp = #{advtyp,jdbcType=VARCHAR},</if>
            <if test="reltyp != null">reltyp = #{reltyp,jdbcType=VARCHAR},</if>
            <if test="expdat != null">expdat = #{expdat,jdbcType=DATE},</if>
            <if test="rtoaplflg != null">rtoaplflg = #{rtoaplflg,jdbcType=VARCHAR},</if>
            <if test="trpdoctyp != null">trpdoctyp = #{trpdoctyp,jdbcType=VARCHAR},</if>
            <if test="tradat != null">tradat = #{tradat,jdbcType=DATE},</if>
            <if test="tramod != null">tramod = #{tramod,jdbcType=VARCHAR},</if>
            <if test="mattxtflg != null">mattxtflg = #{mattxtflg,jdbcType=VARCHAR},</if>
            <if test="dscinsflg != null">dscinsflg = #{dscinsflg,jdbcType=VARCHAR},</if>
            <if test="docprbrol != null">docprbrol = #{docprbrol,jdbcType=VARCHAR},</if>
            <if test="docsta != null">docsta = #{docsta,jdbcType=VARCHAR},</if>
            <if test="igndisflg != null">igndisflg = #{igndisflg,jdbcType=VARCHAR},</if>
            <if test="totcur != null">totcur = #{totcur,jdbcType=VARCHAR},</if>
            <if test="totamt != null">totamt = #{totamt,jdbcType=DECIMAL},</if>
            <if test="payrol != null">payrol = #{payrol,jdbcType=VARCHAR},</if>
            <if test="acpnowflg != null">acpnowflg = #{acpnowflg,jdbcType=VARCHAR},</if>
            <if test="orddat != null">orddat = #{orddat,jdbcType=DATE},</if>
            <if test="advdocflg != null">advdocflg = #{advdocflg,jdbcType=VARCHAR},</if>
            <if test="etyextkey != null">etyextkey = #{etyextkey,jdbcType=VARCHAR},</if>
            <if test="bchkeyinr != null">bchkeyinr = #{bchkeyinr,jdbcType=VARCHAR},</if>
            <if test="branchinr != null">branchinr = #{branchinr,jdbcType=VARCHAR},</if>
            <if test="ngrcod != null">ngrcod = #{ngrcod,jdbcType=VARCHAR},</if>
            <if test="sgdinr != null">sgdinr = #{sgdinr,jdbcType=VARCHAR},</if>
            <if test="blnum != null">blnum = #{blnum,jdbcType=VARCHAR},</if>
            <if test="shgref != null">shgref = #{shgref,jdbcType=VARCHAR},</if>
            <if test="guaflg != null">guaflg = #{guaflg,jdbcType=VARCHAR},</if>
            <if test="tenmaxday != null">tenmaxday = #{tenmaxday,jdbcType=INTEGER},</if>
            <if test="stadat != null">stadat = #{stadat,jdbcType=DATE},</if>
            <if test="rptref != null">rptref = #{rptref,jdbcType=VARCHAR},</if>
            <if test="invref != null">invref = #{invref,jdbcType=VARCHAR},</if>
            <if test="prechkdat != null">prechkdat = #{prechkdat,jdbcType=DATE},</if>
            <if test="ischktyp != null">ischktyp = #{ischktyp,jdbcType=VARCHAR},</if>
            <if test="cfabrtflg != null">cfabrtflg = #{cfabrtflg,jdbcType=VARCHAR},</if>
            <if test="cfabrttxt != null">cfabrttxt = #{cfabrttxt,jdbcType=VARCHAR},</if>
            <if test="invtyp != null">invtyp = #{invtyp,jdbcType=VARCHAR},</if>
            <if test="oppnam != null">oppnam = #{oppnam,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update brd
        <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},
            pnttyp = #{pnttyp,jdbcType=VARCHAR},
            pntinr = #{pntinr,jdbcType=VARCHAR},
            predat = #{predat,jdbcType=DATE},
            shpdat = #{shpdat,jdbcType=DATE},
            spddat = #{spddat,jdbcType=DATE},
            totdat = #{totdat,jdbcType=DATE},
            advdat = #{advdat,jdbcType=DATE},
            matdat = #{matdat,jdbcType=DATE},
            rcvdat = #{rcvdat,jdbcType=DATE},
            disdat = #{disdat,jdbcType=DATE},
            docflg = #{docflg,jdbcType=VARCHAR},
            rejflg = #{rejflg,jdbcType=VARCHAR},
            approvcod = #{approvcod,jdbcType=VARCHAR},
            relgodflg = #{relgodflg,jdbcType=VARCHAR},
            relgoddat = #{relgoddat,jdbcType=DATE},
            trpdocnum = #{trpdocnum,jdbcType=VARCHAR},
            frepayflg = #{frepayflg,jdbcType=VARCHAR},
            ver = #{ver,jdbcType=VARCHAR},
            advtyp = #{advtyp,jdbcType=VARCHAR},
            reltyp = #{reltyp,jdbcType=VARCHAR},
            expdat = #{expdat,jdbcType=DATE},
            rtoaplflg = #{rtoaplflg,jdbcType=VARCHAR},
            trpdoctyp = #{trpdoctyp,jdbcType=VARCHAR},
            tradat = #{tradat,jdbcType=DATE},
            tramod = #{tramod,jdbcType=VARCHAR},
            mattxtflg = #{mattxtflg,jdbcType=VARCHAR},
            dscinsflg = #{dscinsflg,jdbcType=VARCHAR},
            docprbrol = #{docprbrol,jdbcType=VARCHAR},
            docsta = #{docsta,jdbcType=VARCHAR},
            igndisflg = #{igndisflg,jdbcType=VARCHAR},
            totcur = #{totcur,jdbcType=VARCHAR},
            totamt = #{totamt,jdbcType=DECIMAL},
            payrol = #{payrol,jdbcType=VARCHAR},
            acpnowflg = #{acpnowflg,jdbcType=VARCHAR},
            orddat = #{orddat,jdbcType=DATE},
            advdocflg = #{advdocflg,jdbcType=VARCHAR},
            etyextkey = #{etyextkey,jdbcType=VARCHAR},
            bchkeyinr = #{bchkeyinr,jdbcType=VARCHAR},
            branchinr = #{branchinr,jdbcType=VARCHAR},
            ngrcod = #{ngrcod,jdbcType=VARCHAR},
            sgdinr = #{sgdinr,jdbcType=VARCHAR},
            blnum = #{blnum,jdbcType=VARCHAR},
            shgref = #{shgref,jdbcType=VARCHAR},
            guaflg = #{guaflg,jdbcType=VARCHAR},
            tenmaxday = #{tenmaxday,jdbcType=INTEGER},
            stadat = #{stadat,jdbcType=DATE},
            rptref = #{rptref,jdbcType=VARCHAR},
            invref = #{invref,jdbcType=VARCHAR},
            prechkdat = #{prechkdat,jdbcType=DATE},
            ischktyp = #{ischktyp,jdbcType=VARCHAR},
            cfabrtflg = #{cfabrtflg,jdbcType=VARCHAR},
            cfabrttxt = #{cfabrttxt,jdbcType=VARCHAR},
            invtyp = #{invtyp,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 brd
        <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.pnttyp != null">pnttyp = #{module.pnttyp,jdbcType=VARCHAR},</if>
            <if test="module.pntinr != null">pntinr = #{module.pntinr,jdbcType=VARCHAR},</if>
            <if test="module.predat != null">predat = #{module.predat,jdbcType=DATE},</if>
            <if test="module.shpdat != null">shpdat = #{module.shpdat,jdbcType=DATE},</if>
            <if test="module.spddat != null">spddat = #{module.spddat,jdbcType=DATE},</if>
            <if test="module.totdat != null">totdat = #{module.totdat,jdbcType=DATE},</if>
            <if test="module.advdat != null">advdat = #{module.advdat,jdbcType=DATE},</if>
            <if test="module.matdat != null">matdat = #{module.matdat,jdbcType=DATE},</if>
            <if test="module.rcvdat != null">rcvdat = #{module.rcvdat,jdbcType=DATE},</if>
            <if test="module.disdat != null">disdat = #{module.disdat,jdbcType=DATE},</if>
            <if test="module.docflg != null">docflg = #{module.docflg,jdbcType=VARCHAR},</if>
            <if test="module.rejflg != null">rejflg = #{module.rejflg,jdbcType=VARCHAR},</if>
            <if test="module.approvcod != null">approvcod = #{module.approvcod,jdbcType=VARCHAR},</if>
            <if test="module.relgodflg != null">relgodflg = #{module.relgodflg,jdbcType=VARCHAR},</if>
            <if test="module.relgoddat != null">relgoddat = #{module.relgoddat,jdbcType=DATE},</if>
            <if test="module.trpdocnum != null">trpdocnum = #{module.trpdocnum,jdbcType=VARCHAR},</if>
            <if test="module.frepayflg != null">frepayflg = #{module.frepayflg,jdbcType=VARCHAR},</if>
            <if test="module.ver != null">ver = #{module.ver,jdbcType=VARCHAR},</if>
            <if test="module.advtyp != null">advtyp = #{module.advtyp,jdbcType=VARCHAR},</if>
            <if test="module.reltyp != null">reltyp = #{module.reltyp,jdbcType=VARCHAR},</if>
            <if test="module.expdat != null">expdat = #{module.expdat,jdbcType=DATE},</if>
            <if test="module.rtoaplflg != null">rtoaplflg = #{module.rtoaplflg,jdbcType=VARCHAR},</if>
            <if test="module.trpdoctyp != null">trpdoctyp = #{module.trpdoctyp,jdbcType=VARCHAR},</if>
            <if test="module.tradat != null">tradat = #{module.tradat,jdbcType=DATE},</if>
            <if test="module.tramod != null">tramod = #{module.tramod,jdbcType=VARCHAR},</if>
            <if test="module.mattxtflg != null">mattxtflg = #{module.mattxtflg,jdbcType=VARCHAR},</if>
            <if test="module.dscinsflg != null">dscinsflg = #{module.dscinsflg,jdbcType=VARCHAR},</if>
            <if test="module.docprbrol != null">docprbrol = #{module.docprbrol,jdbcType=VARCHAR},</if>
            <if test="module.docsta != null">docsta = #{module.docsta,jdbcType=VARCHAR},</if>
            <if test="module.igndisflg != null">igndisflg = #{module.igndisflg,jdbcType=VARCHAR},</if>
            <if test="module.totcur != null">totcur = #{module.totcur,jdbcType=VARCHAR},</if>
            <if test="module.totamt != null">totamt = #{module.totamt,jdbcType=DECIMAL},</if>
            <if test="module.payrol != null">payrol = #{module.payrol,jdbcType=VARCHAR},</if>
            <if test="module.acpnowflg != null">acpnowflg = #{module.acpnowflg,jdbcType=VARCHAR},</if>
            <if test="module.orddat != null">orddat = #{module.orddat,jdbcType=DATE},</if>
            <if test="module.advdocflg != null">advdocflg = #{module.advdocflg,jdbcType=VARCHAR},</if>
            <if test="module.etyextkey != null">etyextkey = #{module.etyextkey,jdbcType=VARCHAR},</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.ngrcod != null">ngrcod = #{module.ngrcod,jdbcType=VARCHAR},</if>
            <if test="module.sgdinr != null">sgdinr = #{module.sgdinr,jdbcType=VARCHAR},</if>
            <if test="module.blnum != null">blnum = #{module.blnum,jdbcType=VARCHAR},</if>
            <if test="module.shgref != null">shgref = #{module.shgref,jdbcType=VARCHAR},</if>
            <if test="module.guaflg != null">guaflg = #{module.guaflg,jdbcType=VARCHAR},</if>
            <if test="module.tenmaxday != null">tenmaxday = #{module.tenmaxday,jdbcType=INTEGER},</if>
            <if test="module.stadat != null">stadat = #{module.stadat,jdbcType=DATE},</if>
            <if test="module.rptref != null">rptref = #{module.rptref,jdbcType=VARCHAR},</if>
            <if test="module.invref != null">invref = #{module.invref,jdbcType=VARCHAR},</if>
            <if test="module.prechkdat != null">prechkdat = #{module.prechkdat,jdbcType=DATE},</if>
            <if test="module.ischktyp != null">ischktyp = #{module.ischktyp,jdbcType=VARCHAR},</if>
            <if test="module.cfabrtflg != null">cfabrtflg = #{module.cfabrtflg,jdbcType=VARCHAR},</if>
            <if test="module.cfabrttxt != null">cfabrttxt = #{module.cfabrttxt,jdbcType=VARCHAR},</if>
            <if test="module.invtyp != null">invtyp = #{module.invtyp,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.Brd">
        select
        <include refid="Base_Column_List"/>
        from brd 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.Brd">
        select
        <include refid="Base_Column_List"/>
        from brd WHERE 1=1
        <if test="ownref != null and ownref != ''">and ownref = #{ownref,jdbcType=VARCHAR}</if>
        limit 1
    </select>

    <select id="queryBrd" resultType="com.brilliance.isc.vo.lc.BrdWithPtsCbbResponseVo">
        select
        brd.*,lid.OWNREF pntref,
        cbb.cur cur, cbb.amt amt,pty.extkey aplExtkey,pty.nam1 aplName
        from brd
        left join cbb on cbb.OBJINR = brd.inr and cbb.OBJTYP = 'BRD' and cbb.cbc = 'MAXSUM' and cbb.extid = 'AMT1' and
        cbb.enddat = '2299-12-31'
        left join pts on pts.OBJINR = brd.inr and pts.OBJTYP = 'BRD' and pts.rol = 'APL'
        left join lid on lid.INR = brd.PNTINR and brd.PNTTYP = 'LID'
        left join pty pty on pty.inr = pts.ptyinr
        where 1 = 1
        <!--信用证INR-->
        <if test="lidinr != null and lidinr != '' ">
            AND brd.PNTINR = #{lidinr}
            AND brd.PNTTYP = 'LID'
        </if>
        <!--机构隔离-->
        <if test="bchinr != null and bchinr != '' ">
            AND brd.BCHKEYINR = #{bchinr}
        </if>
        <!--信用证业务编号-->
        <if test="seaownref != null and seaownref != ''">
            AND UPPER(lid.OWNREF) LIKE concat(concat('%', UPPER(#{seaownref})), '%')
        </if>
        <!--信用证单据业务编号-->
        <if test="brownref != null and brownref != ''">
            AND UPPER(brd.OWNREF) LIKE concat(concat('%', UPPER(#{brownref})), '%')
        </if>
        <!--提货担保业务编号-->
        <if test="sgownref != null and sgownref != ''">
            AND UPPER(brd.OWNREF) LIKE concat(concat('%', UPPER(#{sgownref})), '%')
        </if>
        <!--是否是提货担保业务-->
        <if test="isSg != null and isSg != ''">
            and (brd.shgref is not null
                and shgref != ''
                and shgref != ' ')
        </if>
        <!--日期-->
        <if test="opndatfrom != null and opndatfrom != ''">
            AND brd.OPNDAT &gt;= #{opndatfrom}
        </if>
        <!--日期-->
        <if test="opndatto != null and opndatto != ''">
            AND brd.OPNDAT &lt;= #{opndatto}
        </if>
        <!--单据状态-->
        <if test="docsta != null and docsta != '' ">
            AND brd.docsta = #{docsta}
        </if>
        <!--客户号/名称 -->
        <if test="searef != null and searef != ''">
            and exists (
            select 1 from PTS,PTY
            where brd.INR = PTS.OBJINR
            AND PTY.INR = PTS.PTYINR
            AND PTS.OBJTYP = 'BRD'
            AND PTS.ROL = 'APL'
            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 brd.CLSDAT is not null
            </if>
            <if test="isClosed == 'N'.toString()">
                and brd.CLSDAT is null
            </if>
        </if>
        order by brd.opndat desc , brd.OWNREF desc
    </select>

    <select id="selectByPntInrRcvdat" resultType="int">
        select count(1) from brd
         where pntinr = #{pntInr,jdbcType=VARCHAR}
           and pnttyp = 'LID'
           and rcvdat is not null
    </select>

    <select id="selectByPntInrRcvdatClsdat" resultType="int">
        select count(1) from brd
         where pntInr = #{pntInr,jdbcType=VARCHAR}
           and pnttyp = 'LID'
           and rcvdat is null
           and clsdat is null
    </select>

    <select id="selectInrByPntinrPnttyp" resultType="string">
        select inr from brd
         where pnttyp = 'LID'
           and pntinr = #{pntInr,jdbcType=VARCHAR}
    </select>

    <select id="selectBrdInrByPntInrOutRcvDat" resultType="com.brilliance.isc.bo.Brd">
        select * from brd
         where pntinr = #{inr,jdbcType=VARCHAR}
           and trim(pnttyp) = 'LID'
           and rcvdat is null
    </select>

    <select id="selectByOwnref" resultType="string">
        select inr from brd
         where trim(ownref) = #{ownref,jdbcType=VARCHAR}
         order by inr desc
         limit 1
    </select>

    <select id="selectByLidgrpRecInr" resultType="int">
        select count(1) from brd
         where pntinr = #{inr,jdbcType=VARCHAR}
           and pnttyp = 'LID'
           and rcvdat is null
           and clsdat is null
    </select>

    <select id="selectInrsByPNTINR" resultType="String">
        SELECT INR FROM BRD WHERE PNTTYP='LID' and PNTINR = #{pntInr,jdbcType=VARCHAR}
    </select>

    <select id="selectLidInrByBidInr" resultType="string">
        select pntinr from brd
         where inr = #{inr,jdbcType=VARCHAR}
           and pnttyp = 'LID'
    </select>

    <select id="getActUtlBRCount" resultType="int">
        select count(1) from brd
         where pntinr = #{pntinr,jdbcType=VARCHAR}
           and pnttyp = 'LID'
           and rcvdat is not null
    </select>
    <select id="selectByPntInrClsdat" resultType="java.lang.Integer">
        select count(1) from brd
        where pntinr = #{pntInr,jdbcType=VARCHAR}
          and pnttyp = 'LID'
          and clsdat is null
    </select>

    <select id="selectByOwn" resultType="com.brilliance.isc.bo.Brd">
        select
        <include refid="Base_Column_List"/>
        from brd
        where
        (ownref LIKE concat(concat('%', #{ownref}), '%')
        or nam LIKE concat(concat('%', #{ownref}), '%'))
        and clsdat is null
        and ownref LIKE 'AB%'
        <if test="bchkeyinr != null and bchkeyinr != '' ">
            AND bchkeyinr = #{bchkeyinr}
        </if>
    </select>

    <select id="queryByInr" resultType="com.brilliance.isc.bo.Brd">
        select
        <include refid="Base_Column_List"/>
        from brd
        where inr = #{inr,jdbcType=VARCHAR}
    </select>
    <select id="queryBrdInfo" resultType="com.brilliance.isc.vo.lc.BrdWithPtsCbbResponseVo">
        select
        brd.*,bch.BCHNAME bchName,usr.NAM usrNam,lid.STAGOD,
        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,adv.EXTKEY advExtkey,adv.nam advName,
        prb.EXTKEY prbExtkey,prb.nam prbName
        from brd
        left join cbb max1 on max1.OBJINR = brd.inr and max1.OBJTYP = 'BRD' and max1.cbc = 'MAXSUM' and max1.extid =
        'AMT1' and max1.enddat = '2299-12-31'
        left join cbb max2 on max2.OBJINR = brd.inr and max2.OBJTYP = 'BRD' and max2.cbc = 'MAXSUM' and max2.extid =
        'AMT2' and max2.enddat = '2299-12-31'
        left join cbb opn1 on opn1.OBJINR = brd.inr and opn1.OBJTYP = 'BRD' and opn1.cbc = 'OPN' and opn1.extid = 'AMT1'
        and opn1.enddat = '2299-12-31'
        left join cbb opn2 on opn2.OBJINR = brd.inr and opn2.OBJTYP = 'BRD' and opn2.cbc = 'OPN' and opn2.extid = 'AMT2'
        and opn2.enddat = '2299-12-31'
        left join pts apl on apl.OBJINR = brd.inr and apl.OBJTYP = 'BRD' and apl.rol = 'APL'
        left join pts ben on ben.OBJINR = brd.inr and ben.OBJTYP = 'BRD' and ben.rol = 'BEN'
        left join pts adv on adv.OBJINR = brd.inr and adv.OBJTYP = 'BRD' and adv.rol = 'ADV'
        left join pts prb on prb.OBJINR = brd.inr and prb.OBJTYP = 'BRD' and prb.rol = 'PRB'
        left join bch bch on bch.inr = brd.BCHKEYINR
        left join usr usr on usr.EXTKEY = brd.OWNUSR
        left join lid lid on lid.inr = brd.pntinr
        where brd.flwsta = 'R'
        <!--机构隔离-->
        <if test="bchinr != null and bchinr != '' ">
            AND brd.bchkeyinr = #{bchinr}
        </if>
        <!--业务编号-->
        <if test="seaownref != null and seaownref != ''">
            AND UPPER(brd.OWNREF) LIKE concat(concat('%', UPPER(#{seaownref})), '%')
        </if>

        <!--日期-->
        <if test="opndatfrom != null and opndatfrom != ''">
            AND brd.CREDAT &gt;= #{opndatfrom}
        </if>
        <if test="opndatto != null and opndatto != ''">
            AND brd.CREDAT &lt;= #{opndatto}
        </if>
        <!--信用证类型-->
        <if test="seadoctyp != null and seadoctyp != '' ">
            AND brd.docflg = #{seadoctyp}
        </if>
        <!--客户号/名称 -->
        <if test="ptyExtkey != null and ptyExtkey != ''">
            and exists (
            select 1 from PTS
            where brd.INR = PTS.OBJINR
            AND PTS.OBJTYP = 'BRD'
            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 brd.INR = PTS.OBJINR
            AND PTS.OBJTYP = 'BRD'
            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 brd.INR = PTS.OBJINR
            AND PTS.OBJTYP = 'BRD'
            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 = 'BRD'
            AND INFCONCBS.OBJINR = BRD.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 brd.clsdat is not null
            </if>
            <if test="seasta == 'O'.toString()">
                and brd.clsdat is null
            </if>
        </if>
        <!--货物类型-->
        <if test="seagodcod != null and seagodcod != '' ">
            AND lid.stagod = #{seagodcod}
        </if>
        <if test='column != null and column!="" '>
            order by  ${column}  ${order}
        </if>
        <if test='column == null or column=="" '>
            order by brd.credat desc , brd.ownref desc
        </if>
    </select>

    <select id="queryRelGodData" resultType="com.brilliance.isc.bo.Brd">
        select * from brd
         where pntinr = #{inr,jdbcType=VARCHAR}
           and trim(pnttyp) = 'LID'
           and rcvdat is null
           AND CLSDAT IS NULL
           AND RELGODDAT IS NOT NULL
    </select>

    <select id="queryAdvDataForLitrog" resultType="com.brilliance.isc.bo.Brd">
        select * from brd
         where pntinr = #{inr,jdbcType=VARCHAR}
           and trim(pnttyp) = 'LID'
           and rcvdat is null
           AND CLSDAT IS NULL
           AND RELGODDAT IS NULL
    </select>

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

</mapper>