wfemapper.xml 18.9 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 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
<?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.WfeMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Wfe">
        <result property="wfsinr" column="wfsinr" jdbcType="VARCHAR"/>
        <result property="wfssub" column="wfssub" jdbcType="VARCHAR"/>
        <result property="srv" column="srv" jdbcType="VARCHAR"/>
        <result property="sta" column="sta" jdbcType="VARCHAR"/>
        <result property="rtycnt" column="rtycnt" jdbcType="INTEGER"/>
        <result property="tardattim" column="tardattim" jdbcType="TIMESTAMP"/>
        <result property="ssninr" column="ssninr" jdbcType="VARCHAR"/>
        <result property="dattim" column="dattim" jdbcType="TIMESTAMP"/>
        <result property="txt" column="txt" jdbcType="VARCHAR"/>
        <result property="manflg" column="manflg" jdbcType="VARCHAR"/>
        <result property="opndur" column="opndur" jdbcType="NUMERIC"/>
        <result property="waidur" column="waidur" jdbcType="NUMERIC"/>
        <result property="retdur" column="retdur" jdbcType="NUMERIC"/>
        <result property="hdldur" column="hdldur" jdbcType="NUMERIC"/>
        <result property="bchkeyinr" column="bchkeyinr" jdbcType="VARCHAR"/>
        <result property="txt2" column="txt2" jdbcType="VARCHAR"/>
        <result property="itfinr" column="itfinr" jdbcType="VARCHAR"/>
        <result property="intdat" column="intdat" jdbcType="TIMESTAMP"/>
        <result property="interftxt" column="interftxt" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        wfsinr,wfssub,srv,sta,rtycnt,tardattim,ssninr,dattim,txt,manflg,opndur,waidur,retdur,hdldur,bchkeyinr,txt2,itfinr,intdat,interftxt
    </sql>

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

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

    <insert id="insert">
        insert into wfe (<include refid="Base_Column_List"/>)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{wfsinr,jdbcType=VARCHAR},
            #{wfssub,jdbcType=VARCHAR},
            #{srv,jdbcType=VARCHAR},
            #{sta,jdbcType=VARCHAR},
            #{rtycnt,jdbcType=INTEGER},
            #{tardattim,jdbcType=TIMESTAMP},
            #{ssninr,jdbcType=VARCHAR},
            #{dattim,jdbcType=TIMESTAMP},
            #{txt,jdbcType=VARCHAR},
            #{manflg,jdbcType=VARCHAR},
            #{opndur,jdbcType=NUMERIC},
            #{waidur,jdbcType=NUMERIC},
            #{retdur,jdbcType=NUMERIC},
            #{hdldur,jdbcType=NUMERIC},
            #{bchkeyinr,jdbcType=VARCHAR},
            #{txt2,jdbcType=VARCHAR},
            #{itfinr,jdbcType=VARCHAR},
            #{intdat,jdbcType=TIMESTAMP},
            #{interftxt,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into wfe
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="wfsinr != null">wfsinr,</if>
            <if test="wfssub != null">wfssub,</if>
            <if test="srv != null">srv,</if>
            <if test="sta != null">sta,</if>
            <if test="rtycnt != null">rtycnt,</if>
            <if test="tardattim != null">tardattim,</if>
            <if test="ssninr != null">ssninr,</if>
            <if test="dattim != null">dattim,</if>
            <if test="txt != null">txt,</if>
            <if test="manflg != null">manflg,</if>
            <if test="opndur != null">opndur,</if>
            <if test="waidur != null">waidur,</if>
            <if test="retdur != null">retdur,</if>
            <if test="hdldur != null">hdldur,</if>
            <if test="bchkeyinr != null">bchkeyinr,</if>
            <if test="txt2 != null">txt2,</if>
            <if test="itfinr != null">itfinr,</if>
            <if test="intdat != null">intdat,</if>
            <if test="interftxt != null">interftxt,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="wfsinr != null">#{wfsinr,jdbcType=VARCHAR},</if>
            <if test="wfssub != null">#{wfssub,jdbcType=VARCHAR},</if>
            <if test="srv != null">#{srv,jdbcType=VARCHAR},</if>
            <if test="sta != null">#{sta,jdbcType=VARCHAR},</if>
            <if test="rtycnt != null">#{rtycnt,jdbcType=INTEGER},</if>
            <if test="tardattim != null">#{tardattim,jdbcType=TIMESTAMP},</if>
            <if test="ssninr != null">#{ssninr,jdbcType=VARCHAR},</if>
            <if test="dattim != null">#{dattim,jdbcType=TIMESTAMP},</if>
            <if test="txt != null">#{txt,jdbcType=VARCHAR},</if>
            <if test="manflg != null">#{manflg,jdbcType=VARCHAR},</if>
            <if test="opndur != null">#{opndur,jdbcType=NUMERIC},</if>
            <if test="waidur != null">#{waidur,jdbcType=NUMERIC},</if>
            <if test="retdur != null">#{retdur,jdbcType=NUMERIC},</if>
            <if test="hdldur != null">#{hdldur,jdbcType=NUMERIC},</if>
            <if test="bchkeyinr != null">#{bchkeyinr,jdbcType=VARCHAR},</if>
            <if test="txt2 != null">#{txt2,jdbcType=VARCHAR},</if>
            <if test="itfinr != null">#{itfinr,jdbcType=VARCHAR},</if>
            <if test="intdat != null">#{intdat,jdbcType=TIMESTAMP},</if>
            <if test="interftxt != null">#{interftxt,jdbcType=VARCHAR},</if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update wfe
        <set>
            <if test="wfsinr != null">wfsinr = #{wfsinr,jdbcType=VARCHAR},</if>
            <if test="wfssub != null">wfssub = #{wfssub,jdbcType=VARCHAR},</if>
            <if test="srv != null">srv = #{srv,jdbcType=VARCHAR},</if>
            <if test="sta != null">sta = #{sta,jdbcType=VARCHAR},</if>
            <if test="rtycnt != null">rtycnt = #{rtycnt,jdbcType=INTEGER},</if>
            <if test="tardattim != null">tardattim = #{tardattim,jdbcType=TIMESTAMP},</if>
            <if test="ssninr != null">ssninr = #{ssninr,jdbcType=VARCHAR},</if>
            <if test="dattim != null">dattim = #{dattim,jdbcType=TIMESTAMP},</if>
            <if test="txt != null">txt = #{txt,jdbcType=VARCHAR},</if>
            <if test="manflg != null">manflg = #{manflg,jdbcType=VARCHAR},</if>
            <if test="opndur != null">opndur = #{opndur,jdbcType=NUMERIC},</if>
            <if test="waidur != null">waidur = #{waidur,jdbcType=NUMERIC},</if>
            <if test="retdur != null">retdur = #{retdur,jdbcType=NUMERIC},</if>
            <if test="hdldur != null">hdldur = #{hdldur,jdbcType=NUMERIC},</if>
            <if test="bchkeyinr != null">bchkeyinr = #{bchkeyinr,jdbcType=VARCHAR},</if>
            <if test="txt2 != null">txt2 = #{txt2,jdbcType=VARCHAR},</if>
            <if test="itfinr != null">itfinr = #{itfinr,jdbcType=VARCHAR},</if>
            <if test="intdat != null">intdat = #{intdat,jdbcType=TIMESTAMP},</if>
            <if test="interftxt != null">interftxt = #{interftxt,jdbcType=VARCHAR},</if>
        </set>
        where id = #{id,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update wfe
        <set>
            wfsinr = #{wfsinr,jdbcType=VARCHAR},
            wfssub = #{wfssub,jdbcType=VARCHAR},
            srv = #{srv,jdbcType=VARCHAR},
            sta = #{sta,jdbcType=VARCHAR},
            rtycnt = #{rtycnt,jdbcType=INTEGER},
            tardattim = #{tardattim,jdbcType=TIMESTAMP},
            ssninr = #{ssninr,jdbcType=VARCHAR},
            dattim = #{dattim,jdbcType=TIMESTAMP},
            txt = #{txt,jdbcType=VARCHAR},
            manflg = #{manflg,jdbcType=VARCHAR},
            opndur = #{opndur,jdbcType=NUMERIC},
            waidur = #{waidur,jdbcType=NUMERIC},
            retdur = #{retdur,jdbcType=NUMERIC},
            hdldur = #{hdldur,jdbcType=NUMERIC},
            bchkeyinr = #{bchkeyinr,jdbcType=VARCHAR},
            txt2 = #{txt2,jdbcType=VARCHAR},
            itfinr = #{itfinr,jdbcType=VARCHAR},
            intdat = #{intdat,jdbcType=TIMESTAMP},
            interftxt = #{interftxt,jdbcType=VARCHAR},
        </set>
        where WFSINR = #{wfsinr,jdbcType=VARCHAR}
        and WFSSUB = #{wfssub,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 wfe
        <set>
            <if test="module.wfsinr != null">wfsinr = #{module.wfsinr,jdbcType=VARCHAR},</if>
            <if test="module.wfssub != null">wfssub = #{module.wfssub,jdbcType=VARCHAR},</if>
            <if test="module.srv != null">srv = #{module.srv,jdbcType=VARCHAR},</if>
            <if test="module.sta != null">sta = #{module.sta,jdbcType=VARCHAR},</if>
            <if test="module.rtycnt != null">rtycnt = #{module.rtycnt,jdbcType=INTEGER},</if>
            <if test="module.tardattim != null">tardattim = #{module.tardattim,jdbcType=TIMESTAMP},</if>
            <if test="module.ssninr != null">ssninr = #{module.ssninr,jdbcType=VARCHAR},</if>
            <if test="module.dattim != null">dattim = #{module.dattim,jdbcType=TIMESTAMP},</if>
            <if test="module.txt != null">txt = #{module.txt,jdbcType=VARCHAR},</if>
            <if test="module.manflg != null">manflg = #{module.manflg,jdbcType=VARCHAR},</if>
            <if test="module.opndur != null">opndur = #{module.opndur,jdbcType=NUMERIC},</if>
            <if test="module.waidur != null">waidur = #{module.waidur,jdbcType=NUMERIC},</if>
            <if test="module.retdur != null">retdur = #{module.retdur,jdbcType=NUMERIC},</if>
            <if test="module.hdldur != null">hdldur = #{module.hdldur,jdbcType=NUMERIC},</if>
            <if test="module.bchkeyinr != null">bchkeyinr = #{module.bchkeyinr,jdbcType=VARCHAR},</if>
            <if test="module.txt2 != null">txt2 = #{module.txt2,jdbcType=VARCHAR},</if>
            <if test="module.itfinr != null">itfinr = #{module.itfinr,jdbcType=VARCHAR},</if>
            <if test="module.intdat != null">intdat = #{module.intdat,jdbcType=TIMESTAMP},</if>
            <if test="module.interftxt != null">interftxt = #{module.interftxt,jdbcType=VARCHAR},</if>
        </set>
        ${conditions}
    </update>

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

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

    <select id="getWfeByWfsinrAndSrv" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe
        where wfsinr = #{wfsinr,jdbcType=VARCHAR}
        and srv = #{srv,jdbcType=VARCHAR}
    </select>

    <select id="selectSendEro" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe
        where srv = 'ERO'
        and sta in ('W', 'R')
    </select>

    <update id="updateByVo">
        update wfe
        set sta = #{sta,jdbcType=VARCHAR},
            rtycnt = #{rtycnt,jdbcType=NUMERIC},
            txt = #{txt,jdbcType=VARCHAR},
            dattim = #{dattim, jdbcType=TIMESTAMP},
            opndur = #{opndur,jdbcType=NUMERIC},
            waidur = #{waidur,jdbcType=NUMERIC},
            retdur = #{retdur,jdbcType=NUMERIC}
        where wfsinr = #{wfsinr,jdbcType=VARCHAR}
          and wfssub = #{wfssub,jdbcType=VARCHAR}
    </update>

    <select id="queryById" resultType="com.brilliance.isc.vo.manager.WfeVo">
       SELECT TRN.INR, WFE.WFSINR,WFE.WFSSUB,WFE.WFSSUB DESCRIPE,WFE.STA,WFE.DATTIM,WFE.RTYCNT,WFE.TXT FROM WFE,WFS ,TRN
            WHERE WFE.WFSINR = WFS.INR AND WFS.OBJTYP = 'TRN' AND WFS.OBJINR = TRN.INR AND TRN.INR = #{inr}
            ORDER BY WFE.DATTIM
    </select>

    <!--通过主键修改数据-->
    <update id="update">
        update WFE
        set STA = #{sta}
        where WFSSUB = #{wfssub} AND WFSINR = #{wfsinr}
    </update>

    <select id="queryByInr" resultType="com.brilliance.isc.vo.manager.WfeVo">
       select WFSINR,WFSSUB,WFSSUB DESCRIPE,STA,DATTIM,RTYCNT,TXT FROM WFE
            where WFSSUB = #{wfssub} AND WFSINR = #{wfsinr}
    </select>

    <select id="selectByWfsinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe
        where
        wfsinr = #{wfsinr,jdbcType=VARCHAR}
        order by id asc
    </select>

    <select id="selectByTrninr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe
        where  wfsinr = (select  inr from wfs where objtyp='TRN' and objinr= #{trninr,jdbcType=VARCHAR} )
        and SRV not IN('FIN','PDP','SWT','EJS','PDA')
        and STA in('W','E')
        order by id asc
    </select>
    <select id="selectAllByTrninr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe
        where  wfsinr = (select  inr from wfs where objtyp='TRN' and objinr= #{trninr,jdbcType=VARCHAR} )
        order by id asc
    </select>
    <select id="selectBySrvAndWfsinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe
        where
        srv = #{srv,jdbcType=VARCHAR}
        AND wfsinr = (select  inr from wfs where objtyp='TRN' and objinr= #{trninr,jdbcType=VARCHAR} )
    </select>
    <select id="selectByWfssubAndWfsinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe
        where
        wfssub = #{wfssub,jdbcType=VARCHAR}
        AND wfsinr = (select  inr from wfs where objtyp='TRN' and objinr= #{trninr,jdbcType=VARCHAR} )
    </select>
    <select id="gerWfeByWfsinrAndTrn" resultMap="BaseResultMap">
        select
        ITFINR
        from WFE
        where
        SRV = #{srv,jdbcType=VARCHAR}
        and WFSINR in(
        select
        INR
        from
        WFS
        where
        OBJINR in(
        select INR
        from
        TRN
        where
        OWNREF = #{ownref,jdbcType=VARCHAR}
        and INIFRM =#{inifrm,jdbcType=VARCHAR}
        <if test="relflg != null">
            and RELFLG = #{relflg,jdbcType=VARCHAR}
        </if>
        )
        )
        limit 1
    </select>
    <select id="selectByTrninrAndSta" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe
        where  wfsinr = (select  inr from wfs where objtyp='TRN' and objinr= #{trninr,jdbcType=VARCHAR} )
        and SRV not IN('FIN','PDP','SWT','PDA')
        and STA= #{sta,jdbcType=VARCHAR}
        order by id asc
    </select>

    <select id="selectByTrninrForRollback" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe
        where  wfsinr = (select  inr from wfs where objtyp='TRN' and objinr= #{trninr,jdbcType=VARCHAR} )
        and SRV not IN('FIN','PDP','SWT','PDA','LMA')
        and STA= 'D'
        order by id desc
    </select>

    <select id="selectByTrninrForRepair" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe
        where  wfsinr = (select  inr from wfs where objtyp='TRN' and objinr= #{trninr,jdbcType=VARCHAR} )
        and SRV not IN('FIN','PDP','SWT','PDA')
        and STA= 'D'
        order by id desc
    </select>

    <select id="selectCountByTrninr" resultType="int">
        select count(1) from wfe where srv in ('LMA','LMC')
            and wfsinr=(select wfs.inr from wfs where objtyp='TRN'
            and objinr= #{trninr,jdbcType=VARCHAR} )
    </select>

    <select id="queryNoExecuteWithoutFin" resultType="int">
        select count(1) from wfe
        where wfsinr = #{wfsinr,jdbcType=VARCHAR}
        and SRV != 'FIN'
        and STA in ('W', 'O', 'R')
    </select>

    <select id="queryByConditionList" resultType="com.brilliance.isc.vo.component.wfe.WfeInfo">
        select
        w.*,t.inifrm,t.ownref,t.relcur,t.relamt,
        t.inidattim,t.relreq,t.relres,t.iniusr,t.relflg
        from wfe w ,wfs s
        right join trn t on t.inr=s.objinr
        <if test="ownref != null and ownref != ''">
            and t.ownref= #{ownref}
        </if>
        <if test="relflg != null and relflg != ''">
            and t.relflg= #{relflg}
        </if>
        <if test="inifrm != null and inifrm != ''">
            and t.inifrm= #{inifrm}
        </if>
        <where>
            w.wfsinr=s.inr
            <if test="wfsinr != null and wfsinr != ''">
                and w.WFSINR = #{wfsinr}
            </if>
            <if test="wfssub != null and wfssub != ''">
                and w.WFSSUB = #{wfssub}
            </if>
            <if test="srv != null and srv != ''">
                and w.SRV = #{srv}
            </if>
            <foreach collection="staList" index="index" item="items" open="AND (" separator="OR"  close=")">
                 w.STA = #{items}
            </foreach>
            <if test="txt != null and txt != ''">
                and w.TXT = #{txt}
            </if>
            <if test="bchkeyinr != null and bchkeyinr != ''">
                and w.BCHKEYINR = #{bchkeyinr}
            </if>
            <if test="itfinr != null and itfinr != ''">
                and w.ITFINR = #{itfinr}
            </if>
            <if test="inidatfro != null and inidatfro.length() > 0">
                and w.dattim <![CDATA[ >= ]]> #{inidatfro}
            </if>
            <if test="inidattil != null and inidattil.length() > 0">
                and w.dattim <![CDATA[ <= ]]> #{inidattil}
            </if>
        </where>
        order by w.ID desc
    </select>
    <select id="selectById" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>,id
        from wfe
        where
        id = #{id,jdbcType=VARCHAR}
    </select>
    <update id="updateStaById">
        update wfe
        set sta = #{sta,jdbcType=VARCHAR}
        where id = #{id,jdbcType=VARCHAR}
    </update>

    <select id="selectSrvByWfsinr" resultType="string">
        select srv from wfe
         where wfsinr = #{wfsinr,jdbcType=VARCHAR}
    </select>


    <update id="updateStaByWfsinrSrv">
        update wfe
        set sta = #{sta,jdbcType=VARCHAR}
        where wfsinr = #{wfsinr,jdbcType=VARCHAR}
        and srv = #{srv,jdbcType=VARCHAR}
    </update>

    <update id="updateStaByTrninr">
        update wfe
        set sta = #{sta,jdbcType=VARCHAR}
        where WFSINR=(select INR from WFS where OBJINR=#{trninr,jdbcType=VARCHAR} and OBJTYP='TRN')
        and srv!='LMA' and sta='D'
    </update>

    <update id="updateStaBySrvAndTrninr">
        update wfe
        set sta = #{sta,jdbcType=VARCHAR}
        where srv = #{srv,jdbcType=VARCHAR}
          AND WFSINR=(select INR from WFS where OBJINR=#{trninr,jdbcType=VARCHAR} and OBJTYP='TRN')
    </update>

    <select id="selectWfeInfoByTrninrAndSrv" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from wfe where trninr = #{trninr,jdbcType=VARCHAR} and srv = #{srv,jdbcType=VARCHAR}

    </select>

</mapper>