eblmapper.xml 10.2 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.EblMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Ebl">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="ownref" column="ownref" jdbcType="VARCHAR"/>
        <result property="objtyp" column="objtyp" jdbcType="VARCHAR"/>
        <result property="objinr" column="objinr" jdbcType="VARCHAR"/>
        <result property="rptno" column="rptno" jdbcType="VARCHAR"/>
        <result property="ownextkey" column="ownextkey" jdbcType="VARCHAR"/>
        <result property="cfatyp" column="cfatyp" jdbcType="VARCHAR"/>
        <result property="basflg" column="basflg" jdbcType="VARCHAR"/>
        <result property="ownusr" column="ownusr" jdbcType="VARCHAR"/>
        <result property="trninr" column="trninr" jdbcType="VARCHAR"/>
        <result property="credat" column="credat" jdbcType="DATE"/>
        <result property="reldat" column="reldat" jdbcType="DATE"/>
        <result property="acttyp" column="acttyp" jdbcType="VARCHAR"/>
        <result property="cretim" column="cretim" jdbcType="DATE"/>
        <result property="resamt" column="resamt" jdbcType="DECIMAL"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,ver,ownref,objtyp,objinr,rptno,ownextkey,cfatyp,basflg,ownusr,trninr,credat,reldat,acttyp,cretim,resamt
    </sql>

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

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

    <insert id="insert">
        insert into ebl (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            #{ownref,jdbcType=VARCHAR},
            #{objtyp,jdbcType=VARCHAR},
            #{objinr,jdbcType=VARCHAR},
            #{rptno,jdbcType=VARCHAR},
            #{ownextkey,jdbcType=VARCHAR},
            #{cfatyp,jdbcType=VARCHAR},
            #{basflg,jdbcType=VARCHAR},
            #{ownusr,jdbcType=VARCHAR},
            #{trninr,jdbcType=VARCHAR},
            #{credat,jdbcType=DATE},
            #{reldat,jdbcType=DATE},
            #{acttyp,jdbcType=VARCHAR},
            #{cretim,jdbcType=DATE},
            #{resamt,jdbcType=DECIMAL},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into ebl
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="ver != null">ver,</if>
            <if test="ownref != null">ownref,</if>
            <if test="objtyp != null">objtyp,</if>
            <if test="objinr != null">objinr,</if>
            <if test="rptno != null">rptno,</if>
            <if test="ownextkey != null">ownextkey,</if>
            <if test="cfatyp != null">cfatyp,</if>
            <if test="basflg != null">basflg,</if>
            <if test="ownusr != null">ownusr,</if>
            <if test="trninr != null">trninr,</if>
            <if test="credat != null">credat,</if>
            <if test="reldat != null">reldat,</if>
            <if test="acttyp != null">acttyp,</if>
            <if test="cretim != null">cretim,</if>
            <if test="resamt != null">resamt,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR}, </if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR}, </if>
            <if test="ownref != null">#{ownref,jdbcType=VARCHAR}, </if>
            <if test="objtyp != null">#{objtyp,jdbcType=VARCHAR}, </if>
            <if test="objinr != null">#{objinr,jdbcType=VARCHAR}, </if>
            <if test="rptno != null">#{rptno,jdbcType=VARCHAR}, </if>
            <if test="ownextkey != null">#{ownextkey,jdbcType=VARCHAR}, </if>
            <if test="cfatyp != null">#{cfatyp,jdbcType=VARCHAR}, </if>
            <if test="basflg != null">#{basflg,jdbcType=VARCHAR}, </if>
            <if test="ownusr != null">#{ownusr,jdbcType=VARCHAR}, </if>
            <if test="trninr != null">#{trninr,jdbcType=VARCHAR}, </if>
            <if test="credat != null">#{credat,jdbcType=DATE}, </if>
            <if test="reldat != null">#{reldat,jdbcType=DATE}, </if>
            <if test="acttyp != null">#{acttyp,jdbcType=VARCHAR}, </if>
            <if test="cretim != null">#{cretim,jdbcType=DATE}, </if>
            <if test="resamt != null">#{resamt,jdbcType=DECIMAL}, </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update ebl
        <set>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            <if test="ownref != null">ownref = #{ownref,jdbcType=VARCHAR},</if>
            <if test="objtyp != null">objtyp = #{objtyp,jdbcType=VARCHAR},</if>
            <if test="objinr != null">objinr = #{objinr,jdbcType=VARCHAR},</if>
            <if test="rptno != null">rptno = #{rptno,jdbcType=VARCHAR},</if>
            <if test="ownextkey != null">ownextkey = #{ownextkey,jdbcType=VARCHAR},</if>
            <if test="cfatyp != null">cfatyp = #{cfatyp,jdbcType=VARCHAR},</if>
            <if test="basflg != null">basflg = #{basflg,jdbcType=VARCHAR},</if>
            <if test="ownusr != null">ownusr = #{ownusr,jdbcType=VARCHAR},</if>
            <if test="trninr != null">trninr = #{trninr,jdbcType=VARCHAR},</if>
            <if test="credat != null">credat = #{credat,jdbcType=DATE},</if>
            <if test="reldat != null">reldat = #{reldat,jdbcType=DATE},</if>
            <if test="acttyp != null">acttyp = #{acttyp,jdbcType=VARCHAR},</if>
            <if test="cretim != null">cretim = #{cretim,jdbcType=DATE},</if>
            <if test="resamt != null">resamt = #{resamt,jdbcType=DECIMAL},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update ebl
        <set>
            ver = #{ver,jdbcType=VARCHAR},
            ownref = #{ownref,jdbcType=VARCHAR},
            objtyp = #{objtyp,jdbcType=VARCHAR},
            objinr = #{objinr,jdbcType=VARCHAR},
            rptno = #{rptno,jdbcType=VARCHAR},
            ownextkey = #{ownextkey,jdbcType=VARCHAR},
            cfatyp = #{cfatyp,jdbcType=VARCHAR},
            basflg = #{basflg,jdbcType=VARCHAR},
            ownusr = #{ownusr,jdbcType=VARCHAR},
            trninr = #{trninr,jdbcType=VARCHAR},
            credat = #{credat,jdbcType=DATE},
            reldat = #{reldat,jdbcType=DATE},
            acttyp = #{acttyp,jdbcType=VARCHAR},
            cretim = #{cretim,jdbcType=DATE},
            resamt = #{resamt,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 ebl
        <set>
            <if test="module.ver != null">ver = #{module.ver,jdbcType=VARCHAR},</if>
            <if test="module.ownref != null">ownref = #{module.ownref,jdbcType=VARCHAR},</if>
            <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.rptno != null">rptno = #{module.rptno,jdbcType=VARCHAR},</if>
            <if test="module.ownextkey != null">ownextkey = #{module.ownextkey,jdbcType=VARCHAR},</if>
            <if test="module.cfatyp != null">cfatyp = #{module.cfatyp,jdbcType=VARCHAR},</if>
            <if test="module.basflg != null">basflg = #{module.basflg,jdbcType=VARCHAR},</if>
            <if test="module.ownusr != null">ownusr = #{module.ownusr,jdbcType=VARCHAR},</if>
            <if test="module.trninr != null">trninr = #{module.trninr,jdbcType=VARCHAR},</if>
            <if test="module.credat != null">credat = #{module.credat,jdbcType=DATE},</if>
            <if test="module.reldat != null">reldat = #{module.reldat,jdbcType=DATE},</if>
            <if test="module.acttyp != null">acttyp = #{module.acttyp,jdbcType=VARCHAR},</if>
            <if test="module.cretim != null">cretim = #{module.cretim,jdbcType=DATE},</if>
            <if test="module.resamt != null">resamt = #{module.resamt,jdbcType=DECIMAL},</if>
        </set>
        ${conditions}
    </update>

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

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

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

    <select id="selectEBAByOwnref" resultMap="BaseResultMap">
        select inr ,ver,ownref,objtyp,objinr,rptno,ownextkey,cfatyp,basflg,ownusr,trninr,credat,reldat,acttyp,cretim,resamt FROM EBL WHERE BASFLG='X' AND OBJTYP='EBA'
        AND OWNREF = #{ownref,jdbcType=VARCHAR} order by length(inr) desc, inr desc limit 1
    </select>

    <select id="selectMaxinrByOwnref" resultType="java.lang.String">
        select max(inr) from ebl where basflg='X' and objtyp='EAD' and ownref = #{ownref}
    </select>


    <select id="selectMaxInrByOwnrefAndObjtyp" resultType="java.lang.String">
        SELECT inr FROM EBL WHERE BASFLG='X'
        AND OWNREF = #{ownref,jdbcType=VARCHAR}
        AND OBJTYP = #{objtyp,jdbcType=VARCHAR} order by length(inr) desc, inr desc limit 1
    </select>

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

    <select id="selectByTrninrAndObjtyp" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from ebl
        where trninr = #{trninr,jdbcType=VARCHAR}
        AND OBJTYP = #{objtyp,jdbcType=VARCHAR}
    </select>
</mapper>