xuhy
2024-08-27 96483f10fdb66727c3767826fcec6c99958e74b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package com.ruoyi.web.controller.api;
 
 
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.TGoodsType;
import com.ruoyi.system.domain.TOrderMeal;
import com.ruoyi.system.dto.AddDishDTO;
import com.ruoyi.system.dto.CheckoutDTO;
import com.ruoyi.system.dto.OrderMealGeneratorDTO;
import com.ruoyi.system.dto.TOrderMealDTO;
import com.ruoyi.system.service.TGoodsTypeService;
import com.ruoyi.system.service.TOrderMealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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 java.util.List;
 
/**
 * <p>
 * 餐饮订单 前端控制器
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-14
 */
@Api(tags = "餐饮")
@RestController
@RequestMapping("/t-order-meal")
public class TOrderMealController {
 
    private final TOrderMealService orderMealService;
 
    @Autowired
    public TOrderMealController(TOrderMealService orderMealService) {
        this.orderMealService = orderMealService;
    }
 
    /**
     * 查询餐饮列表
     */
//    @ApiOperation( value = "查询餐饮列表")
//    @PostMapping(value = "/list")
//    public AjaxResult<List<TOrderMeal>> list() {
//        return AjaxResult.success(orderMealService.list());
//    }
 
    /**
     * 添加餐饮管理
     */
    @ApiOperation( value = "开台-点菜接口")
    @PostMapping(value = "/add")
    public AjaxResult<Integer> add(@RequestBody TOrderMealDTO dto) {
        orderMealService.add(dto);
        return AjaxResult.success(dto.getId());
    }
 
    @ApiOperation( value = "加菜接口")
    @PostMapping(value = "/addDish")
    public AjaxResult<String> addDish(@Validated @RequestBody AddDishDTO dto) {
        orderMealService.addDish(dto);
        return AjaxResult.success();
    }
 
    @ApiOperation( value = "结账接口")
    @PostMapping(value = "/checkout")
    public AjaxResult<String> checkout(@Validated @RequestBody CheckoutDTO dto) {
        orderMealService.checkout(dto);
        return AjaxResult.success();
    }
 
}