cbemapper.xml 15.1 KB
<?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.CbeMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Cbe">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="objtyp" column="objtyp" jdbcType="VARCHAR"/>
        <result property="objinr" column="objinr" jdbcType="VARCHAR"/>
        <result property="extid" column="extid" jdbcType="VARCHAR"/>
        <result property="cbt" column="cbt" jdbcType="VARCHAR"/>
        <result property="trntyp" column="trntyp" jdbcType="VARCHAR"/>
        <result property="trninr" column="trninr" jdbcType="VARCHAR"/>
        <result property="dat" column="dat" jdbcType="DATE"/>
        <result property="cur" column="cur" jdbcType="VARCHAR"/>
        <result property="amt" column="amt" jdbcType="DECIMAL"/>
        <result property="relflg" column="relflg" jdbcType="VARCHAR"/>
        <result property="credat" column="credat" jdbcType="DATE"/>
        <result property="xrfcur" column="xrfcur" jdbcType="VARCHAR"/>
        <result property="xrfamt" column="xrfamt" jdbcType="DECIMAL"/>
        <result property="nam" column="nam" jdbcType="VARCHAR"/>
        <result property="acc" column="acc" jdbcType="VARCHAR"/>
        <result property="acc2" column="acc2" jdbcType="VARCHAR"/>
        <result property="optdat" column="optdat" jdbcType="DATE"/>
        <result property="gledat" column="gledat" jdbcType="DATE"/>
        <result property="nompct" column="nompct" jdbcType="DECIMAL"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,objtyp,objinr,extid,cbt,trntyp,trninr,dat,cur,amt,relflg,credat,xrfcur,xrfamt,nam,acc,acc2,optdat,gledat,nompct
    </sql>

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

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

    <insert id="insert">
        insert into cbe (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{objtyp,jdbcType=VARCHAR},
            #{objinr,jdbcType=VARCHAR},
            #{extid,jdbcType=VARCHAR},
            #{cbt,jdbcType=VARCHAR},
            #{trntyp,jdbcType=VARCHAR},
            #{trninr,jdbcType=VARCHAR},
            #{dat,jdbcType=DATE},
            #{cur,jdbcType=VARCHAR},
            #{amt,jdbcType=DECIMAL},
            #{relflg,jdbcType=VARCHAR},
            #{credat,jdbcType=DATE},
            #{xrfcur,jdbcType=VARCHAR},
            #{xrfamt,jdbcType=DECIMAL},
            #{nam,jdbcType=VARCHAR},
            #{acc,jdbcType=VARCHAR},
            #{acc2,jdbcType=VARCHAR},
            #{optdat,jdbcType=DATE},
            #{gledat,jdbcType=DATE},
            #{nompct,jdbcType=DECIMAL},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into cbe
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="objtyp != null">objtyp,</if>
            <if test="objinr != null">objinr,</if>
            <if test="extid != null">extid,</if>
            <if test="cbt != null">cbt,</if>
            <if test="trntyp != null">trntyp,</if>
            <if test="trninr != null">trninr,</if>
            <if test="dat != null">dat,</if>
            <if test="cur != null">cur,</if>
            <if test="amt != null">amt,</if>
            <if test="relflg != null">relflg,</if>
            <if test="credat != null">credat,</if>
            <if test="xrfcur != null">xrfcur,</if>
            <if test="xrfamt != null">xrfamt,</if>
            <if test="nam != null">nam,</if>
            <if test="acc != null">acc,</if>
            <if test="acc2 != null">acc2,</if>
            <if test="optdat != null">optdat,</if>
            <if test="gledat != null">gledat,</if>
            <if test="nompct != null">nompct,</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="extid != null">#{extid,jdbcType=VARCHAR}, </if>
            <if test="cbt != null">#{cbt,jdbcType=VARCHAR}, </if>
            <if test="trntyp != null">#{trntyp,jdbcType=VARCHAR}, </if>
            <if test="trninr != null">#{trninr,jdbcType=VARCHAR}, </if>
            <if test="dat != null">#{dat,jdbcType=DATE}, </if>
            <if test="cur != null">#{cur,jdbcType=VARCHAR}, </if>
            <if test="amt != null">#{amt,jdbcType=DECIMAL}, </if>
            <if test="relflg != null">#{relflg,jdbcType=VARCHAR}, </if>
            <if test="credat != null">#{credat,jdbcType=DATE}, </if>
            <if test="xrfcur != null">#{xrfcur,jdbcType=VARCHAR}, </if>
            <if test="xrfamt != null">#{xrfamt,jdbcType=DECIMAL}, </if>
            <if test="nam != null">#{nam,jdbcType=VARCHAR}, </if>
            <if test="acc != null">#{acc,jdbcType=VARCHAR}, </if>
            <if test="acc2 != null">#{acc2,jdbcType=VARCHAR}, </if>
            <if test="optdat != null">#{optdat,jdbcType=DATE}, </if>
            <if test="gledat != null">#{gledat,jdbcType=DATE}, </if>
            <if test="nompct != null">#{nompct,jdbcType=DECIMAL}, </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update cbe
        <set>
            <if test="objtyp != null">objtyp = #{objtyp,jdbcType=VARCHAR},</if>
            <if test="objinr != null">objinr = #{objinr,jdbcType=VARCHAR},</if>
            <if test="extid != null">extid = #{extid,jdbcType=VARCHAR},</if>
            <if test="cbt != null">cbt = #{cbt,jdbcType=VARCHAR},</if>
            <if test="trntyp != null">trntyp = #{trntyp,jdbcType=VARCHAR},</if>
            <if test="trninr != null">trninr = #{trninr,jdbcType=VARCHAR},</if>
            <if test="dat != null">dat = #{dat,jdbcType=DATE},</if>
            <if test="cur != null">cur = #{cur,jdbcType=VARCHAR},</if>
            <if test="amt != null">amt = #{amt,jdbcType=DECIMAL},</if>
            <if test="relflg != null">relflg = #{relflg,jdbcType=VARCHAR},</if>
            <if test="credat != null">credat = #{credat,jdbcType=DATE},</if>
            <if test="xrfcur != null">xrfcur = #{xrfcur,jdbcType=VARCHAR},</if>
            <if test="xrfamt != null">xrfamt = #{xrfamt,jdbcType=DECIMAL},</if>
            <if test="nam != null">nam = #{nam,jdbcType=VARCHAR},</if>
            <if test="acc != null">acc = #{acc,jdbcType=VARCHAR},</if>
            <if test="acc2 != null">acc2 = #{acc2,jdbcType=VARCHAR},</if>
            <if test="optdat != null">optdat = #{optdat,jdbcType=DATE},</if>
            <if test="gledat != null">gledat = #{gledat,jdbcType=DATE},</if>
            <if test="nompct != null">nompct = #{nompct,jdbcType=DECIMAL},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update cbe
        <set>
            objtyp = #{objtyp,jdbcType=VARCHAR},
            objinr = #{objinr,jdbcType=VARCHAR},
            extid = #{extid,jdbcType=VARCHAR},
            cbt = #{cbt,jdbcType=VARCHAR},
            trntyp = #{trntyp,jdbcType=VARCHAR},
            trninr = #{trninr,jdbcType=VARCHAR},
            dat = #{dat,jdbcType=DATE},
            cur = #{cur,jdbcType=VARCHAR},
            amt = #{amt,jdbcType=DECIMAL},
            relflg = #{relflg,jdbcType=VARCHAR},
            credat = #{credat,jdbcType=DATE},
            xrfcur = #{xrfcur,jdbcType=VARCHAR},
            xrfamt = #{xrfamt,jdbcType=DECIMAL},
            nam = #{nam,jdbcType=VARCHAR},
            acc = #{acc,jdbcType=VARCHAR},
            acc2 = #{acc2,jdbcType=VARCHAR},
            optdat = #{optdat,jdbcType=DATE},
            gledat = #{gledat,jdbcType=DATE},
            nompct = #{nompct,jdbcType=DECIMAL},
        </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 cbe
        <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.extid != null">extid = #{module.extid,jdbcType=VARCHAR},</if>
            <if test="module.cbt != null">cbt = #{module.cbt,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.dat != null">dat = #{module.dat,jdbcType=DATE},</if>
            <if test="module.cur != null">cur = #{module.cur,jdbcType=VARCHAR},</if>
            <if test="module.amt != null">amt = #{module.amt,jdbcType=DECIMAL},</if>
            <if test="module.relflg != null">relflg = #{module.relflg,jdbcType=VARCHAR},</if>
            <if test="module.credat != null">credat = #{module.credat,jdbcType=DATE},</if>
            <if test="module.xrfcur != null">xrfcur = #{module.xrfcur,jdbcType=VARCHAR},</if>
            <if test="module.xrfamt != null">xrfamt = #{module.xrfamt,jdbcType=DECIMAL},</if>
            <if test="module.nam != null">nam = #{module.nam,jdbcType=VARCHAR},</if>
            <if test="module.acc != null">acc = #{module.acc,jdbcType=VARCHAR},</if>
            <if test="module.acc2 != null">acc2 = #{module.acc2,jdbcType=VARCHAR},</if>
            <if test="module.optdat != null">optdat = #{module.optdat,jdbcType=DATE},</if>
            <if test="module.gledat != null">gledat = #{module.gledat,jdbcType=DATE},</if>
            <if test="module.nompct != null">nompct = #{module.nompct,jdbcType=DECIMAL},</if>
        </set>
        ${conditions}
    </update>

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

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

    <select id="getCbeListByTrnTypeAndInr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from cbe
        where trntyp =#{trntyp} and trninr =#{trninr}
    </select>

    <select id="getCbeListByTrnTypeAndInrWithEFlag" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from cbe
        where trntyp =#{trntyp} and trninr =#{trninr} and relflg='E' order by length(inr) ASC, inr ASC
    </select>

    <select id="getCbeListByObjTypAndInrWithCbt" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from cbe
        where objinr =#{objinr} and objtyp =#{objtyp} and cbt =#{cbt}
    </select>

    <select id="getCurListByAccInCcv" resultType="java.lang.String">
        select distinct(cur) from cbe
        where objinr =#{objinr} and objtyp =#{objtyp} and acc=#{acc} and cbt ='CCVIN'
    </select>


    <select id="queryCbe" resultType="com.brilliance.isc.bo.Cbe">
        select
            <include refid="Base_Column_List"/>
          from cbe
         where (cbe.objtyp = #{objtyp}
           and cbe.objinr = #{objinr})
        <if test="pteList != null and pteList.size() >0 ">
            or (objtyp = 'PTE' and
            objinr in
            <foreach item="pte" collection="pteList" open="(" separator="," close=")">#{pte.inr}
            </foreach>
            )
         </if>
        order by trninr
    </select>
    <select id="getCbeListByObjTypeAndInr" resultType="com.brilliance.isc.bo.Cbe">
        select
        <include refid="Base_Column_List"/>
        from cbe
        where objtyp = #{objtyp}
        and objinr = #{objinr}
        order by DAT asc
    </select>

    <select id="getSumamtByObjtypObjinrAccCur" resultType="BigDecimal">
        select
            sum(amt)
        from
            cbe
        where
            relflg = 'R'
          and cbt = 'CCVOUT'
          and acc = #{acc}
          and cur = #{cur}
          and objtyp = #{objtyp}
          and objinr = #{objinr}
    </select>

    <select id="getSumamtByObjtypObjinr" resultType="com.brilliance.isc.vo.lg.CbeVo">
        select
            sum(amt) sumamt,
            cur
        from
            cbe
        where
            relflg = 'R'
          and cbt = 'MAXAMT'
          and EXTID = 'AMT1'
          and objtyp = #{objtyp}
          and objinr = #{objinr}
        group by
            cur
    </select>
    <select id="getSumamtByObjtypinrAndCbt" resultType="com.brilliance.isc.vo.lg.CbeVo">
        select
            sum(amt) sumamt,
            cur
        from
            cbe
        where
            relflg = 'R'
          and cbt = #{cbt}
          and EXTID = 'AMT1'
          and objtyp = #{objtyp}
          and objinr = #{objinr}
        group by
            cur
    </select>
    <select id="selectByObjtypAndObjinrAndCbtAndTrninr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from cbe
        where
        objtyp = #{objtyp,jdbcType=VARCHAR}
        AND objinr = #{objinr,jdbcType=VARCHAR}
        AND cbt = #{cbt,jdbcType=VARCHAR}
        AND trninr = #{trninr,jdbcType=VARCHAR}
    </select>
    <select id="selectCecmCbe" resultMap="BaseResultMap">
        SELECT cur, sum(amt) as amt  FROM cbe
             WHERE objtyp = #{objtyp,jdbcType=VARCHAR}
               AND objinr = #{objinr,jdbcType=VARCHAR}
               AND trninr = #{trninr,jdbcType=VARCHAR}
               AND cbt = #{cbt,jdbcType=VARCHAR}
               AND extid in
            <foreach collection="list" item="items" open="(" separator="," close=")">
                #{items}
            </foreach>
    </select>
    <select id="selectPayamt" resultMap="BaseResultMap">
        select sum(amt) as amt from cbe
        where
        objtyp = 'PTE' and
        objinr in (select inr from pte where objtyp = 'PTS' and objinr = #{objinr, jdbcType=VARCHAR} and cbtpfx = #{cbtpfx}) and cbt = 'LIAOUT'
    </select>
    <select id="reportForSet" resultType="com.brilliance.isc.vo.report.ReportForUdpSetVo">
        SELECT
            trn.objinr inr,
            CBE.CREDAT,
            CBE.CUR,
            CBE.AMT
        FROM
            cbe
           LEFT JOIN trn ON cbe.TRNINR = trn.inr
        WHERE
            cbe.objtyp = 'PTE'
          AND cbe.cbt = 'LIAOUT'
          AND trn.objtyp = 'BRD'
          AND (trn.INIFRM = 'BRTSET' OR trn.INIFRM = 'BRTSUS')
          AND trn.RELFLG IN ('R','F')
          AND trn.OBJINR IN
        <foreach item="inr" collection="inrs" open="(" separator="," close=")">
              #{inr}
        </foreach>
        GROUP BY trn.objinr
    </select>

    <select id="getCcvCbeList" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from cbe
        where objinr =#{objinr} and objtyp =#{objtyp} and cbt in ('CCVIN', 'CCVOUT')
        order by dat,inr desc
    </select>
</mapper>