MCPcopy Create free account
hub / github.com/Easesgr/reggie / DishController

Class DishController

src/main/java/com/anyi/reggie/controller/DishController.java:31–130  ·  view source on GitHub ↗

菜品管理 前端控制器 @author anyi @since 2022-05-24

Source from the content-addressed store, hash-verified

29 * @since 2022-05-24
30 */
31@RestController
32@RequestMapping("/dish")
33public class DishController {
34
35 @Resource
36 private DishService dishService;
37 @Resource
38 private CategoryService categoryService;
39
40 @Resource
41 private DishFlavorService dishFlavorService;
42
43 /**
44 * 添加菜品
45 * @param dishDto
46 * @return
47 */
48 @PostMapping
49 public R addDish(@RequestBody DishDto dishDto){
50 dishService.addDish(dishDto);
51 return R.success("新增菜品成功!");
52 }
53
54 /**
55 * 分页查询菜单
56 * @param page
57 * @param pageSize
58 * @param name
59 * @return
60 */
61 @GetMapping("/page")
62 public R page(int page ,int pageSize , String name){
63 Page<DishDto> pageInfo = dishService.pageSearch(page,pageSize,name);
64 return R.success(pageInfo);
65 }
66
67
68 /**
69 * 根据id回显菜品信息
70 * @param id
71 * @return
72 */
73 @GetMapping("/{id}")
74 public R getDishById(@PathVariable Long id){
75 DishDto dishDto = dishService.getDishById(id);
76 return R.success(dishDto);
77 }
78
79 /**
80 * 修改菜品信息
81 * @param dishDto
82 * @return
83 */
84 @PutMapping
85 public R update(@RequestBody DishDto dishDto){
86 dishService.updateDish(dishDto);
87 return R.success("修改菜品成功!");
88 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected