进阶之路002 增删改查/数据导入导出之删除功能
Controller层
/**
* 删除
*/
@ResponseBody
@RequestMapping("/delete")
@RequiresPermissions("xxxx:detail:delete")
public R delete(@RequestBody Integer[] ids){
detailService.removeByIds(Arrays.asList(ids));
return R.ok();
}
//Service接口
boolean removeByIds(Collection<? extends Serializable> idList);
//接口实现类
//baseMapper中已经设置好了权限分配(框架自带)
@Override
public boolean removeByIds(Collection<? extends Serializable> idList) {
return SqlHelper.retBool(baseMapper.deleteBatchIds(idList));
}
//dao层
//批量删除
int deleteBatchIds(@Param(Constants.COLLECTION) Collection<? extends Serializable> idList);