传入
Integer[] studentlist
@Override
public Integer deleteAll(Integer[] studentlist) {
System.out.println("StudentDaoAll.deleteAll");
SqlSession sqlSession= MyBatisUtil.getSqlSession();
int count = sqlSession.delete("student.deleteAll",studentlist);
sqlSession.commit();
sqlSession.close();
return count;
}
当mybatis传入参数为list集合的时候;mybatis会自动把其封装为一个map;会以“list”作为key;每个元素的值作为value;格式为 Map<"list",value>
当mybatis传入参数为数组的时候mybatis会自动把其封装为一个map;会以“array”作为key;每个元素的值作为value;格式为Map<"array",value>
<delete id="deleteAll" >
DELETE FROM student
WHERE id IN
<foreach collection="array" open="(" item="id" close=")" separator=",">
#{id}
</foreach>
</delete>
参考Parameter 'ids' not found. Available parameters are [array]_aijian6549的博客-CSDN博客