ptmmapper.xml 8.05 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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
<?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.PtmMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Ptm">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="ptainr" column="ptainr" jdbcType="VARCHAR"/>
        <result property="cortyp" column="cortyp" jdbcType="VARCHAR"/>
        <result property="coradr" column="coradr" jdbcType="VARCHAR"/>
        <result property="autflg" column="autflg" jdbcType="VARCHAR"/>
        <result property="autdet" column="autdet" jdbcType="VARCHAR"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="etyextkey" column="etyextkey" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,ptainr,cortyp,coradr,autflg,autdet,ver,etyextkey
    </sql>

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

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

    <insert id="insert">
        insert into ptm (<include refid="Base_Column_List"/>)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{ptainr,jdbcType=VARCHAR},
            #{cortyp,jdbcType=VARCHAR},
            #{coradr,jdbcType=VARCHAR},
            #{autflg,jdbcType=VARCHAR},
            #{autdet,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            'CEB',
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into ptm
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="ptainr != null">ptainr,</if>
            <if test="cortyp != null">cortyp,</if>
            <if test="coradr != null">coradr,</if>
            <if test="autflg != null">autflg,</if>
            <if test="autdet != null">autdet,</if>
            <if test="ver != null">ver,</if>
            etyextkey,
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR},</if>
            <if test="ptainr != null">#{ptainr,jdbcType=VARCHAR},</if>
            <if test="cortyp != null">#{cortyp,jdbcType=VARCHAR},</if>
            <if test="coradr != null">#{coradr,jdbcType=VARCHAR},</if>
            <if test="autflg != null">#{autflg,jdbcType=VARCHAR},</if>
            <if test="autdet != null">#{autdet,jdbcType=VARCHAR},</if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR},</if>
            'CEB',
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update ptm
        <set>
            <if test="ptainr != null">ptainr = #{ptainr,jdbcType=VARCHAR},</if>
            <if test="cortyp != null">cortyp = #{cortyp,jdbcType=VARCHAR},</if>
            <if test="coradr != null">coradr = #{coradr,jdbcType=VARCHAR},</if>
            <if test="autflg != null">autflg = #{autflg,jdbcType=VARCHAR},</if>
            <if test="autdet != null">autdet = #{autdet,jdbcType=VARCHAR},</if>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            etyextkey = 'CEB',
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update ptm
        <set>
            ptainr = #{ptainr,jdbcType=VARCHAR},
            cortyp = #{cortyp,jdbcType=VARCHAR},
            coradr = #{coradr,jdbcType=VARCHAR},
            autflg = #{autflg,jdbcType=VARCHAR},
            autdet = #{autdet,jdbcType=VARCHAR},
            ver = #{ver,jdbcType=VARCHAR},
            etyextkey = 'CEB',
        </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 ptm
        <set>
            <if test="module.ptainr != null">ptainr = #{module.ptainr,jdbcType=VARCHAR},</if>
            <if test="module.cortyp != null">cortyp = #{module.cortyp,jdbcType=VARCHAR},</if>
            <if test="module.coradr != null">coradr = #{module.coradr,jdbcType=VARCHAR},</if>
            <if test="module.autflg != null">autflg = #{module.autflg,jdbcType=VARCHAR},</if>
            <if test="module.autdet != null">autdet = #{module.autdet,jdbcType=VARCHAR},</if>
            <if test="module.ver != null">ver = #{module.ver,jdbcType=VARCHAR},</if>
            etyextkey = 'CEB',
        </set>
        ${conditions}
    </update>

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

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

    <select id="getPtmByConditionSql" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from ptm
        ${sql}
    </select>

    <!--查询指定行数据-->
    <select id="queryAllByLimit" resultType="com.brilliance.isc.vo.manager.PtmVo">
        select (SELECT bic FROM pta WHERE pta.inr=ptm.ptainr) AS bic,
        INR, PTAINR, CORTYP, CORADR, AUTFLG, AUTDET, VER, ETYEXTKEY
        from PTM
        <where>
            <if test="inr != null and inr != ''">
                and INR like concat(concat ('%',#{inr}),'%')
            </if>
            <if test="bic != null and bic != ''">
                and PTAINR in (SELECT PTA.INR FROM PTA WHERE PTA.BIC like concat(concat ('%',#{bic}),'%'))
            </if>
            <if test="cortyp != null and cortyp != ''">
                and CORTYP like concat(concat ('%',#{cortyp}),'%')
            </if>
            <if test="coradr != null and coradr != ''">
                and CORADR like concat(concat ('%',#{coradr}),'%')
            </if>
            <if test="autflg != null and autflg != ''">
                and AUTFLG like concat(concat ('%',#{autflg}),'%')
            </if>
            <if test="autdet != null and autdet != ''">
                and AUTDET like concat(concat ('%',#{autdet}),'%')
            </if>
            <if test="ver != null and ver != ''">
                and VER like concat(concat ('%',#{ver}),'%')
            </if>
            <if test="etyextkey != null and etyextkey != ''">
                and ETYEXTKEY like concat(concat ('%',#{etyextkey}),'%')
            </if>
        </where>
        order by length(INR) DESC, INR DESC
    </select>

    <select id="queryByPtyinrAndBic" resultType="com.brilliance.isc.vo.manager.PtmVo">
        select (SELECT bic FROM pta WHERE pta.inr=ptm.ptainr) AS bic,
        INR, PTAINR, CORTYP, CORADR, AUTFLG, AUTDET, VER, ETYEXTKEY
        from PTM
        <where>
            <if test="ptalist != null and ptalist.size() > 0">
                and PTAINR in
                <foreach collection="ptalist" separator="," open="(" close=")" item="item" index="item">
                    #{item}
                </foreach>
            </if>
            <if test="ptmVo.bic != null and ptmVo.bic != ''">
                and PTAINR in (SELECT PTA.INR FROM PTA WHERE PTA.BIC like concat(concat ('%',#{ptmVo.bic}),'%'))
            </if>
        </where>
        order by length(INR) DESC, INR DESC
    </select>

    <select id="listAllByVo" resultMap="BaseResultMap">
        select
            m.inr inr,
            m.ptainr ptainr,
            m.CORTYP cortyp,
            m.CORADR coradr,
            m.AUTFLG autflg,
            m.autdet autdet,
            m.VER ver,
            m.ETYEXTKEY etyextkey
        from
            ptm m
        join pta a on
            m.ptainr = a.inr
        join pty y on
            a.ptyinr = y.inr
        where
            y.inr = #{ptyinr}
            <if test="cortyp != null and cortyp !=''">
                and m.CORTYP  = #{cortyp}
            </if>
            <if test="autflg != null and autflg !=''">
                and m.AUTFLG  = #{autflg}
            </if>
    </select>


</mapper>