平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

126 lines
2.9 KiB

  1. //
  2. namespace SafeCampus.Web.Core;
  3. /// <summary>
  4. /// 菜单管理控制器
  5. /// </summary>
  6. [ApiDescriptionSettings(Tag = "菜单管理")]
  7. [Route("sys/limit/[controller]")]
  8. [SuperAdmin]
  9. public class MenuController : BaseController
  10. {
  11. private readonly IMenuService _menuService;
  12. private readonly IResourceService _resourceService;
  13. public MenuController(IMenuService menuService, IResourceService resourceService)
  14. {
  15. _menuService = menuService;
  16. _resourceService = resourceService;
  17. }
  18. /// <summary>
  19. /// 模块选择
  20. /// </summary>
  21. /// <returns></returns>
  22. [HttpGet("moduleSelector")]
  23. public async Task<dynamic> ModuleSelector()
  24. {
  25. return await _resourceService.GetListByCategory(CateGoryConst.RESOURCE_MODULE);
  26. }
  27. /// <summary>
  28. /// 获取菜单树
  29. /// </summary>
  30. /// <returns></returns>
  31. [HttpGet("tree")]
  32. public async Task<dynamic> Tree([FromQuery] MenuTreeInput input)
  33. {
  34. return await _menuService.Tree(input);
  35. }
  36. /// <summary>
  37. /// 获取菜单树选择器
  38. /// </summary>
  39. /// <returns></returns>
  40. [HttpGet("menuTreeSelector")]
  41. public async Task<dynamic> MenuTreeSelector([FromQuery] MenuTreeInput input)
  42. {
  43. if (input.Module != null)
  44. {
  45. return await _menuService.Tree(input, false);
  46. }
  47. else
  48. {
  49. return await _menuService.ShortcutTree();
  50. }
  51. }
  52. /// <summary>
  53. /// 添加菜单
  54. /// </summary>
  55. /// <param name="input"></param>
  56. /// <returns></returns>
  57. [HttpPost("add")]
  58. [DisplayName("添加菜单")]
  59. public async Task Add([FromBody] MenuAddInput input)
  60. {
  61. await _menuService.Add(input);
  62. }
  63. /// <summary>
  64. /// 编辑菜单
  65. /// </summary>
  66. /// <param name="input"></param>
  67. /// <returns></returns>
  68. [HttpPost("edit")]
  69. [DisplayName("编辑菜单")]
  70. public async Task Edit([FromBody] MenuEditInput input)
  71. {
  72. await _menuService.Edit(input);
  73. }
  74. /// <summary>
  75. /// 获取菜单详情
  76. /// </summary>
  77. /// <returns></returns>
  78. [HttpGet("detail")]
  79. public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
  80. {
  81. return await _menuService.Detail(input);
  82. ;
  83. }
  84. /// <summary>
  85. /// 删除菜单
  86. /// </summary>
  87. /// <param name="input"></param>
  88. /// <returns></returns>
  89. [HttpPost("delete")]
  90. [DisplayName("删除菜单")]
  91. public async Task Delete([FromBody] BaseIdListInput input)
  92. {
  93. await _menuService.Delete(input);
  94. }
  95. /// <summary>
  96. /// 更改模块
  97. /// </summary>
  98. /// <param name="input"></param>
  99. /// <returns></returns>
  100. [HttpPost("changeModule")]
  101. [DisplayName("更改模块")]
  102. public async Task ChangeModule([FromBody] MenuChangeModuleInput input)
  103. {
  104. await _menuService.ChangeModule(input);
  105. }
  106. }