MyBatis 学习总结 (10) - 批量操作
最编程
2024-05-07 17:31:12
...
批量删除:
<delete id= "deleteBatchByXXX" parameterType= "list">
delete from 表名 where groupon_id in
<foreach collection="list" item= "item" index ="index"
open= "(" close =")" separator=",">
#{item}
</foreach >
</delete >
注意,foreach是循环,用来读取传入的list参数。批量处理是parameterType的类型必须要注意。foreach标签中的collection属性表示传入的是什么集合类型。item表示的是集合中的一个量类似于
List<String>list;
for(String str:list){
……
}
item就相当于str的作用,用来遍历collection。index就是集合的索引。open表示标签以什么开始,close表示标签以什么结束。seprator表示元素之间的间隔。
上一篇: 网站后门木马检查如何删除
下一篇: 短信删除的总结