package com.nmgs.controller;

import com.nmgs.config.ResultData;
import com.nmgs.service.UserTableService;
import com.nmgs.service.impl.SerivceAreaOperationMealServiceImpl;
import com.nmgs.util.PubTools;
import com.nmgs.util.WebsocketUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("serviceMeal")
@Api(tags="商户套餐信息操作")
public class ServiceMealController {

    public SerivceAreaOperationMealServiceImpl serivceAreaOperationMealServiceImpl;
    @Autowired
    public void setSerivceAreaOperationMealServiceImpl(SerivceAreaOperationMealServiceImpl serivceAreaOperationMealServiceImpl) {
        this.serivceAreaOperationMealServiceImpl = serivceAreaOperationMealServiceImpl;
    }

    @RequestMapping(value = "getMealInfoById",
            method = {RequestMethod.POST}
    )
    @ApiOperation(value="根据套餐ID获取套餐信息",httpMethod = "POST")
    public ResultData<List> getMealInfoById(@RequestParam("mealId") String mealId){
        List userByOpenId = serivceAreaOperationMealServiceImpl.getMealInfoById(mealId);
        if(userByOpenId ==null){
            return ResultData.fail("查询失败");
        }else if(userByOpenId !=null){
            return ResultData.success("查询成功",userByOpenId,userByOpenId.size());
        }
        return ResultData.success(1,"查询成功");
    }
}
