mybatisPlus-删除测试

承接: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表:

posted @ 2022-03-31 14:14  从0开始丿  阅读(89)  评论(0编辑  收藏  举报