<delete id="deleteBatchCollectionById">
delete from t_collection
<where>
uid=#{uid} and vid in
<foreach collection="vidArray" open="(" separator="," close=")" item="vid" >
#{vid}
</foreach>
</where>
</delete>
注:
<where>标签就相当于where
collection:存放集合的参数值,不需要加入#{}
open:拼接的sql代码以什么开头,可以加入其他元素,比如open="vid in (",体现了mybatis的灵活性
close:拼接的sql代码以什么结尾
item:从collection中取出的每一个条目