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

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Act">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="pri" column="pri" jdbcType="VARCHAR"/>
        <result property="cur" column="cur" jdbcType="VARCHAR"/>
        <result property="extkey" column="extkey" jdbcType="VARCHAR"/>
        <result property="seracc" column="seracc" jdbcType="VARCHAR"/>
        <result property="sernam" column="sernam" jdbcType="VARCHAR"/>
        <result property="serptytyp" column="serptytyp" jdbcType="VARCHAR"/>
        <result property="serptyinr" column="serptyinr" jdbcType="VARCHAR"/>
        <result property="holacc" column="holacc" jdbcType="VARCHAR"/>
        <result property="holnam" column="holnam" jdbcType="VARCHAR"/>
        <result property="holptytyp" column="holptytyp" jdbcType="VARCHAR"/>
        <result property="holptyinr" column="holptyinr" jdbcType="VARCHAR"/>
        <result property="cvrflg" column="cvrflg" jdbcType="VARCHAR"/>
        <result property="rmbflg" column="rmbflg" jdbcType="VARCHAR"/>
        <result property="delflg" column="delflg" jdbcType="VARCHAR"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="dirflg" column="dirflg" jdbcType="VARCHAR"/>
        <result property="othbnkflg" column="othbnkflg" jdbcType="VARCHAR"/>
        <result property="othptynam" column="othptynam" jdbcType="VARCHAR"/>
        <result property="othownflg" column="othownflg" jdbcType="VARCHAR"/>
        <result property="othbic6" column="othbic6" jdbcType="VARCHAR"/>
        <result property="iban" column="iban" jdbcType="VARCHAR"/>
        <result property="etgextkey" column="etgextkey" jdbcType="VARCHAR"/>
        <result property="nam" column="nam" jdbcType="VARCHAR"/>
        <result property="exttyp" column="exttyp" jdbcType="VARCHAR"/>
        <result property="typ" column="typ" jdbcType="VARCHAR"/>
        <result property="extact" column="extact" jdbcType="VARCHAR"/>
        <result property="trmtyp" column="trmtyp" jdbcType="VARCHAR"/>
        <result property="acctyp" column="acctyp" jdbcType="VARCHAR"/>
        <result property="zmqacc" column="zmqacc" jdbcType="VARCHAR"/>
        <result property="actpro" column="actpro" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,pri,cur,extkey,seracc,sernam,serptytyp,serptyinr,holacc,holnam,holptytyp,holptyinr,cvrflg,rmbflg,delflg,ver,dirflg,othbnkflg,othptynam,othownflg,othbic6,iban,etgextkey,nam,exttyp,typ,extact,trmtyp,acctyp,zmqacc,actpro
    </sql>

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

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

    <insert id="insert">
        insert into act (<include refid="Base_Column_List"/>)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{pri,jdbcType=VARCHAR},
            #{cur,jdbcType=VARCHAR},
            #{extkey,jdbcType=VARCHAR},
            #{seracc,jdbcType=VARCHAR},
            #{sernam,jdbcType=VARCHAR},
            #{serptytyp,jdbcType=VARCHAR},
            #{serptyinr,jdbcType=VARCHAR},
            #{holacc,jdbcType=VARCHAR},
            #{holnam,jdbcType=VARCHAR},
            #{holptytyp,jdbcType=VARCHAR},
            #{holptyinr,jdbcType=VARCHAR},
            #{cvrflg,jdbcType=VARCHAR},
            #{rmbflg,jdbcType=VARCHAR},
            #{delflg,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            #{dirflg,jdbcType=VARCHAR},
            #{othbnkflg,jdbcType=VARCHAR},
            #{othptynam,jdbcType=VARCHAR},
            #{othownflg,jdbcType=VARCHAR},
            #{othbic6,jdbcType=VARCHAR},
            #{iban,jdbcType=VARCHAR},
            'CEBGRP',
            #{nam,jdbcType=VARCHAR},
            #{exttyp,jdbcType=VARCHAR},
            #{typ,jdbcType=VARCHAR},
            #{extact,jdbcType=VARCHAR},
            #{trmtyp,jdbcType=VARCHAR},
            #{acctyp,jdbcType=VARCHAR},
            #{zmqacc,jdbcType=VARCHAR},
            #{actpro,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into act
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="pri != null">pri,</if>
            <if test="cur != null">cur,</if>
            <if test="extkey != null">extkey,</if>
            <if test="seracc != null">seracc,</if>
            <if test="sernam != null">sernam,</if>
            <if test="serptytyp != null">serptytyp,</if>
            <if test="serptyinr != null">serptyinr,</if>
            <if test="holacc != null">holacc,</if>
            <if test="holnam != null">holnam,</if>
            <if test="holptytyp != null">holptytyp,</if>
            <if test="holptyinr != null">holptyinr,</if>
            <if test="cvrflg != null">cvrflg,</if>
            <if test="rmbflg != null">rmbflg,</if>
            <if test="delflg != null">delflg,</if>
            <if test="ver != null">ver,</if>
            <if test="dirflg != null">dirflg,</if>
            <if test="othbnkflg != null">othbnkflg,</if>
            <if test="othptynam != null">othptynam,</if>
            <if test="othownflg != null">othownflg,</if>
            <if test="othbic6 != null">othbic6,</if>
            <if test="iban != null">iban,</if>
            etgextkey,
            <if test="nam != null">nam,</if>
            <if test="exttyp != null">exttyp,</if>
            <if test="typ != null">typ,</if>
            <if test="extact != null">extact,</if>
            <if test="trmtyp != null">trmtyp,</if>
            <if test="acctyp != null">acctyp,</if>
            <if test="zmqacc != null">zmqacc,</if>
            <if test="actpro != null">actpro,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR},</if>
            <if test="pri != null">#{pri,jdbcType=VARCHAR},</if>
            <if test="cur != null">#{cur,jdbcType=VARCHAR},</if>
            <if test="extkey != null">#{extkey,jdbcType=VARCHAR},</if>
            <if test="seracc != null">#{seracc,jdbcType=VARCHAR},</if>
            <if test="sernam != null">#{sernam,jdbcType=VARCHAR},</if>
            <if test="serptytyp != null">#{serptytyp,jdbcType=VARCHAR},</if>
            <if test="serptyinr != null">#{serptyinr,jdbcType=VARCHAR},</if>
            <if test="holacc != null">#{holacc,jdbcType=VARCHAR},</if>
            <if test="holnam != null">#{holnam,jdbcType=VARCHAR},</if>
            <if test="holptytyp != null">#{holptytyp,jdbcType=VARCHAR},</if>
            <if test="holptyinr != null">#{holptyinr,jdbcType=VARCHAR},</if>
            <if test="cvrflg != null">#{cvrflg,jdbcType=VARCHAR},</if>
            <if test="rmbflg != null">#{rmbflg,jdbcType=VARCHAR},</if>
            <if test="delflg != null">#{delflg,jdbcType=VARCHAR},</if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR},</if>
            <if test="dirflg != null">#{dirflg,jdbcType=VARCHAR},</if>
            <if test="othbnkflg != null">#{othbnkflg,jdbcType=VARCHAR},</if>
            <if test="othptynam != null">#{othptynam,jdbcType=VARCHAR},</if>
            <if test="othownflg != null">#{othownflg,jdbcType=VARCHAR},</if>
            <if test="othbic6 != null">#{othbic6,jdbcType=VARCHAR},</if>
            <if test="iban != null">#{iban,jdbcType=VARCHAR},</if>
            'CEBGRP',
            <if test="nam != null">#{nam,jdbcType=VARCHAR},</if>
            <if test="exttyp != null">#{exttyp,jdbcType=VARCHAR},</if>
            <if test="typ != null">#{typ,jdbcType=VARCHAR},</if>
            <if test="extact != null">#{extact,jdbcType=VARCHAR},</if>
            <if test="trmtyp != null">#{trmtyp,jdbcType=VARCHAR},</if>
            <if test="acctyp != null">#{acctyp,jdbcType=VARCHAR},</if>
            <if test="zmqacc != null">#{zmqacc,jdbcType=VARCHAR},</if>
            <if test="actpro != null">#{actpro,jdbcType=VARCHAR},</if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update act
        <set>
            <if test="pri != null">pri = #{pri,jdbcType=VARCHAR},</if>
            <if test="cur != null">cur = #{cur,jdbcType=VARCHAR},</if>
            <if test="extkey != null">extkey = #{extkey,jdbcType=VARCHAR},</if>
            <if test="seracc != null">seracc = #{seracc,jdbcType=VARCHAR},</if>
            <if test="sernam != null">sernam = #{sernam,jdbcType=VARCHAR},</if>
            <if test="serptytyp != null">serptytyp = #{serptytyp,jdbcType=VARCHAR},</if>
            <if test="serptyinr != null">serptyinr = #{serptyinr,jdbcType=VARCHAR},</if>
            <if test="holacc != null">holacc = #{holacc,jdbcType=VARCHAR},</if>
            <if test="holnam != null">holnam = #{holnam,jdbcType=VARCHAR},</if>
            <if test="holptytyp != null">holptytyp = #{holptytyp,jdbcType=VARCHAR},</if>
            <if test="holptyinr != null">holptyinr = #{holptyinr,jdbcType=VARCHAR},</if>
            <if test="cvrflg != null">cvrflg = #{cvrflg,jdbcType=VARCHAR},</if>
            <if test="rmbflg != null">rmbflg = #{rmbflg,jdbcType=VARCHAR},</if>
            <if test="delflg != null">delflg = #{delflg,jdbcType=VARCHAR},</if>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            <if test="dirflg != null">dirflg = #{dirflg,jdbcType=VARCHAR},</if>
            <if test="othbnkflg != null">othbnkflg = #{othbnkflg,jdbcType=VARCHAR},</if>
            <if test="othptynam != null">othptynam = #{othptynam,jdbcType=VARCHAR},</if>
            <if test="othownflg != null">othownflg = #{othownflg,jdbcType=VARCHAR},</if>
            <if test="othbic6 != null">othbic6 = #{othbic6,jdbcType=VARCHAR},</if>
            <if test="iban != null">iban = #{iban,jdbcType=VARCHAR},</if>
            etgextkey = 'CEBGRP',
            <if test="nam != null">nam = #{nam,jdbcType=VARCHAR},</if>
            <if test="exttyp != null">exttyp = #{exttyp,jdbcType=VARCHAR},</if>
            <if test="typ != null">typ = #{typ,jdbcType=VARCHAR},</if>
            <if test="extact != null">extact = #{extact,jdbcType=VARCHAR},</if>
            <if test="trmtyp != null">trmtyp = #{trmtyp,jdbcType=VARCHAR},</if>
            <if test="acctyp != null">acctyp = #{acctyp,jdbcType=VARCHAR},</if>
            <if test="zmqacc != null">zmqacc = #{zmqacc,jdbcType=VARCHAR},</if>
            <if test="actpro != null">actpro = #{actpro,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update act
        <set>
            pri = #{pri,jdbcType=VARCHAR},
            cur = #{cur,jdbcType=VARCHAR},
            extkey = #{extkey,jdbcType=VARCHAR},
            seracc = #{seracc,jdbcType=VARCHAR},
            sernam = #{sernam,jdbcType=VARCHAR},
            serptytyp = #{serptytyp,jdbcType=VARCHAR},
            serptyinr = #{serptyinr,jdbcType=VARCHAR},
            holacc = #{holacc,jdbcType=VARCHAR},
            holnam = #{holnam,jdbcType=VARCHAR},
            holptytyp = #{holptytyp,jdbcType=VARCHAR},
            holptyinr = #{holptyinr,jdbcType=VARCHAR},
            cvrflg = #{cvrflg,jdbcType=VARCHAR},
            rmbflg = #{rmbflg,jdbcType=VARCHAR},
            delflg = #{delflg,jdbcType=VARCHAR},
            ver = #{ver,jdbcType=VARCHAR},
            dirflg = #{dirflg,jdbcType=VARCHAR},
            othbnkflg = #{othbnkflg,jdbcType=VARCHAR},
            othptynam = #{othptynam,jdbcType=VARCHAR},
            othownflg = #{othownflg,jdbcType=VARCHAR},
            othbic6 = #{othbic6,jdbcType=VARCHAR},
            iban = #{iban,jdbcType=VARCHAR},
            etgextkey = 'CEBGRP',
            nam = #{nam,jdbcType=VARCHAR},
            exttyp = #{exttyp,jdbcType=VARCHAR},
            typ = #{typ,jdbcType=VARCHAR},
            extact = #{extact,jdbcType=VARCHAR},
            trmtyp = #{trmtyp,jdbcType=VARCHAR},
            acctyp = #{acctyp,jdbcType=VARCHAR},
            zmqacc = #{zmqacc,jdbcType=VARCHAR},
            actpro = #{actpro,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 act
        <set>
            <if test="module.pri != null">pri = #{module.pri,jdbcType=VARCHAR},</if>
            <if test="module.cur != null">cur = #{module.cur,jdbcType=VARCHAR},</if>
            <if test="module.extkey != null">extkey = #{module.extkey,jdbcType=VARCHAR},</if>
            <if test="module.seracc != null">seracc = #{module.seracc,jdbcType=VARCHAR},</if>
            <if test="module.sernam != null">sernam = #{module.sernam,jdbcType=VARCHAR},</if>
            <if test="module.serptytyp != null">serptytyp = #{module.serptytyp,jdbcType=VARCHAR},</if>
            <if test="module.serptyinr != null">serptyinr = #{module.serptyinr,jdbcType=VARCHAR},</if>
            <if test="module.holacc != null">holacc = #{module.holacc,jdbcType=VARCHAR},</if>
            <if test="module.holnam != null">holnam = #{module.holnam,jdbcType=VARCHAR},</if>
            <if test="module.holptytyp != null">holptytyp = #{module.holptytyp,jdbcType=VARCHAR},</if>
            <if test="module.holptyinr != null">holptyinr = #{module.holptyinr,jdbcType=VARCHAR},</if>
            <if test="module.cvrflg != null">cvrflg = #{module.cvrflg,jdbcType=VARCHAR},</if>
            <if test="module.rmbflg != null">rmbflg = #{module.rmbflg,jdbcType=VARCHAR},</if>
            <if test="module.delflg != null">delflg = #{module.delflg,jdbcType=VARCHAR},</if>
            <if test="module.ver != null">ver = #{module.ver,jdbcType=VARCHAR},</if>
            <if test="module.dirflg != null">dirflg = #{module.dirflg,jdbcType=VARCHAR},</if>
            <if test="module.othbnkflg != null">othbnkflg = #{module.othbnkflg,jdbcType=VARCHAR},</if>
            <if test="module.othptynam != null">othptynam = #{module.othptynam,jdbcType=VARCHAR},</if>
            <if test="module.othownflg != null">othownflg = #{module.othownflg,jdbcType=VARCHAR},</if>
            <if test="module.othbic6 != null">othbic6 = #{module.othbic6,jdbcType=VARCHAR},</if>
            <if test="module.iban != null">iban = #{module.iban,jdbcType=VARCHAR},</if>
            etgextkey = 'CEBGRP',
            <if test="module.nam != null">nam = #{module.nam,jdbcType=VARCHAR},</if>
            <if test="module.exttyp != null">exttyp = #{module.exttyp,jdbcType=VARCHAR},</if>
            <if test="module.typ != null">typ = #{module.typ,jdbcType=VARCHAR},</if>
            <if test="module.extact != null">extact = #{module.extact,jdbcType=VARCHAR},</if>
            <if test="module.trmtyp != null">trmtyp = #{module.trmtyp,jdbcType=VARCHAR},</if>
            <if test="module.acctyp != null">acctyp = #{module.acctyp,jdbcType=VARCHAR},</if>
            <if test="module.zmqacc != null">zmqacc = #{module.zmqacc,jdbcType=VARCHAR},</if>
            <if test="module.actpro != null">actpro = #{module.actpro,jdbcType=VARCHAR},</if>
        </set>
        ${conditions}
    </update>

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

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

    <select id="getTxmcodByExtkey" resultType="java.lang.String"> <!--环境用的是oracle数据库,实际再调整-->
        SELECT DISTINCT t1.trmcod FROM trm t1 LEFT JOIN act t2 ON t1.trmtyp = t2.trmtyp WHERE t2.extkey = '${extkey}' LIMIT 1
    </select>

    <select id="getZmqAcc" resultType="java.lang.String">
        SELECT ZMQACC FROM ACT WHERE holptyinr=#{holptyinr} and cur='CNY' and zmqacc&lt;&gt;' ' and zmqacc is not null and substr(extkey,4,4)=#{extkey} order by inr desc limit 1
    </select>

    <select id="getActByConditionSql" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from act
        ${conditionSql}
    </select>

    <select id="getSerAccByConditionSql" resultType="java.lang.String">
        select
        seracc
        from act
        ${conditionSql}
    </select>

    <select id="selectPtyinrListByExtkey" resultType="java.lang.String"> <!--环境用的是oracle数据库,实际再调整-->
        select distinct holptyinr from ACT WHERE EXTKEY=#{extkey,jdbcType=VARCHAR}
    </select>

    <select id="selectExtkeyListByPtyinr" resultType="java.lang.String"> <!--环境用的是oracle数据库,实际再调整-->
        SELECT EXTKEY FROM ACT WHERE HOLPTYINR=#{ptyinr,jdbcType=VARCHAR} AND CUR = #{cur,jdbcType=VARCHAR}
        AND TRMTYP <![CDATA[<>]]> 'LO-TT8' AND TRMTYP LIKE 'LO%'
    </select>

    <select id="getActListByExtkey" resultMap="BaseResultMap"> <!--环境用的是oracle数据库,实际再调整-->
        select
        <include refid="Base_Column_List"/>
        from act WHERE EXTKEY=#{extkey,jdbcType=VARCHAR}
    </select>


    <delete id="deleteByInrs">
        delete from act where inr in
        <foreach item="item" index="index" collection="actlist" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

    <select id="selectInrByPtyinr" resultType="java.lang.String">
        select distinct inr from act
        <where>
            <if test='ptytyp != null and ptytyp == "A"'>
                and (act.holptyinr = #{ptyinr} and act.serptyinr = #{ptyinr})
            </if>
            <if test='ptytyp != null and ptytyp != "A"'>
                and (act.holptyinr = #{ptyinr} or act.serptyinr = #{ptyinr})
            </if>
        </where>
    </select>

    <select id="queryByPtyinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from act where holptyinr = #{ptyinr} and holptytyp = 'C'
    </select>

    <select id="queryByPtyCondition" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"></include>
        from act
        <where>
            <if test="typ != null and typ != ''">
                and typ = #{typ}
            </if>
            <if test="cur != null and cur != ''">
                and cur = #{cur}
            </if>
            <if test="extkey != null">
                and extkey like concat(concat('%', #{extkey}), '%')
            </if>
            and holptyinr = #{holptyinr} order by id desc
        </where>
    </select>

    <select id="queryDetailById" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from act where inr = #{inr}
    </select>

    <select id="queryDetailByExtkey" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from act where extkey = #{extkey}
    </select>

    <delete id="delete">
        delete from act where inr = #{inr}
    </delete>

    <update id="edit">
        update act
        <set>
            <trim suffixOverrides=",">
                <if test="module.pri != null">pri = #{module.pri,jdbcType=VARCHAR},</if>
                <if test="module.cur != null">cur = #{module.cur,jdbcType=VARCHAR},</if>
                <if test="module.extkey != null">extkey = #{module.extkey,jdbcType=VARCHAR},</if>
                <if test="module.seracc != null">seracc = #{module.seracc,jdbcType=VARCHAR},</if>
                <if test="module.sernam != null">sernam = #{module.sernam,jdbcType=VARCHAR},</if>
                <if test="module.serptytyp != null">serptytyp = #{module.serptytyp,jdbcType=VARCHAR},</if>
                <if test="module.serptyinr != null">serptyinr = #{module.serptyinr,jdbcType=VARCHAR},</if>
                <if test="module.holacc != null">holacc = #{module.holacc,jdbcType=VARCHAR},</if>
                <if test="module.holnam != null">holnam = #{module.holnam,jdbcType=VARCHAR},</if>
                <if test="module.holptytyp != null">holptytyp = #{module.holptytyp,jdbcType=VARCHAR},</if>
                <if test="module.holptyinr != null">holptyinr = #{module.holptyinr,jdbcType=VARCHAR},</if>
                <if test="module.cvrflg != null">cvrflg = #{module.cvrflg,jdbcType=VARCHAR},</if>
                <if test="module.rmbflg != null">rmbflg = #{module.rmbflg,jdbcType=VARCHAR},</if>
                <if test="module.delflg != null">delflg = #{module.delflg,jdbcType=VARCHAR},</if>
                <if test="module.ver != null">ver = #{module.ver,jdbcType=VARCHAR},</if>
                <if test="module.dirflg != null">dirflg = #{module.dirflg,jdbcType=VARCHAR},</if>
                <if test="module.othbnkflg != null">othbnkflg = #{module.othbnkflg,jdbcType=VARCHAR},</if>
                <if test="module.othptynam != null">othptynam = #{module.othptynam,jdbcType=VARCHAR},</if>
                <if test="module.othownflg != null">othownflg = #{module.othownflg,jdbcType=VARCHAR},</if>
                <if test="module.othbic6 != null">othbic6 = #{module.othbic6,jdbcType=VARCHAR},</if>
                <if test="module.iban != null">iban = #{module.iban,jdbcType=VARCHAR},</if>
                etgextkey = 'CEBGRP',
                <if test="module.nam != null">nam = #{module.nam,jdbcType=VARCHAR},</if>
                <if test="module.exttyp != null">exttyp = #{module.exttyp,jdbcType=VARCHAR},</if>
                <if test="module.typ != null">typ = #{module.typ,jdbcType=VARCHAR},</if>
                <if test="module.extact != null">extact = #{module.extact,jdbcType=VARCHAR},</if>
                <if test="module.trmtyp != null">trmtyp = #{module.trmtyp,jdbcType=VARCHAR},</if>
                <if test="module.acctyp != null">acctyp = #{module.acctyp,jdbcType=VARCHAR},</if>
                <if test="module.zmqacc != null">zmqacc = #{module.zmqacc,jdbcType=VARCHAR},</if>
                <if test="module.actpro != null">actpro = #{module.actpro,jdbcType=VARCHAR},</if>
            </trim>
        </set>
        where inr = #{module.inr,jdbcType=VARCHAR}
    </update>

    <insert id="add">
        insert into act
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="pri != null">pri,</if>
            <if test="cur != null">cur,</if>
            <if test="extkey != null">extkey,</if>
            <if test="seracc != null">seracc,</if>
            <if test="sernam != null">sernam,</if>
            <if test="serptytyp != null">serptytyp,</if>
            <if test="serptyinr != null">serptyinr,</if>
            <if test="holacc != null">holacc,</if>
            <if test="holnam != null">holnam,</if>
            <if test="holptytyp != null">holptytyp,</if>
            <if test="holptyinr != null">holptyinr,</if>
            <if test="cvrflg != null">cvrflg,</if>
            <if test="rmbflg != null">rmbflg,</if>
            <if test="delflg != null">delflg,</if>
            <if test="ver != null">ver,</if>
            <if test="dirflg != null">dirflg,</if>
            <if test="othbnkflg != null">othbnkflg,</if>
            <if test="othptynam != null">othptynam,</if>
            <if test="othownflg != null">othownflg,</if>
            <if test="othbic6 != null">othbic6,</if>
            <if test="iban != null">iban,</if>
            etgextkey,
            <if test="nam != null">nam,</if>
            <if test="exttyp != null">exttyp,</if>
            <if test="typ != null">typ,</if>
            <if test="extact != null">extact,</if>
            <if test="trmtyp != null">trmtyp,</if>
            <if test="acctyp != null">acctyp,</if>
            <if test="zmqacc != null">zmqacc,</if>
            <if test="actpro != null">actpro,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR},</if>
            <if test="pri != null">#{pri,jdbcType=VARCHAR},</if>
            <if test="cur != null">#{cur,jdbcType=VARCHAR},</if>
            <if test="extkey != null">#{extkey,jdbcType=VARCHAR},</if>
            <if test="seracc != null">#{seracc,jdbcType=VARCHAR},</if>
            <if test="sernam != null">#{sernam,jdbcType=VARCHAR},</if>
            <if test="serptytyp != null">#{serptytyp,jdbcType=VARCHAR},</if>
            <if test="serptyinr != null">#{serptyinr,jdbcType=VARCHAR},</if>
            <if test="holacc != null">#{holacc,jdbcType=VARCHAR},</if>
            <if test="holnam != null">#{holnam,jdbcType=VARCHAR},</if>
            <if test="holptytyp != null">#{holptytyp,jdbcType=VARCHAR},</if>
            <if test="holptyinr != null">#{holptyinr,jdbcType=VARCHAR},</if>
            <if test="cvrflg != null">#{cvrflg,jdbcType=VARCHAR},</if>
            <if test="rmbflg != null">#{rmbflg,jdbcType=VARCHAR},</if>
            <if test="delflg != null">#{delflg,jdbcType=VARCHAR},</if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR},</if>
            <if test="dirflg != null">#{dirflg,jdbcType=VARCHAR},</if>
            <if test="othbnkflg != null">#{othbnkflg,jdbcType=VARCHAR},</if>
            <if test="othptynam != null">#{othptynam,jdbcType=VARCHAR},</if>
            <if test="othownflg != null">#{othownflg,jdbcType=VARCHAR},</if>
            <if test="othbic6 != null">#{othbic6,jdbcType=VARCHAR},</if>
            <if test="iban != null">#{iban,jdbcType=VARCHAR},</if>
            'CEBGRP',
            <if test="nam != null">#{nam,jdbcType=VARCHAR},</if>
            <if test="exttyp != null">#{exttyp,jdbcType=VARCHAR},</if>
            <if test="typ != null">#{typ,jdbcType=VARCHAR},</if>
            <if test="extact != null">#{extact,jdbcType=VARCHAR},</if>
            <if test="trmtyp != null">#{trmtyp,jdbcType=VARCHAR},</if>
            <if test="acctyp != null">#{acctyp,jdbcType=VARCHAR},</if>
            <if test="zmqacc != null">#{zmqacc,jdbcType=VARCHAR},</if>
            <if test="actpro != null">#{actpro,jdbcType=VARCHAR},</if>
        </trim>
    </insert>

    <select id="queryAllLimit" resultType="com.brilliance.isc.vo.manager.ActVo">
        SELECT ACT.INR, ACT.CUR as acur, ACT.EXTKEY as aextkey, ACT.NAM as anam, ACT.TYP as atyp,
        ACT.TRMTYP as atrmtyp, ACT.ACCTYP as aacctyp, ACT.ZMQACC as azmqacc,
        PTY.EXTKEY as pextkey, PTY.NAM as pnam, PTY.NAM1 as pnam1
        FROM act,pty
        <where>
            act.holptyinr=pty.inr
            <if test="aextkey != null and aextkey !=''">
                AND act.EXTKEY like concat(concat('%',#{aextkey}),'%')
            </if>
            <if test="pextkey != null and pextkey !=''">
                AND pty.EXTKEY like concat(concat('%',#{pextkey}),'%')
            </if>
            <if test="nam != null and nam !=''">
                AND (pty.nam like concat(concat('%',#{nam}),'%') or pty.nam1 like concat(concat('%',#{nam}),'%'))
            </if>
        </where>
        ORDER BY ACT.INR DESC
    </select>

    <select id="queryAllLimitByCon" resultType="com.brilliance.isc.vo.manager.ActVo">
        SELECT ACT.INR, ACT.CUR as acur, ACT.EXTKEY as aextkey, ACT.NAM as anam, ACT.TYP as atyp,
        ACT.TRMTYP as atrmtyp, ACT.ACCTYP as aacctyp, ACT.ZMQACC as azmqacc,
        PTY.EXTKEY as pextkey, PTY.NAM as pnam, PTY.NAM1 as pnam1
        FROM act,pty,pta
        <where>
            act.holptyinr=pty.inr and pta.ptyinr = pty.inr
            <if test="actVo.aextkey != null and actVo.aextkey !=''">
                AND act.EXTKEY like concat(concat('%',#{actVo.aextkey}),'%')
            </if>
            <if test="actVo.pextkey != null and actVo.pextkey !=''">
                AND pty.EXTKEY like concat(concat('%',#{actVo.pextkey}),'%')
            </if>
            <if test="actVo.nam != null and actVo.nam !=''">
                AND (pty.nam like concat(concat('%',#{actVo.nam}),'%') or pty.nam1 like concat(concat('%',#{actVo.nam}),'%'))
            </if>
            <if test="bchlist != null and bchlist.size() > 0">
                AND (pta.bchkeyinr in
                <foreach collection="bchlist" separator="," index="index" close=")" open="(" item="bchitem">
                    #{bchitem}
                </foreach>
                OR pta.branchinr in
                <foreach collection="bchlist" separator="," item="branchitem" open="(" close=")" index="index">
                    #{branchitem}
                </foreach>
                )
            </if>
        </where>
        ORDER BY ACT.INR DESC
    </select>

    <select id="listByExtKey" resultMap="BaseResultMap">
        select * from act where extkey = #{extkey}
        <if test="holptyinr != null and holptyinr != ''">
            AND holptyinr = #{holptyinr}
        </if>
    </select>

    <select id="check" resultType="java.lang.Integer">
        select count(*) from act
        <where>
            <if test="extkey != null and extkey != ''">
                AND EXTKEY = #{extkey}
            </if>
            <if test="typ != null and typ != ''">
                AND TYP = #{typ}
            </if>
            <if test="trmtyp != null and trmtyp != ''">
                AND TRMTYP = #{trmtyp}
            </if>
            <if test="cur != null and cur != ''">
                AND CUR = #{cur}
            </if>
            <if test="holptyinr != null and holptyinr != ''">
                AND HOLPTYINR = #{holptyinr}
            </if>
        </where>
    </select>

    <select id="queryRmbActList" resultMap="BaseResultMap">
        select
            <include refid="Base_Column_List"/>
          from act
         where typ = #{vo.typ,jdbcType=VARCHAR}
           and cur = #{vo.cur,jdbcType=VARCHAR}
           and rmbflg != ' '
           and serptyinr = #{vo.serptyinr,jdbcType=VARCHAR}
    </select>

    <select id="listByHolptyinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from act
        WHERE ZMQACC != ' ' AND ZMQACC IS NOT NULL AND TYP='LO' AND CUR='CNY' AND HOLPTYINR = #{holptyinr}
    </select>

    <select id="listByHolptyinrWithCur" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from act
        <where>
        ETGEXTKEY = #{etgextkey}
        AND HOLPTYINR = #{holptyinr}
        AND ACCTYP='C'
        AND TRMTYP LIKE concat(#{trmtyp},'%')
        and DIRFLG != 'C'
        AND DELFLG = ''
            <if test="cur != null and cur != ''">
                AND CUR = #{cur}
            </if>
        </where>
        order by cur desc;
    </select>

    <select id="listByHolptyinrWithCurNotZMQ" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from act
        <where>
            ETGEXTKEY = #{etgextkey}
            AND HOLPTYINR = #{holptyinr}
            AND ACCTYP='C'
            AND TRMTYP LIKE concat(#{trmtyp},'%')
            and DIRFLG != 'C'
            AND DELFLG = ''
            AND EXTKEY NOT LIKE '%EF%'
            AND EXTKEY NOT LIKE '%FT%'
            AND EXTKEY NOT LIKE '%ZMQ%'
            <if test="cur != null and cur != ''">
                AND CUR = #{cur}
            </if>
        </where>
        order by cur desc;
    </select>

    <select id="selectCashAccList" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from act where TRMTYP in ('CC-TT4','CC-TT5','CC-TT6','CC-TT7') AND CUR = #{cur} AND HOLPTYINR = #{holptyinr}
    </select>

    <select id="selectByExtkeyAndActpro" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from act WHERE EXTKEY=#{extkey,jdbcType=VARCHAR} and actpro in ('2303','3603','3604')
    </select>

</mapper>