dao接口:java
int batchDelete(List<String> ids);
mapping.xml:數組
<delete id="batchDelete" parameterType="java.util.List"> delete from test where test_id in <foreach collection="list" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach> </delete>
dao接口:app
int batchDelete(String[] ids);
mapping.xml:ide
<delete id="batchDelete" parameterType="java.lang.String"> delete from test where test_id in <foreach collection="array" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach> </delete>
請移步MyBatis多參數批量操做code