MyBatisPlus中删除方法deletetById、deleteBatchIds、deleteByMap的使用
场景项目搭建专栏:https://blog.csdn.net/BADAO_LIUMANG_QIZHI/column/info/37194基础搭建:https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/89407994实现deleteById/**** 通用删除操作 通过ID删除*/@Tes...
·
场景
项目搭建专栏:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/column/info/37194
基础搭建:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/89407994
实现
deleteById
/***
* 通用删除操作 通过ID删除
*/
@Test
public void testCommomDeleteById() {
int result=employeeMapper.deleteById(8);
System.out.println("*******************"+result);
}
deleteByMap
/***
* 通用删除操作 deleteByMap map要写列名条件 不能是实体属性名
*/
@Test
public void testCommomDeleteByMap() {
Map<String, Object> columnMap = new HashMap<String, Object>();
columnMap.put("name", "更新测试成功");
columnMap.put("gender", "1");
int result=employeeMapper.deleteByMap(columnMap);
System.out.println("*******************"+result);
}
deleteBatchIds
/***
* 通用查询操作 deleteBatchIds 通过多个ID进行删除
*/
@Test
public void testCommomDeleteBatchIds() {
List<Integer> idList = new ArrayList<Integer>();
idList.add(5);
idList.add(6);
int result=employeeMapper.deleteBatchIds(idList);
System.out.println("*******************"+result);
}
源码下载
https://download.csdn.net/download/badao_liumang_qizhi/11133892
更多推荐
所有评论(0)