//
namespace SafeCampus.Web.Core;
///
/// 菜单管理控制器
///
[ApiDescriptionSettings(Tag = "菜单管理")]
[Route("sys/limit/[controller]")]
[SuperAdmin]
public class MenuController : BaseController
{
private readonly IMenuService _menuService;
private readonly IResourceService _resourceService;
public MenuController(IMenuService menuService, IResourceService resourceService)
{
_menuService = menuService;
_resourceService = resourceService;
}
///
/// 模块选择
///
///
[HttpGet("moduleSelector")]
public async Task ModuleSelector()
{
return await _resourceService.GetListByCategory(CateGoryConst.RESOURCE_MODULE);
}
///
/// 获取菜单树
///
///
[HttpGet("tree")]
public async Task Tree([FromQuery] MenuTreeInput input)
{
return await _menuService.Tree(input);
}
///
/// 获取菜单树选择器
///
///
[HttpGet("menuTreeSelector")]
public async Task MenuTreeSelector([FromQuery] MenuTreeInput input)
{
if (input.Module != null)
{
return await _menuService.Tree(input, false);
}
else
{
return await _menuService.ShortcutTree();
}
}
///
/// 添加菜单
///
///
///
[HttpPost("add")]
[DisplayName("添加菜单")]
public async Task Add([FromBody] MenuAddInput input)
{
await _menuService.Add(input);
}
///
/// 编辑菜单
///
///
///
[HttpPost("edit")]
[DisplayName("编辑菜单")]
public async Task Edit([FromBody] MenuEditInput input)
{
await _menuService.Edit(input);
}
///
/// 获取菜单详情
///
///
[HttpGet("detail")]
public async Task Detail([FromQuery] BaseIdInput input)
{
return await _menuService.Detail(input);
;
}
///
/// 删除菜单
///
///
///
[HttpPost("delete")]
[DisplayName("删除菜单")]
public async Task Delete([FromBody] BaseIdListInput input)
{
await _menuService.Delete(input);
}
///
/// 更改模块
///
///
///
[HttpPost("changeModule")]
[DisplayName("更改模块")]
public async Task ChangeModule([FromBody] MenuChangeModuleInput input)
{
await _menuService.ChangeModule(input);
}
}