平安校园
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.

MenuController.cs 2.9 KiB

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