mybatis merge 语句使用

<update id="saveRechousecode" parameterType="net.hlj.ownership.bean.Rechousecode" >
  	merge into TBWKRECHOUSECODE t
  	using ( select #{fid} as fid from dual) t1
  	on(t.fid = t1.fid)
  	when not matched then
    insert 
    <trim prefix="(" suffix=")" suffixOverrides="," >
        FID,
      <if test="optypenum != null" >
        OPTYPENUM,
      </if>
      <if test="recyear != null" >
        RECYEAR,
      </if>
      <if test="recnum != null" >
        RECNUM,
      </if>
      <if test="housecode != null" >
        HOUSECODE,
      </if>
      <if test="wxjjnum != null" >
        WXJJNUM,
      </if>
      <if test="districtnum != null" >
        DISTRICTNUM,
      </if>
      <if test="streetnum != null" >
        STREETNUM,
      </if>
      <if test="prjnum != null" >
        PRJNUM,
      </if>
      <if test="buildnum != null" >
        BUILDNUM,
      </if>
      <if test="unitnum != null" >
        UNITNUM,
      </if>
      <if test="floornum != null" >
        FLOORNUM,
      </if>
      <if test="doornum != null" >
        DOORNUM,
      </if>
      <if test="housesignnum != null" >
        HOUSESIGNNUM,
      </if>
      <if test="deratemode != null" >
        DERATEMODE,
      </if>
      <if test="deratescale != null" >
        DERATESCALE,
      </if>
      <if test="deratemoney != null" >
        DERATEMONEY,
      </if>
      <if test="feefactval != null" >
        FEEFACTVAL,
      </if>
      <if test="feecalcval != null" >
        FEECALCVAL,
      </if>
      <if test="feememo != null" >
        FEEMEMO,
      </if>
      <if test="postpondaccept != null" >
        POSTPONDACCEPT,
      </if>
      <if test="oldsitnumgather != null" >
        OLDSITNUMGATHER,
      </if>
      <if test="feestand != null" >
        FEESTAND,
      </if>
      <if test="districtcode != null" >
        DISTRICTCODE,
      </if>
      <if test="mtfchargecode != null" >
        MTFCHARGECODE,
      </if>
      <if test="recnumgather != null" >
        RECNUMGATHER,
      </if>
      <if test="hid != null" >
        HID,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
        uf_getfid(SEQ_TBWKRECHOUSECODE.nextval),
      <if test="optypenum != null" >
         #{optypenum,jdbcType=DECIMAL},
      </if>
      <if test="recyear != null" >
         #{recyear,jdbcType=DECIMAL},
      </if>
      <if test="recnum != null" >
         #{recnum,jdbcType=DECIMAL},
      </if>
      <if test="housecode != null" >
         #{housecode,jdbcType=VARCHAR},
      </if>
      <if test="wxjjnum != null" >
        #{wxjjnum,jdbcType=VARCHAR},
      </if>
      <if test="districtnum != null" >
        #{districtnum,jdbcType=VARCHAR},
      </if>
      <if test="streetnum != null" >
         #{streetnum,jdbcType=VARCHAR},
      </if>
      <if test="prjnum != null" >
         #{prjnum,jdbcType=VARCHAR},
      </if>
      <if test="buildnum != null" >
        #{buildnum,jdbcType=VARCHAR},
      </if>
      <if test="unitnum != null" >
         #{unitnum,jdbcType=VARCHAR},
      </if>
      <if test="floornum != null" >
         #{floornum,jdbcType=VARCHAR},
      </if>
      <if test="doornum != null" >
         #{doornum,jdbcType=VARCHAR},
      </if>
      <if test="housesignnum != null" >
         #{housesignnum,jdbcType=VARCHAR},
      </if>
      <if test="deratemode != null" >
        #{deratemode,jdbcType=DECIMAL},
      </if>
      <if test="deratescale != null" >
        #{deratescale,jdbcType=DECIMAL},
      </if>
      <if test="deratemoney != null" >
        #{deratemoney,jdbcType=DECIMAL},
      </if>
      <if test="feefactval != null" >
        #{feefactval,jdbcType=DECIMAL},
      </if>
      <if test="feecalcval != null" >
        #{feecalcval,jdbcType=DECIMAL},
      </if>
      <if test="feememo != null" >
         #{feememo,jdbcType=VARCHAR},
      </if>
      <if test="postpondaccept != null" >
        #{postpondaccept,jdbcType=DECIMAL},
      </if>
      <if test="oldsitnumgather != null" >
        #{oldsitnumgather,jdbcType=VARCHAR},
      </if>
      <if test="feestand != null" >
        #{feestand,jdbcType=DECIMAL},
      </if>
      <if test="districtcode != null" >
        #{districtcode,jdbcType=DECIMAL},
      </if>
      <if test="mtfchargecode != null" >
       #{mtfchargecode,jdbcType=VARCHAR} ,
      </if>
      <if test="recnumgather != null" >
        #{recnumgather,jdbcType=VARCHAR},
      </if>
      <if test="hid != null" >
        #{hid,jdbcType=DECIMAL},
      </if>
    </trim>
    when matched then
    update
    <set >
      <if test="optypenum != null" >
         optypenum=#{optypenum,jdbcType=DECIMAL},
      </if>
      <if test="recyear != null" >
         recyear=#{recyear,jdbcType=DECIMAL},
      </if>
      <if test="recnum != null" >
         recnum=#{recnum,jdbcType=DECIMAL},
      </if>
      <if test="housecode != null" >
        housecode=#{housecode,jdbcType=VARCHAR},
      </if>
      <if test="wxjjnum != null" >
        wxjjnum=#{wxjjnum,jdbcType=VARCHAR},
      </if>
      <if test="districtnum != null" >
        districtnum=#{districtnum,jdbcType=VARCHAR},
      </if>
      <if test="streetnum != null" >
         streetnum=#{streetnum,jdbcType=VARCHAR},
      </if>
      <if test="prjnum != null" >
        prjnum=#{prjnum,jdbcType=VARCHAR},
      </if>
      <if test="buildnum != null" >
        buildnum=#{buildnum,jdbcType=VARCHAR},
      </if>
      <if test="unitnum != null" >
         unitnum=#{unitnum,jdbcType=VARCHAR},
      </if>
      <if test="floornum != null" >
         floornum=#{floornum,jdbcType=VARCHAR},
      </if>
      <if test="doornum != null" >
         doornum=#{doornum,jdbcType=VARCHAR},
      </if>
      <if test="housesignnum != null" >
         housesignnum=#{housesignnum,jdbcType=VARCHAR},
      </if>
      <if test="deratemode != null" >
        deratemode=#{deratemode,jdbcType=DECIMAL},
      </if>
      <if test="deratescale != null" >
        deratescale=#{deratescale,jdbcType=DECIMAL},
      </if>
      <if test="deratemoney != null" >
        deratemoney=#{deratemoney,jdbcType=DECIMAL},
      </if>
      <if test="feefactval != null" >
        feefactval=#{feefactval,jdbcType=DECIMAL},
      </if>
      <if test="feecalcval != null" >
        feecalcval=#{feecalcval,jdbcType=DECIMAL},
      </if>
      <if test="feememo != null" >
         feememo=#{feememo,jdbcType=VARCHAR},
      </if>
      <if test="postpondaccept != null" >
        postpondaccept=#{postpondaccept,jdbcType=DECIMAL},
      </if>
      <if test="oldsitnumgather != null" >
        oldsitnumgather=#{oldsitnumgather,jdbcType=VARCHAR},
      </if>
      <if test="feestand != null" >
        feestand=#{feestand,jdbcType=DECIMAL},
      </if>
      <if test="districtcode != null" >
        districtcode=#{districtcode,jdbcType=DECIMAL},
      </if>
      <if test="mtfchargecode != null" >
       mtfchargecode=#{mtfchargecode,jdbcType=VARCHAR} ,
      </if>
      <if test="recnumgather != null" >
        recnumgather=#{recnumgather,jdbcType=VARCHAR},
      </if>
      <if test="hid != null" >
        hid=#{hid,jdbcType=DECIMAL},
      </if>
    </set>
    where FID = #{fid,jdbcType=DECIMAL}
  </update>

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值