package cn.com.ty.lift.system.user.controller;

import cn.com.ty.lift.system.user.dao.entity.model.MenuRequest;
import cn.com.ty.lift.system.user.service.IMenuService;
import cn.com.xwy.boot.web.dto.RestResponse;
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;

/**
 * @author huangyuan
 * @date 2019-12-01
 * @description 菜单管理
 */
@RestController
@RequestMapping("/menu")
public class MenuController {

    @Resource
    private IMenuService menuService;

    /**
     * @param
     * @return
     * @description 获取所有菜单信息
     * @date 2019/11/27 10:03 AM
     */
    @RequestMapping("/all")
    public RestResponse all(@RequestBody MenuRequest menuRequest) {
        return menuService.all(menuRequest);
    }

    /**
     * @param menuRequest 菜单请求对象
     * @return
     * @description 获取当前企业的所有菜单
     * @date 2019/11/27 10:03 AM
     */
    @RequestMapping("/list")
    public RestResponse list(@RequestBody MenuRequest menuRequest) {
        return menuService.list(menuRequest);
    }

    /**
     * @description 给企业分配菜单
     * @date 2019/11/27 10:03 AM
     * @param menuRequest 菜单请求数据:
     * @return
     */
    @PostMapping("/companyMenu")
    public RestResponse companyMenu(@RequestBody MenuRequest menuRequest){
        return menuService.companyMenu(menuRequest);
    }

}
