<delete id="deleteByMsgIds">
DELETE FROM message
WHERE msg_id in
<trim suffixOverrides=" OR id IN ()">
<foreach item="item" index="index" collection="list"
open="(" close=")">
<if test="index != 0">
<choose>
<when test="index % 1000 == 999">) OR id IN (</when>
<otherwise>,</otherwise>
</choose>
</if>
#{item}
</foreach>
</trim>
</delete>
mybatis in超过1000报错解决方案
最新推荐文章于 2024-08-05 21:44:00 发布
本文探讨了在MyBatis中使用动态SQL批量删除大量数据的高效方法,通过巧妙利用foreach和trim元素,实现了对消息ID集合的智能处理,有效避免了因数据量过大而导致的性能瓶颈。
3624

被折叠的 条评论
为什么被折叠?



