MyBatisPlus中删除方法deletetById、deleteBatchIds、deleteByMap的使用
生活随笔
收集整理的這篇文章主要介紹了
MyBatisPlus中删除方法deletetById、deleteBatchIds、deleteByMap的使用
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
場景
項目搭建專欄:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/column/info/37194
基礎(chǔ)搭建:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/89407994
實現(xiàn)
deleteById
/**** 通用刪除操作? 通過ID刪除*/@Testpublic void testCommomDeleteById() {int result=employeeMapper.deleteById(8);System.out.println("*******************"+result);}deleteByMap
/**** 通用刪除操作 deleteByMap? map要寫列名條件 不能是實體屬性名*/@Testpublic 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進行刪除*/@Testpublic 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
總結(jié)
以上是生活随笔為你收集整理的MyBatisPlus中删除方法deletetById、deleteBatchIds、deleteByMap的使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MyBatisPlus查询方法selec
- 下一篇: SpringBoot+Thymeleaf