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


    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Smh">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="objtyp" column="objtyp" jdbcType="VARCHAR"/>
        <result property="objinr" column="objinr" jdbcType="VARCHAR"/>
        <result property="trntyp" column="trntyp" jdbcType="VARCHAR"/>
        <result property="trninr" column="trninr" jdbcType="VARCHAR"/>
        <result property="trnsub" column="trnsub" jdbcType="INTEGER"/>
        <result property="extkey" column="extkey" jdbcType="VARCHAR"/>
        <result property="nam" column="nam" jdbcType="VARCHAR"/>
        <result property="creusr" column="creusr" jdbcType="VARCHAR"/>
        <result property="crefrm" column="crefrm" jdbcType="VARCHAR"/>
        <result property="credattim" column="credattim" jdbcType="TIMESTAMP"/>
        <result property="dir" column="dir" jdbcType="VARCHAR"/>
        <result property="docpth" column="docpth" jdbcType="VARCHAR"/>
        <result property="docfil" column="docfil" jdbcType="VARCHAR"/>
        <result property="docfxt" column="docfxt" jdbcType="VARCHAR"/>
        <result property="docmac" column="docmac" jdbcType="VARCHAR"/>
        <result property="msgpos" column="msgpos" jdbcType="NUMERIC"/>
        <result property="msglen" column="msglen" jdbcType="NUMERIC"/>
        <result property="grpinr" column="grpinr" jdbcType="VARCHAR"/>
        <result property="grpseq" column="grpseq" jdbcType="INTEGER"/>
        <result property="cortyp" column="cortyp" jdbcType="VARCHAR"/>
        <result property="cortypsub" column="cortypsub" jdbcType="VARCHAR"/>
        <result property="apf" column="apf" jdbcType="VARCHAR"/>
        <result property="sndkey" column="sndkey" jdbcType="VARCHAR"/>
        <result property="apfcnt" column="apfcnt" jdbcType="VARCHAR"/>
        <result property="ptainr" column="ptainr" jdbcType="VARCHAR"/>
        <result property="oriflg" column="oriflg" jdbcType="VARCHAR"/>
        <result property="orismhinr" column="orismhinr" jdbcType="VARCHAR"/>
        <result property="partflg" column="partflg" jdbcType="VARCHAR"/>
        <result property="msgtyp" column="msgtyp" jdbcType="VARCHAR"/>
        <result property="relcur" column="relcur" jdbcType="VARCHAR"/>
        <result property="relamt" column="relamt" jdbcType="DECIMAL"/>
        <result property="stp" column="stp" jdbcType="VARCHAR"/>
        <result property="etyextkey" column="etyextkey" jdbcType="VARCHAR"/>
        <result property="sysno" column="sysno" jdbcType="VARCHAR"/>
        <result property="staflg" column="staflg" jdbcType="VARCHAR"/>
        <result property="clndat" column="clndat" jdbcType="TIMESTAMP"/>
        <result property="f20" column="f20" jdbcType="VARCHAR"/>
        <result property="chlflg" column="chlflg" jdbcType="VARCHAR"/>
        <result property="orimsgtyp" column="orimsgtyp" jdbcType="VARCHAR"/>
        <result property="mpiinr" column="mpiinr" jdbcType="VARCHAR"/>
    </resultMap>


