没有发现mybatis的批量更新和插入,用for查询感觉很慢,又需要有这样的需求,
其他数据库查到一些,但是postgre没查到,恳求各位大神稍加指点

mybatis 批量进行插入更新,数据库为postgreSQL?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- 千寻啊千寻 2018-10-25 06:43关注
这么会没有批量更新呢?
<update id="updateBatch" parameterType="java.util.List"> update mydata_table set status= <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end"> when #{item.id} then #{item.status} </foreach> where id in <foreach collection="list" index="index" item="item" separator="," open="(" close=")"> #{item.id,jdbcType=BIGINT} </foreach> </update>
另外感觉mybatis plus 更好一些:http://mp.baomidou.com/
解决 1无用