前一篇写了批量查询,本篇主要写批量删除语句。如果有不明白sql语句中的字段意思,建议通过前一篇批量查询进行了解。
直接上代码:
sql语句的写法:
<select id = "XXX(方法名)" parameterType = "hashmap" >
delete from table(table写自己的表名称)
where
id in
<foreach collection="idList" item="item" index ="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
根据id批量删除数据