Fork me on GitEE

批量update语句优化

<update id="updateBatchNoticeEditTypeById"  parameterType="java.util.List">
update task_notice_setup
<trim prefix="set" suffixOverrides=",">
<trim prefix="notice_edit_type =case" suffix="end,">
<foreach collection="list" item="item" index="index">
when id=#{item.id} then #{item.noticeEditType}
</foreach>
</trim>
</trim>
where id in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
posted @ 2021-06-29 10:01  问道于盲  阅读(409)  评论(0编辑  收藏  举报