Mybatis plus 常用删除方式
@Autowired private Test3Dao test3Dao; /** * 指定id删除 */ @Test public void testDeleteId(){ int result = test3Dao.deleteById(3); log.info("删除结果:{}",result); } /** * 指定集合id删除 */ @Test public void deleteBatchIds(){ int result = test3Dao.deleteBatchIds(Arrays.asList(1,2)); log.info("删除结果:{}",result); } /** * 根据的字段=值进行删除,可以写多个字段和值, 条件是and关系 * 比如: * DELETE FROM Test3 WHERE name = ? AND id = ? */ @Test public void deleteByMap(){ Map<String,Object> map = new HashMap<>(); map.put("name","boat1"); map.put("id",5); int result = test3Dao.deleteByMap(map); log.info("删除结果:{}",result); }