基础服务api
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.
 
 

111 lines
3.3 KiB

  1. using BPA.SAAS.Manage.Application.Org.Dtos.Role;
  2. using BPA.SAAS.Manage.Application.Org.Interface;
  3. using BPA.SAAS.Manage.Core.Base;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace BPA.SAAS.Manage.Application.Org
  10. {
  11. [ApiDescriptionSettings("Org", Tag = "角色信息")]
  12. public class RolesServices: IDynamicApiController
  13. {
  14. IRoleService _roleService;
  15. public RolesServices(IRoleService roleService)
  16. {
  17. _roleService=roleService;
  18. }
  19. /// <summary>
  20. /// 分页查询
  21. /// </summary>
  22. /// <param name="input"></param>
  23. /// <returns></returns>
  24. [HttpPost("/api/roles/page")]
  25. public async Task<PageUtil> Page(RoleDtoPageInput input)
  26. {
  27. return await _roleService.Page(input);
  28. }
  29. /// <summary>
  30. /// 根据角色查询角色菜单
  31. /// </summary>
  32. /// <param name="RoleId"></param>
  33. /// <returns></returns>
  34. [HttpGet("/api/roles/getmenurole")]
  35. public async Task<List<QueryRoleMenuListDto>> GetMenuRole(string RoleId)
  36. {
  37. return await _roleService.GetMenuRole(RoleId);
  38. }
  39. /// <summary>
  40. /// 添加
  41. /// </summary>
  42. /// <param name="input"></param>
  43. /// <returns></returns>
  44. [HttpPost("/api/roles/add")]
  45. public async Task<bool> Add(RoleDtoInput input)
  46. {
  47. return await _roleService.Add(input);
  48. }
  49. /// <summary>
  50. /// 更新
  51. /// </summary>
  52. /// <param name="input"></param>
  53. /// <returns></returns>
  54. [HttpPost("/api/roles/update")]
  55. public async Task<bool> Update(RoleDtoInput input)
  56. {
  57. return await _roleService.Update(input);
  58. }
  59. /// <summary>
  60. /// 删除
  61. /// </summary>
  62. /// <param name="input"></param>
  63. /// <returns></returns>
  64. [HttpPost("/api/roles/delete")]
  65. public async Task<bool> Delete(List<string> input)
  66. {
  67. return await _roleService.Delete(input);
  68. }
  69. /// <summary>
  70. /// 编辑角色菜单
  71. /// </summary>
  72. /// <param name="input"></param>
  73. /// <returns></returns>
  74. [HttpPost("/api/roles/addorupdatemenurole")]
  75. public async Task<bool> AddOrUpdateMenuRole(RoleMenuDtoInput input)
  76. {
  77. return await _roleService.AddOrUpdateMenuRole(input);
  78. }
  79. /// <summary>
  80. /// 启用
  81. /// </summary>
  82. /// <param name="Id"></param>
  83. /// <returns></returns>
  84. [HttpGet("/api/roles/enable")]
  85. public async Task<bool> Enable(string Id)
  86. {
  87. return await _roleService.Enable(Id);
  88. }
  89. /// <summary>
  90. /// 禁用
  91. /// </summary>
  92. /// <param name="Id"></param>
  93. /// <returns></returns>
  94. [HttpGet("/api/roles/disable")]
  95. public async Task<bool> Disable(string Id)
  96. {
  97. return await _roleService.Disable(Id);
  98. }
  99. /// <summary>
  100. /// 获取所有角色
  101. /// </summary>
  102. /// <returns></returns>
  103. [HttpGet("/api/roles/getrole")]
  104. public async Task<Dictionary<string, object>> GetRole()
  105. {
  106. return await _roleService.GetRole();
  107. }
  108. }
  109. }