package com.css.simulation.resource.server.adapter.controller;

import api.common.pojo.common.ResponseBodyVO;
import api.common.pojo.vo.system.MenuVO;
import com.css.simulation.resource.server.app.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 菜单管理
 */
@RestController
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    private MenuService menuService;

    /**
     * 获取所有菜单树
     */
    @RequestMapping("/getMenuTree")
    public ResponseBodyVO<List<MenuVO>> getMenuTree() {
        ResponseBodyVO<List<MenuVO>> response = new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
        response.setInfo(menuService.getMenuTree());
        return response;
    }

    /**
     * 获取当前登录人的菜单列表
     */
    @RequestMapping("/getMyMenuTree")
    public ResponseBodyVO<List<MenuVO>> getMyMenuTree() {
        ResponseBodyVO<List<MenuVO>> response = new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
        response.setInfo(menuService.getMyMenuTree());
        return response;
    }
}
