mybatis批量删除
mapper接口
public void deleteUser(@Param("ids") String ids);
mapper.xml
<delete id="deleteUser"> delete from t_user where id in (${ids}) </delete>
测试代码
@Test public void deleteUser(){ SqlSession sqlSession = SqlSessionUtil.getSqlSession(); UserMapper mapper = sqlSession.getMapper(UserMapper.class); mapper.deleteUser("3,4"); sqlSession.close(); }