SysMenuController.cs 1016 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // <author></author>
  2. // <date></date>
  3. // <description></description>
  4. using ERP.Core.Interface;
  5. using ERP.Framework.Security;
  6. using ERP.Framework.WebApi;
  7. using Microsoft.AspNetCore.Mvc;
  8. using Microsoft.Extensions.Configuration;
  9. namespace ERP.Core.Controllers
  10. {
  11. [Route("system/menu")]
  12. public class SysMenuController : BaseController
  13. {
  14. private readonly IConfiguration _configuration;
  15. private readonly ISysMenuService _sysMenuService;
  16. public SysMenuController(IConfiguration configuration, ISysMenuService sysMenuService)
  17. {
  18. _configuration = configuration;
  19. _sysMenuService = sysMenuService;
  20. }
  21. [HttpGet("get-routers")]
  22. public IActionResult GetRouter()
  23. {
  24. var userId = LoginHelper.GetUserId();
  25. var menuList = _sysMenuService.SelectMenuTreeByUserId(userId);
  26. var result = _sysMenuService.BuildMenuTree(menuList, string.Empty);
  27. return Success(result);
  28. }
  29. }
  30. }