package com.bonus.canteen.core.menu.controller;

import com.bonus.canteen.core.menu.dto.MenuRecipeSortVo;
import com.bonus.canteen.core.menu.service.MenuRecipeBindSortService;
import com.bonus.common.core.web.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
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 javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping({"/menu/type/sort"})
public class MenuRecipeBindSortController {
   @Resource
   private MenuRecipeBindSortService menuRecipeBindSortService;

   @PostMapping({"/query"})
   @ApiOperation("获取类型排序功能")
   public AjaxResult querySort() {
      return AjaxResult.success(this.menuRecipeBindSortService.querySort());
   }

   @PostMapping({"/save"})
   @ApiOperation("保存类型排序功能")
   public AjaxResult saveSort(@RequestBody List<MenuRecipeSortVo> dto) {
      return AjaxResult.success(this.menuRecipeBindSortService.saveSort(dto));
   }
}
