<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中取出的每一個條目