mybatisPlus-删除测试
user表:
1 根据id删除
src/main/java/com/lv/mybatis_plus/MybatisPlusApplication.java
//根据id删除
@Test
public void testDeleteById(){
userMapper.deleteById(1508697310695383043L);
}
user表:
2 通过多个id批量删除
src/main/java/com/lv/mybatis_plus/MybatisPlusApplication.java
//通过id批量删除
@Test
public void testDeleteBatchId(){
userMapper.deleteBatchIds(Arrays.asList(1508697310695383042L,1508697310695383041L));
}
user表:
3 通过条件删除
src/main/java/com/lv/mybatis_plus/MybatisPlusApplication.java
//通过条件删除 使用map
@Test
public void testDeleteMap(){
HashMap<String, Object> map = new HashMap<>();
map.put("name","醍醐镇");
userMapper.deleteByMap(map);
}
user表: