EmployeeMapper.xml文件:注意里面的foreach进行取数组的值的写法
<!-- 批量删除员工信息 -->
<delete id="deleteByIds">
delete from employee
<if test="ids != null">
where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
</delete>
2、数据调用 ps:数组需要加注解
//根据多个id进行删除员工信息
//数组需要加注解
public int deleteByIds(@Param("ids") int[] ids);
3、测试: 方法调用
@Test
public void deleteByIds(){
int count = employeeMapper.deleteByIds(new int[]{3,4,5});
if(count > 0){
System.out.println("success");
}
}