批量删除 修改
@PostMapping("/status/{status}")
public R<String> status(@PathVariable int status,@RequestParam List<Long> ids){
Dish dish = new Dish();
LambdaQueryWrapper<Dish> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(Dish::getId,ids);
dish.setStatus(status);
dishService.update(dish,queryWrapper);
return R.success("修改成功");
}
@DeleteMapping
@Transactional
public R<String> delete(@RequestParam List<Long> ids){
LambdaQueryWrapper<DishFlavor> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.in(DishFlavor::getDishId,ids);
dishFlavorService.remove(queryWrapper);
for (Long id : ids) {
dishService.removeById(id) ;
}
return R.success("删除成功");
}