批量删除菜品
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.dto.DishDTO;
|
||||
import com.sky.dto.DishPageQueryDTO;
|
||||
import com.sky.result.PageResult;
|
||||
import com.sky.result.Result;
|
||||
import com.sky.service.DishService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/dish")
|
||||
@@ -22,13 +24,42 @@ public class DishController {
|
||||
|
||||
/**
|
||||
* 新增菜品
|
||||
*
|
||||
* @param dishDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public Result save(@RequestBody DishDTO dishDTO){
|
||||
log.info("新增菜品: {}",dishDTO);
|
||||
@ApiOperation("新增菜品")
|
||||
public Result save(@RequestBody DishDTO dishDTO) {
|
||||
log.info("新增菜品: {}", dishDTO);
|
||||
dishService.saveWithFlavor(dishDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜品分页查询
|
||||
*
|
||||
* @param pageQueryDTO
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("菜品分页查询")
|
||||
public Result<PageResult> page(DishPageQueryDTO pageQueryDTO) {
|
||||
log.info("菜品分页查询: {}", pageQueryDTO);
|
||||
PageResult pageResult = dishService.pageQuery(pageQueryDTO);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除菜品
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping
|
||||
@ApiOperation("批量删除菜品")
|
||||
public Result delete(@RequestParam List<Long> ids){
|
||||
log.info("批量删除菜品: {}",ids);
|
||||
dishService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user