<!--    <resultMap id="SmhResultMap" type="com.brilliance.isc.vo.lg.SmhInfoVo">-->
<!--        <result property="inr" column="inr" jdbcType="VARCHAR"/>-->
<!--        <result property="nam" column="nam" jdbcType="VARCHAR"/>-->
<!--        <result property="credattim" column="credattim" jdbcType="TIMESTAMP"/>-->
<!--        <result property="dir" column="dir" jdbcType="VARCHAR"/>-->
<!--        <result property="docfil" column="docfil" jdbcType="VARCHAR"/>-->
<!--        <result property="cortyp" column="cortyp" jdbcType="VARCHAR"/>-->
<!--        <result property="bchkeyinr" column="bchkeyinr" jdbcType="VARCHAR"/>-->
<!--        <result property="bchname" column="bchname" jdbcType="VARCHAR"/>-->
<!--    </resultMap>-->

    <sql id="Base_Column_List">
        inr,objtyp,objinr,trntyp,trninr,trnsub,extkey,nam,creusr,crefrm,credattim,dir,docpth,docfil,docfxt,docmac,msgpos,msglen,grpinr,grpseq,cortyp,cortypsub,apf,sndkey,apfcnt,ptainr,oriflg,orismhinr,partflg,msgtyp,relcur,relamt,stp,etyextkey,sysno,staflg,clndat,f20,chlflg,orimsgtyp,mpiinr
    </sql>

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

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

    <insert id="insert">
        insert into smh (<include refid="Base_Column_List"/>)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{objtyp,jdbcType=VARCHAR},
            #{objinr,jdbcType=VARCHAR},
            #{trntyp,jdbcType=VARCHAR},
            #{trninr,jdbcType=VARCHAR},
            #{trnsub,jdbcType=INTEGER},
            #{extkey,jdbcType=VARCHAR},
            #{nam,jdbcType=VARCHAR},
            #{creusr,jdbcType=VARCHAR},
            #{crefrm,jdbcType=VARCHAR},
            #{credattim,jdbcType=TIMESTAMP},
            #{dir,jdbcType=VARCHAR},
            #{docpth,jdbcType=VARCHAR},
            #{docfil,jdbcType=VARCHAR},
            #{docfxt,jdbcType=VARCHAR},
            #{docmac,jdbcType=VARCHAR},
            #{msgpos,jdbcType=NUMERIC},
            #{msglen,jdbcType=NUMERIC},
            #{grpinr,jdbcType=VARCHAR},
            #{grpseq,jdbcType=INTEGER},
            #{cortyp,jdbcType=VARCHAR},
            #{cortypsub,jdbcType=VARCHAR},
            #{apf,jdbcType=VARCHAR},
            #{sndkey,jdbcType=VARCHAR},
            #{apfcnt,jdbcType=VARCHAR},
            #{ptainr,jdbcType=VARCHAR},
            #{oriflg,jdbcType=VARCHAR},
            #{orismhinr,jdbcType=VARCHAR},
            #{partflg,jdbcType=VARCHAR},
            #{msgtyp,jdbcType=VARCHAR},
            #{relcur,jdbcType=VARCHAR},
            #{relamt,jdbcType=DECIMAL},
            #{stp,jdbcType=VARCHAR},
            #{etyextkey,jdbcType=VARCHAR},
            #{sysno,jdbcType=VARCHAR},
            #{staflg,jdbcType=VARCHAR},
            #{clndat,jdbcType=TIMESTAMP},
            #{f20,jdbcType=VARCHAR},
            #{chlflg,jdbcType=VARCHAR},
            #{orimsgtyp,jdbcType=VARCHAR},
            #{mpiinr,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into smh
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="objtyp != null">objtyp,</if>
            <if test="objinr != null">objinr,</if>
            <if test="trntyp != null">trntyp,</if>
            <if test="trninr != null">trninr,</if>
            <if test="trnsub != null">trnsub,</if>
            <if test="extkey != null">extkey,</if>
            <if test="nam != null">nam,</if>
            <if test="creusr != null">creusr,</if>
            <if test="crefrm != null">crefrm,</if>
            <if test="credattim != null">credattim,</if>
            <if test="dir != null">dir,</if>
            <if test="docpth != null">docpth,</if>
            <if test="docfil != null">docfil,</if>
            <if test="docfxt != null">docfxt,</if>
            <if test="docmac != null">docmac,</if>
            <if test="msgpos != null">msgpos,</if>
            <if test="msglen != null">msglen,</if>
            <if test="grpinr != null">grpinr,</if>
            <if test="grpseq != null">grpseq,</if>
            <if test="cortyp != null">cortyp,</if>
            <if test="cortypsub != null">cortypsub,</if>
            <if test="apf != null">apf,</if>
            <if test="sndkey != null">sndkey,</if>
            <if test="apfcnt != null">apfcnt,</if>
            <if test="ptainr != null">ptainr,</if>
            <if test="oriflg != null">oriflg,</if>
            <if test="orismhinr != null">orismhinr,</if>
            <if test="partflg != null">partflg,</if>
            <if test="msgtyp != null">msgtyp,</if>
            <if test="relcur != null">relcur,</if>
            <if test="relamt != null">relamt,</if>
            <if test="stp != null">stp,</if>
            <if test="etyextkey != null">etyextkey,</if>
            <if test="sysno != null">sysno,</if>
            <if test="staflg != null">staflg,</if>
            <if test="clndat != null">clndat,</if>
            <if test="f20 != null">f20,</if>
            <if test="chlflg != null">chlflg,</if>
            <if test="orimsgtyp != null">orimsgtyp,</if>
            <if test="mpiinr != null">mpiinr,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR},</if>
            <if test="objtyp != null">#{objtyp,jdbcType=VARCHAR},</if>
            <if test="objinr != null">#{objinr,jdbcType=VARCHAR},</if>
            <if test="trntyp != null">#{trntyp,jdbcType=VARCHAR},</if>
            <if test="trninr != null">#{trninr,jdbcType=VARCHAR},</if>
            <if test="trnsub != null">#{trnsub,jdbcType=INTEGER},</if>
            <if test="extkey != null">#{extkey,jdbcType=VARCHAR},</if>
            <if test="nam != null">#{nam,jdbcType=VARCHAR},</if>
            <if test="creusr != null">#{creusr,jdbcType=VARCHAR},</if>
            <if test="crefrm != null">#{crefrm,jdbcType=VARCHAR},</if>
            <if test="credattim != null">#{credattim,jdbcType=TIMESTAMP},</if>
            <if test="dir != null">#{dir,jdbcType=VARCHAR},</if>
            <if test="docpth != null">#{docpth,jdbcType=VARCHAR},</if>
            <if test="docfil != null">#{docfil,jdbcType=VARCHAR},</if>
            <if test="docfxt != null">#{docfxt,jdbcType=VARCHAR},</if>
            <if test="docmac != null">#{docmac,jdbcType=VARCHAR},</if>
            <if test="msgpos != null">#{msgpos,jdbcType=NUMERIC},</if>
            <if test="msglen != null">#{msglen,jdbcType=NUMERIC},</if>
            <if test="grpinr != null">#{grpinr,jdbcType=VARCHAR},</if>
            <if test="grpseq != null">#{grpseq,jdbcType=INTEGER},</if>
            <if test="cortyp != null">#{cortyp,jdbcType=VARCHAR},</if>
            <if test="cortypsub != null">#{cortypsub,jdbcType=VARCHAR},</if>
            <if test="apf != null">#{apf,jdbcType=VARCHAR},</if>
            <if test="sndkey != null">#{sndkey,jdbcType=VARCHAR},</if>
            <if test="apfcnt != null">#{apfcnt,jdbcType=VARCHAR},</if>
            <if test="ptainr != null">#{ptainr,jdbcType=VARCHAR},</if>
            <if test="oriflg != null">#{oriflg,jdbcType=VARCHAR},</if>
            <if test="orismhinr != null">#{orismhinr,jdbcType=VARCHAR},</if>
            <if test="partflg != null">#{partflg,jdbcType=VARCHAR},</if>
            <if test="msgtyp != null">#{msgtyp,jdbcType=VARCHAR},</if>
            <if test="relcur != null">#{relcur,jdbcType=VARCHAR},</if>
            <if test="relamt != null">#{relamt,jdbcType=DECIMAL},</if>
            <if test="stp != null">#{stp,jdbcType=VARCHAR},</if>
            <if test="etyextkey != null">#{etyextkey,jdbcType=VARCHAR},</if>
            <if test="sysno != null">#{sysno,jdbcType=VARCHAR},</if>
            <if test="staflg != null">#{staflg,jdbcType=VARCHAR},</if>
            <if test="clndat != null">#{clndat,jdbcType=TIMESTAMP},</if>
            <if test="f20 != null">#{f20,jdbcType=VARCHAR},</if>
            <if test="chlflg != null">#{chlflg,jdbcType=VARCHAR},</if>
            <if test="orimsgtyp != null">#{orimsgtyp,jdbcType=VARCHAR},</if>
            <if test="mpiinr != null">#{mpiinr,jdbcType=VARCHAR},</if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update smh
        <set>
            <if test="objtyp != null">objtyp = #{objtyp,jdbcType=VARCHAR},</if>
            <if test="objinr != null">objinr = #{objinr,jdbcType=VARCHAR},</if>
            <if test="trntyp != null">trntyp = #{trntyp,jdbcType=VARCHAR},</if>
            <if test="trninr != null">trninr = #{trninr,jdbcType=VARCHAR},</if>
            <if test="trnsub != null">trnsub = #{trnsub,jdbcType=INTEGER},</if>
            <if test="extkey != null">extkey = #{extkey,jdbcType=VARCHAR},</if>
            <if test="nam != null">nam = #{nam,jdbcType=VARCHAR},</if>
            <if test="creusr != null">creusr = #{creusr,jdbcType=VARCHAR},</if>
            <if test="crefrm != null">crefrm = #{crefrm,jdbcType=VARCHAR},</if>
            <if test="credattim != null">credattim = #{credattim,jdbcType=TIMESTAMP},</if>
            <if test="dir != null">dir = #{dir,jdbcType=VARCHAR},</if>
            <if test="docpth != null">docpth = #{docpth,jdbcType=VARCHAR},</if>
            <if test="docfil != null">docfil = #{docfil,jdbcType=VARCHAR},</if>
            <if test="docfxt != null">docfxt = #{docfxt,jdbcType=VARCHAR},</if>
            <if test="docmac != null">docmac = #{docmac,jdbcType=VARCHAR},</if>
            <if test="msgpos != null">msgpos = #{msgpos,jdbcType=NUMERIC},</if>
            <if test="msglen != null">msglen = #{msglen,jdbcType=NUMERIC},</if>
            <if test="grpinr != null">grpinr = #{grpinr,jdbcType=VARCHAR},</if>
            <if test="grpseq != null">grpseq = #{grpseq,jdbcType=INTEGER},</if>
            <if test="cortyp != null">cortyp = #{cortyp,jdbcType=VARCHAR},</if>
            <if test="cortypsub != null">cortypsub = #{cortypsub,jdbcType=VARCHAR},</if>
            <if test="apf != null">apf = #{apf,jdbcType=VARCHAR},</if>
            <if test="sndkey != null">sndkey = #{sndkey,jdbcType=VARCHAR},</if>
            <if test="apfcnt != null">apfcnt = #{apfcnt,jdbcType=VARCHAR},</if>
            <if test="ptainr != null">ptainr = #{ptainr,jdbcType=VARCHAR},</if>
            <if test="oriflg != null">oriflg = #{oriflg,jdbcType=VARCHAR},</if>
            <if test="orismhinr != null">orismhinr = #{orismhinr,jdbcType=VARCHAR},</if>
            <if test="partflg != null">partflg = #{partflg,jdbcType=VARCHAR},</if>
            <if test="msgtyp != null">msgtyp = #{msgtyp,jdbcType=VARCHAR},</if>
            <if test="relcur != null">relcur = #{relcur,jdbcType=VARCHAR},</if>
            <if test="relamt != null">relamt = #{relamt,jdbcType=DECIMAL},</if>
            <if test="stp != null">stp = #{stp,jdbcType=VARCHAR},</if>
            <if test="etyextkey != null">etyextkey = #{etyextkey,jdbcType=VARCHAR},</if>
            <if test="sysno != null">sysno = #{sysno,jdbcType=VARCHAR},</if>
            <if test="staflg != null">staflg = #{staflg,jdbcType=VARCHAR},</if>
            <if test="clndat != null">clndat = #{clndat,jdbcType=TIMESTAMP},</if>
            <if test="f20 != null">f20 = #{f20,jdbcType=VARCHAR},</if>
            <if test="chlflg != null">chlflg = #{chlflg,jdbcType=VARCHAR},</if>
            <if test="orimsgtyp != null">orimsgtyp = #{orimsgtyp,jdbcType=VARCHAR},</if>
            <if test="mpiinr != null">mpiinr = #{mpiinr,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update smh
        <set>
            objtyp = #{objtyp,jdbcType=VARCHAR},
            objinr = #{objinr,jdbcType=VARCHAR},
            trntyp = #{trntyp,jdbcType=VARCHAR},
            trninr = #{trninr,jdbcType=VARCHAR},
            trnsub = #{trnsub,jdbcType=INTEGER},
            extkey = #{extkey,jdbcType=VARCHAR},
            nam = #{nam,jdbcType=VARCHAR},
            creusr = #{creusr,jdbcType=VARCHAR},
            crefrm = #{crefrm,jdbcType=VARCHAR},
            credattim = #{credattim,jdbcType=TIMESTAMP},
            dir = #{dir,jdbcType=VARCHAR},
            docpth = #{docpth,jdbcType=VARCHAR},
            docfil = #{docfil,jdbcType=VARCHAR},
            docfxt = #{docfxt,jdbcType=VARCHAR},
            docmac = #{docmac,jdbcType=VARCHAR},
            msgpos = #{msgpos,jdbcType=NUMERIC},
            msglen = #{msglen,jdbcType=NUMERIC},
            grpinr = #{grpinr,jdbcType=VARCHAR},
            grpseq = #{grpseq,jdbcType=INTEGER},
            cortyp = #{cortyp,jdbcType=VARCHAR},
            cortypsub = #{cortypsub,jdbcType=VARCHAR},
            apf = #{apf,jdbcType=VARCHAR},
            sndkey = #{sndkey,jdbcType=VARCHAR},
            apfcnt = #{apfcnt,jdbcType=VARCHAR},
            ptainr = #{ptainr,jdbcType=VARCHAR},
            oriflg = #{oriflg,jdbcType=VARCHAR},
            orismhinr = #{orismhinr,jdbcType=VARCHAR},
            partflg = #{partflg,jdbcType=VARCHAR},
            msgtyp = #{msgtyp,jdbcType=VARCHAR},
            relcur = #{relcur,jdbcType=VARCHAR},
            relamt = #{relamt,jdbcType=DECIMAL},
            stp = #{stp,jdbcType=VARCHAR},
            etyextkey = #{etyextkey,jdbcType=VARCHAR},
            sysno = #{sysno,jdbcType=VARCHAR},
            staflg = #{staflg,jdbcType=VARCHAR},
            clndat = #{clndat,jdbcType=TIMESTAMP},
            f20 = #{f20,jdbcType=VARCHAR},
            chlflg = #{chlflg,jdbcType=VARCHAR},
            orimsgtyp = #{orimsgtyp,jdbcType=VARCHAR},
            mpiinr = #{mpiinr,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 smh
        <set>
            <if test="module.objtyp != null">objtyp = #{module.objtyp,jdbcType=VARCHAR},</if>
            <if test="module.objinr != null">objinr = #{module.objinr,jdbcType=VARCHAR},</if>
            <if test="module.trntyp != null">trntyp = #{module.trntyp,jdbcType=VARCHAR},</if>
            <if test="module.trninr != null">trninr = #{module.trninr,jdbcType=VARCHAR},</if>
            <if test="module.trnsub != null">trnsub = #{module.trnsub,jdbcType=INTEGER},</if>
            <if test="module.extkey != null">extkey = #{module.extkey,jdbcType=VARCHAR},</if>
            <if test="module.nam != null">nam = #{module.nam,jdbcType=VARCHAR},</if>
            <if test="module.creusr != null">creusr = #{module.creusr,jdbcType=VARCHAR},</if>
            <if test="module.crefrm != null">crefrm = #{module.crefrm,jdbcType=VARCHAR},</if>
            <if test="module.credattim != null">credattim = #{module.credattim,jdbcType=TIMESTAMP},</if>
            <if test="module.dir != null">dir = #{module.dir,jdbcType=VARCHAR},</if>
            <if test="module.docpth != null">docpth = #{module.docpth,jdbcType=VARCHAR},</if>
            <if test="module.docfil != null">docfil = #{module.docfil,jdbcType=VARCHAR},</if>
            <if test="module.docfxt != null">docfxt = #{module.docfxt,jdbcType=VARCHAR},</if>
            <if test="module.docmac != null">docmac = #{module.docmac,jdbcType=VARCHAR},</if>
            <if test="module.msgpos != null">msgpos = #{module.msgpos,jdbcType=NUMERIC},</if>
            <if test="module.msglen != null">msglen = #{module.msglen,jdbcType=NUMERIC},</if>
            <if test="module.grpinr != null">grpinr = #{module.grpinr,jdbcType=VARCHAR},</if>
            <if test="module.grpseq != null">grpseq = #{module.grpseq,jdbcType=INTEGER},</if>
            <if test="module.cortyp != null">cortyp = #{module.cortyp,jdbcType=VARCHAR},</if>
            <if test="module.cortypsub != null">cortypsub = #{module.cortypsub,jdbcType=VARCHAR},</if>
            <if test="module.apf != null">apf = #{module.apf,jdbcType=VARCHAR},</if>
            <if test="module.sndkey != null">sndkey = #{module.sndkey,jdbcType=VARCHAR},</if>
            <if test="module.apfcnt != null">apfcnt = #{module.apfcnt,jdbcType=VARCHAR},</if>
            <if test="module.ptainr != null">ptainr = #{module.ptainr,jdbcType=VARCHAR},</if>
            <if test="module.oriflg != null">oriflg = #{module.oriflg,jdbcType=VARCHAR},</if>
            <if test="module.orismhinr != null">orismhinr = #{module.orismhinr,jdbcType=VARCHAR},</if>
            <if test="module.partflg != null">partflg = #{module.partflg,jdbcType=VARCHAR},</if>
            <if test="module.msgtyp != null">msgtyp = #{module.msgtyp,jdbcType=VARCHAR},</if>
            <if test="module.relcur != null">relcur = #{module.relcur,jdbcType=VARCHAR},</if>
            <if test="module.relamt != null">relamt = #{module.relamt,jdbcType=DECIMAL},</if>
            <if test="module.stp != null">stp = #{module.stp,jdbcType=VARCHAR},</if>
            <if test="module.etyextkey != null">etyextkey = #{module.etyextkey,jdbcType=VARCHAR},</if>
            <if test="module.sysno != null">sysno = #{module.sysno,jdbcType=VARCHAR},</if>
            <if test="module.staflg != null">staflg = #{module.staflg,jdbcType=VARCHAR},</if>
            <if test="module.clndat != null">clndat = #{module.clndat,jdbcType=TIMESTAMP},</if>
            <if test="module.f20 != null">f20 = #{module.f20,jdbcType=VARCHAR},</if>
            <if test="module.chlflg != null">chlflg = #{module.chlflg,jdbcType=VARCHAR},</if>
            <if test="module.orimsgtyp != null">orimsgtyp = #{module.orimsgtyp,jdbcType=VARCHAR},</if>
            <if test="module.mpiinr != null">orimsgtyp = #{module.mpiinr,jdbcType=VARCHAR},</if>
        </set>
        ${conditions}
    </update>

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

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

    <select id="getSmhByTrntypAndTrninrAndDir" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where trntyp = #{trntyp,jdbcType=VARCHAR}
        and trninr = #{trninr,jdbcType=VARCHAR}
        and dir = #{dir,jdbcType=VARCHAR}
    </select>

    <select id="getSmhByCortypAndTrninrAndDirList" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where trninr = #{trninr,jdbcType=VARCHAR}
        and cortyp = #{cortyp,jdbcType=VARCHAR}
        and dir = #{dir,jdbcType=VARCHAR}
    </select>

    <select id="getSmhByTrntypAndTrninrAndDirList" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where trntyp = #{trntyp,jdbcType=VARCHAR}
        and trninr = #{trninr,jdbcType=VARCHAR}
        and dir = #{dir,jdbcType=VARCHAR}
    </select>

    <select id="selectByWhere" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where 1=1
        <if test="objtyp != null">and objtyp = #{objtyp,jdbcType=VARCHAR}</if>
        <if test="objinr != null">and objinr = #{objinr,jdbcType=VARCHAR}</if>
        <if test="trntyp != null">and trntyp = #{trntyp,jdbcType=VARCHAR}</if>
        <if test="trninr != null">and trninr = #{trninr,jdbcType=VARCHAR}</if>
        <if test="trnsub != null">and trnsub = #{trnsub,jdbcType=INTEGER}</if>
        <if test="extkey != null">and extkey = #{extkey,jdbcType=VARCHAR}</if>
        <if test="nam != null">and nam = #{nam,jdbcType=VARCHAR}</if>
        <if test="creusr != null">and creusr = #{creusr,jdbcType=VARCHAR}</if>
        <if test="crefrm != null">and crefrm = #{crefrm,jdbcType=VARCHAR}</if>
        <if test="credattim != null">and credattim = #{credattim,jdbcType=TIMESTAMP}</if>
        <if test="dir != null">and dir = #{dir,jdbcType=VARCHAR}</if>
        <if test="docpth != null">and docpth = #{docpth,jdbcType=VARCHAR}</if>
        <if test="docfil != null">and docfil = #{docfil,jdbcType=VARCHAR}</if>
        <if test="docfxt != null">and docfxt = #{docfxt,jdbcType=VARCHAR}</if>
        <if test="docmac != null">and docmac = #{docmac,jdbcType=VARCHAR}</if>
        <if test="msgpos != null">and msgpos = #{msgpos,jdbcType=NUMERIC}</if>
        <if test="msglen != null">and msglen = #{msglen,jdbcType=NUMERIC}</if>
        <if test="grpinr != null">and grpinr = #{grpinr,jdbcType=VARCHAR}</if>
        <if test="grpseq != null">and grpseq = #{grpseq,jdbcType=INTEGER}</if>
        <if test="cortyp != null">and cortyp = #{cortyp,jdbcType=VARCHAR}</if>
        <if test="cortypsub != null">and cortypsub = #{cortypsub,jdbcType=VARCHAR}</if>
        <if test="apf != null">and apf = #{apf,jdbcType=VARCHAR}</if>
        <if test="sndkey != null">and sndkey = #{sndkey,jdbcType=VARCHAR}</if>
        <if test="apfcnt != null">and apfcnt = #{apfcnt,jdbcType=VARCHAR}</if>
        <if test="ptainr != null">and ptainr = #{ptainr,jdbcType=VARCHAR}</if>
        <if test="oriflg != null">and oriflg = #{oriflg,jdbcType=VARCHAR}</if>
        <if test="orismhinr != null">and orismhinr = #{orismhinr,jdbcType=VARCHAR}</if>
        <if test="partflg != null">and partflg = #{partflg,jdbcType=VARCHAR}</if>
        <if test="msgtyp != null">and msgtyp = #{msgtyp,jdbcType=VARCHAR}</if>
        <if test="relcur != null">and relcur = #{relcur,jdbcType=VARCHAR}</if>
        <if test="relamt != null">and relamt = #{relamt,jdbcType=DECIMAL}</if>
        <if test="stp != null">and stp = #{stp,jdbcType=VARCHAR}</if>
        <if test="etyextkey != null">and etyextkey = #{etyextkey,jdbcType=VARCHAR}</if>
        <if test="sysno != null">and sysno = #{sysno,jdbcType=VARCHAR}</if>
        <if test="staflg != null">and staflg = #{staflg,jdbcType=VARCHAR}</if>
        <if test="clndat != null">and clndat = #{clndat,jdbcType=TIMESTAMP}</if>
        <if test="f20 != null">and f20 = #{f20,jdbcType=VARCHAR}</if>
        <if test="chlflg != null">and chlflg = #{chlflg,jdbcType=VARCHAR}</if>
        <if test="orimsgtyp != null">and orimsgtyp = #{orimsgtyp,jdbcType=VARCHAR}</if>
        <if test="mpiinr != null">and mpiinr = #{mpiinr,jdbcType=VARCHAR}</if>
    </select>

    <select id="selectRelationSmh" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where GRPINR = #{inr}
        and DIR = #{dir}
        and MSGTYP = #{msgtyp}
    </select>

    <select id="selectByGrpinrAndDirAndCortypAndMsgtyp" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where GRPINR = #{grpinr}
        and DIR = #{dir}
        and MSGTYP = #{msgtyp}
        and CORTYP = #{cortyp}
    </select>

    <select id="selectEroSmh" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where TRNTYP = #{vo.trntyp, jdbcType=VARCHAR}
        and TRNINR = #{vo.trninr, jdbcType=VARCHAR}
        and DIR = '>'
        and CORTYP = 'ERX'
        and length(trim(MSGTYP)) <![CDATA[<=]]> '3'
    </select>

    <select id="selectNoSplit" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        WHERE TRNINR= #{vo.trninr,jdbcType=VARCHAR}
        AND CORTYP != 'ERX'
        AND GRPSEQ = 0
        AND DIR = '>'
        and inr != #{vo.inr,jdbcType=VARCHAR}
    </select>

    <select id="selectCount" resultType="int">
        select count(1)
        from smh
        WHERE TRNINR = #{vo.trninr,jdbcType=VARCHAR}
          AND GRPINR = #{vo.grpinr,jdbcType=VARCHAR}
    </select>

    <select id="selectSwiftSmh" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from SMH
        where TRNTYP = #{vo.trntyp,jdbcType=VARCHAR}
        and TRNINR = #{vo.trninr,jdbcType=VARCHAR}
        and DIR = '>'
        and CORTYP = 'SWT'
        and MSGTYP not in ('103', '202')
        order by GRPSEQ
    </select>

    <delete id="deleteExist">
        delete
        from smh
        where TRNTYP = #{vo.trntyp, jdbcType=VARCHAR}
          and TRNINR = #{vo.trninr, jdbcType=VARCHAR}
          and GRPINR = #{vo.grpinr, jdbcType=VARCHAR}
          and GRPSEQ = #{vo.grpseq, jdbcType=VARCHAR}
    </delete>

    <update id="updateInr">
        update smh
        set GRPINR = INR,
            GRPSEQ = 0
        where INR = #{oldInr, jdbcType=VARCHAR}
    </update>

    <update id="updateChlFlg">
        UPDATE SMH
        SET CHLFLG = #{chlFlg,jdbcType=VARCHAR}
        WHERE INR = #{inr,jdbcType=VARCHAR}
    </update>

    <select id="getSmhByCortypAndMsgtypAndDir" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where cortyp = #{cortyp}
        and msgtyp in('103','202')
        and dir = #{dir}
        and trntyp = #{trntyp}
        and trninr = #{trninr}
    </select>

    <select id="getSmhInfoBySptSmhinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh where smh.inr=#{smhinr}
    </select>

    <select id="selectByExtkeyAndDir" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where extkey = #{extkey}
        and DIR = #{dir}
        and (grpinr is null or grpinr = '')

    </select>

    <select id="selectByTrninr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        trninr = #{trninr,jdbcType=VARCHAR}
    </select>

    <select id="querySmh" resultType="com.brilliance.isc.vo.lg.SmhInfoVo">
        select
         smh.docfil, smh.inr, smh.cortyp, smh.nam, DATE_FORMAT(smh.credattim, '%Y-%m-%d %H:%i:%s') credattim,
         smh.dir,trn.bchkeyinr,bch.bchname
         from SMH SMH
         left join trn trn on trn.inr = smh.trninr
         left join bch bch on bch.inr = trn.bchkeyinr
         where SMH.OBJTYP = #{objtyp}
         and SMH.OBJINR = #{objinr}
         AND SMH.CORTYP != 'RIM'
         <if test="cortyp != null and cortyp != ''">
         and SMH.CORTYP = #{cortyp}
         </if>
         <if test="datfrom != null and datfrom != ''">
          and SMH.CREDATTIM &gt;= #{datfrom}
         </if>
         <if test="datto != null and datto != ''">
          and SMH.CREDATTIM &lt;= #{datto}
         </if>
         <if test="dir != null and dir != ''">
          and SMH.DIR = #{dir}
         </if>
         <if test="chktrn != null and chktrn != '' and chktrn == 'X'.toString()">
          and SMH.TRNTYP = 'TRN'
          and SMH.TRNINR = TRN.INR
          and TRN.RELFLG NOT IN ('N','P','C','D')
         </if>
         order by SMH.CREDATTIM
    </select>

    <select id="selectByDocfil" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where cortyp = 'SWT'
        and dir = #{dir,jdbcType=VARCHAR}
        and docfil = #{docfil,jdbcType=VARCHAR}
    </select>

    <select id="selectByCortypAndDocfil" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where cortyp = #{cortyp,jdbcType=VARCHAR}
        and dir = #{dir,jdbcType=VARCHAR}
        and docfil = #{docfil,jdbcType=VARCHAR}
    </select>
    <select id="selectByGrpinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        inr = #{grpinr,jdbcType=VARCHAR}
        or grpinr=#{grpinr,jdbcType=VARCHAR}
        order by GRPSEQ
    </select>
    <select id="selectOthByGrpinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
         grpinr=#{grpinr,jdbcType=VARCHAR}
         and inr !=#{grpinr,jdbcType=VARCHAR}
    </select>
    <select id="selectByObjtypAndObjinrAndDir" resultMap="BaseResultMap">
        select
        smh.*
        from smh,trn
        where
        smh.objtyp = #{objtyp,jdbcType=VARCHAR}
        AND smh.objinr = #{objinr,jdbcType=VARCHAR}
        AND smh.dir = #{dir,jdbcType=VARCHAR}
        AND smh.trninr=trn.inr
        AND smh.cortyp != 'RIM'
        AND (trn.relflg='R' or trn.relflg='W')
    </select>
    <select id="selectByCortypAndTrninrAndNam" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        cortyp = #{cortyp,jdbcType=VARCHAR}
        AND trninr = #{trninr,jdbcType=VARCHAR}
        AND nam like concat(concat ('%',#{nam}),'%')
    </select>
    <select id="selectByCortyp2AndTrninrAndNam" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        (cortyp = #{cortyp,jdbcType=VARCHAR}
          or cortyp = #{cortyp2,jdbcType=VARCHAR})
        AND trninr = #{trninr,jdbcType=VARCHAR}
        AND nam like concat(concat ('%',#{nam}),'%')
    </select>
    <select id="selectByCortypAndTrninr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        cortyp = #{cortyp,jdbcType=VARCHAR}
        AND trninr = #{trninr,jdbcType=VARCHAR}
    </select>
    <select id="selectByCortypAndTrninrAndMsgtyp" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        cortyp = #{cortyp,jdbcType=VARCHAR}
        AND trninr = #{trninr,jdbcType=VARCHAR}
        AND msgtyp = #{msgtyp,jdbcType=VARCHAR}
    </select>
    <select id="selectByCortypAndTrninrAndMsgtypAndDir" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        cortyp = #{cortyp,jdbcType=VARCHAR}
        AND trninr = #{trninr,jdbcType=VARCHAR}
        AND msgtyp = #{msgtyp,jdbcType=VARCHAR}
        AND dir = #{dir,jdbcType=VARCHAR}
    </select>
    <select id="selectQinOutByTrninr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        TRNTYP = 'TRN' and trninr = #{trninr,jdbcType=VARCHAR}
        and DIR = '>' and CORTYP = 'SWT'
        and GRPSEQ = 0 and (MSGTYP='103' or MSGTYP='202')
    </select>
    <select id="selectByTrninrAndMsgtyp" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        trninr = #{trninr,jdbcType=VARCHAR}
        AND msgtyp = #{msgtyp,jdbcType=VARCHAR}
    </select>

    <select id="getSmhByTrninr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh where dir='>' and trninr= #{trninr} and nam='BEN GNZ信用证(副本)'
    </select>

    <select id="dbCount" resultType="String">
        select count(1) from smh
    </select>

    <select id="getSmhInrByMsgInfo" resultType="String">
        select smh.inr from smh join msg on smh.inr = msg.smhinr
        where smh.dir = #{dir,jdbcType=VARCHAR} and msg.msgid = #{msgid,jdbcType=VARCHAR} and smh.msgtyp = #{msgtyp,jdbcType=VARCHAR}
        and smh.cortyp = #{dir,jdbcType=VARCHAR}
        <if test="sender != null and sender != ''">
            and smh.sender = #{sender}
        </if>
    </select>

    <select id="getValdat" resultType="String">
        select smh.credattim from smh join msg on smh.inr = msg.smhinr where smh.msgtyp = #{msgtyp,jdbcType=VARCHAR} and smh.etyextkey = #{etyextkey,jdbcType=VARCHAR} and msg.msgid = #{msgid,jdbcType=VARCHAR}
    </select>

    <select id="selectYptSmhByTrntypAndTrninr" resultMap="BaseResultMap">
        select docpth,docfil,msgtyp FROM smh WHERE CORTYP='ERX'
        and trninr=#{trninr,jdbcType=VARCHAR}
        and trntyp=#{trntyp,jdbcType=VARCHAR}
        and SUBSTR(msgtyp,1,1) = 'T' and length(trim(msgtyp)) > 3
    </select>

    <select id="getF20ByMsgid" resultType="java.lang.String">
        select smh.f20 from smh join msg on smh.inr = msg.smhinr where msg.msgid = #{msgid,jdbcType=VARCHAR}
    </select>

    <select id="getObjinrByMsgidAndDir" resultType="java.lang.String">
        select smh.objinr from smh join msg on smh.inr = msg.smhinr where msg.msgid = #{msgid,jdbcType=VARCHAR} and smh.dir = #{dir,jdbcType=VARCHAR} and smh.cortyp = 'LCF'
    </select>

    <select id="getSmhByOrimsgidDirEtyextkey" resultMap="BaseResultMap">
        select
        smh.inr,smh.objtyp,smh.objinr,smh.trntyp,smh.trninr,smh.trnsub,smh.extkey,smh.nam,smh.creusr,smh.crefrm,smh.credattim,smh.dir,smh.docpth,smh.docfil,smh.docfxt,smh.docmac,smh.msgpos,smh.msglen,smh.grpinr,smh.grpseq,smh.cortyp,smh.cortypsub,smh.apf,smh.sndkey,smh.apfcnt,smh.ptainr,smh.oriflg,smh.orismhinr,smh.partflg,smh.msgtyp,smh.relcur,smh.relamt,smh.stp,smh.etyextkey,smh.sysno,smh.staflg,smh.clndat,smh.f20,smh.chlflg,smh.orimsgtyp
        from smh join msg on smh.inr = msg.smhinr
        where msg.msgid = #{msgid,jdbcType=VARCHAR} and smh.dir = #{dir,jdbcType=VARCHAR} and smh.etyextkey = #{etyextkey,jdbcType=VARCHAR}
    </select>
    
    <update id="updateStaflgByinr">
        update smh set
        staflg = #{staflg,jdbcType=VARCHAR}
        where (staflg is null or staflg in ('SEND','FSCG')) and inr = #{inr,jdbcType=VARCHAR}
    </update>
    <select id="selectByObjtypAndTrninrAndDirAndCortyp" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        objtyp = #{objtyp,jdbcType=VARCHAR}
        AND trninr = #{trninr,jdbcType=VARCHAR}
        AND dir = #{dir,jdbcType=VARCHAR}
        AND cortyp = #{cortyp,jdbcType=VARCHAR}
    </select>
    <select id="selectByCortypAndTrninrForCpd" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
         from SMH
        where
        dir=#{dir,jdbcType=VARCHAR}
        and cortyp='SWT' and msgtyp in('103','202')
        and trntyp='TRN' and trninr=#{trninr,jdbcType=VARCHAR}
    </select>

    <select id="selectByCortypAndDirAndMsgtypForCpd" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        dir=#{dir,jdbcType=VARCHAR}
        and cortyp='LET' and msgtyp in('cips111','cips112','cips113')
        and trntyp='TRN' and trninr=#{trninr,jdbcType=VARCHAR}
    </select>

    <select id="selectSmhByExtkey" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        <if test="ownref != null and ownref !=''">
            extkey=#{ownref}
            <if test="imfref != null and imfref !=''">
                or extkey=#{imfref}
            </if>
        </if>
        <if test="imfref != null and imfref !='' and (ownref == null or ownref =='')">
            extkey=#{imfref}
        </if>
    </select>

    <select id="selectBySmhinrList" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where inr in
        <foreach item="item" index="index" collection="smhinrList" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <select id="selectByObjtypAndObjinrAndCortyp" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        cortyp =#{cortyp,jdbcType=VARCHAR}
        and objtyp =#{objtyp,jdbcType=VARCHAR}
        and objinr =#{objinr,jdbcType=VARCHAR}
    </select>
    <select id="getSmhByApfcnt" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from smh
        where
        apfcnt =#{apfcnt,jdbcType=VARCHAR}
        limit 1
    </select>
    <select id="selectByMpiinr" resultType="com.brilliance.isc.bo.Smh">
        select
        <include refid="Base_Column_List"/>
        from smh
        where mpiinr = #{mpiinr}
    </select>
</mapper>