Mybatis在oracle批量更新

最近公司业务中为了提高效率要做mybatis批量更新,但是到了oracle数据库中做了好几次都没成功,后来发现mybatis最后少了个分号,可能是Mybatis内部做了异常try  catche  处理,导致控制台没有报错信息。在此仅做小记。

 

Mapper文件中的方法定义如下:

public int updateCreditStatuslist(List<UserCreditStatus> list);

 

Mapper.xml文件的实现如下:(creditStatus是对象内部的成员,id是对象内部的一个对象)

<update id="updateCreditStatuslist" parameterType="java.util.List">


<foreach collection="list" item="item" index="index" separator=";">
  update XB_CREDIT_STATUS_P
  set
  CREDIT_STATUS=#{item.creditStatus}, CREDIT_TIME=#{item.creditTime}


  where subsid=#{item.id.subsId} and OPERATIONID=#{item.id.operationId}
  and
  SUB_OPERATIONID=#{item.id.subOperation}
</foreach>
  ;  <!--注意红色的分号,不加就不会批量更新,并且不会报错。。。。-->

</update>

 

posted @ 2017-06-15 11:41  Think-007  阅读(580)  评论(0编辑  收藏  举报