lgamapper.xml 5.58 KB
Newer Older
hulei committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
<?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.LgaMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Lga">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="lgbinr" column="lgbinr" jdbcType="VARCHAR"/>
        <result property="usecur" column="usecur" jdbcType="VARCHAR"/>
        <result property="useamt" column="useamt" jdbcType="DECIMAL"/>
        <result property="naccur" column="naccur" jdbcType="VARCHAR"/>
        <result property="nacamt" column="nacamt" jdbcType="DECIMAL"/>
        <result property="xrfdat" column="xrfdat" jdbcType="DATE"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,lgbinr,usecur,useamt,naccur,nacamt,xrfdat
    </sql>

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

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

    <insert id="insert">
        insert into lga (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{lgbinr,jdbcType=VARCHAR},
            #{usecur,jdbcType=VARCHAR},
            #{useamt,jdbcType=DECIMAL},
            #{naccur,jdbcType=VARCHAR},
            #{nacamt,jdbcType=DECIMAL},
            #{xrfdat,jdbcType=DATE},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into lga
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="lgbinr != null">lgbinr,</if>
            <if test="usecur != null">usecur,</if>
            <if test="useamt != null">useamt,</if>
            <if test="naccur != null">naccur,</if>
            <if test="nacamt != null">nacamt,</if>
            <if test="xrfdat != null">xrfdat,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR}, </if>
            <if test="lgbinr != null">#{lgbinr,jdbcType=VARCHAR}, </if>
            <if test="usecur != null">#{usecur,jdbcType=VARCHAR}, </if>
            <if test="useamt != null">#{useamt,jdbcType=DECIMAL}, </if>
            <if test="naccur != null">#{naccur,jdbcType=VARCHAR}, </if>
            <if test="nacamt != null">#{nacamt,jdbcType=DECIMAL}, </if>
            <if test="xrfdat != null">#{xrfdat,jdbcType=DATE}, </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update lga
        <set>
            <if test="lgbinr != null">lgbinr = #{lgbinr,jdbcType=VARCHAR},</if>
            <if test="usecur != null">usecur = #{usecur,jdbcType=VARCHAR},</if>
            <if test="useamt != null">useamt = #{useamt,jdbcType=DECIMAL},</if>
            <if test="naccur != null">naccur = #{naccur,jdbcType=VARCHAR},</if>
            <if test="nacamt != null">nacamt = #{nacamt,jdbcType=DECIMAL},</if>
            <if test="xrfdat != null">xrfdat = #{xrfdat,jdbcType=DATE},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update lga
        <set>
            lgbinr = #{lgbinr,jdbcType=VARCHAR},
            usecur = #{usecur,jdbcType=VARCHAR},
            useamt = #{useamt,jdbcType=DECIMAL},
            naccur = #{naccur,jdbcType=VARCHAR},
            nacamt = #{nacamt,jdbcType=DECIMAL},
            xrfdat = #{xrfdat,jdbcType=DATE},
        </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 lga
        <set>
            <if test="module.lgbinr != null">lgbinr = #{module.lgbinr,jdbcType=VARCHAR},</if>
            <if test="module.usecur != null">usecur = #{module.usecur,jdbcType=VARCHAR},</if>
            <if test="module.useamt != null">useamt = #{module.useamt,jdbcType=DECIMAL},</if>
            <if test="module.naccur != null">naccur = #{module.naccur,jdbcType=VARCHAR},</if>
            <if test="module.nacamt != null">nacamt = #{module.nacamt,jdbcType=DECIMAL},</if>
            <if test="module.xrfdat != null">xrfdat = #{module.xrfdat,jdbcType=DATE},</if>
        </set>
        ${conditions}
    </update>

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

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

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

    <select id="selectByLgbInr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from lga
        where lgbinr = #{lgbinr,jdbcType=VARCHAR}
    </select>

    <select id="queryUseAmt" resultType="com.brilliance.isc.bo.Lga">
        SELECT SUM(xrfamt) useamt FROM lge, lgl
        WHERE lgl.lgbinr=#{lgbinr,jdbcType=VARCHAR}
        AND lgeflg='A' AND lge.lgoinr = lgl.lgoinr
    </select>

    <select id="queryNacAmt" resultType="com.brilliance.isc.bo.Lga">
        SELECT SUM(xrfamt) nacamt FROM lge, lgl
        WHERE lgl.lgbinr=#{lgbinr,jdbcType=VARCHAR}
        AND lgeflg='N' AND lge.lgoinr = lgl.lgoinr
    </select>

</mapper>