ISysRoleService.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using Dto;
  2. using Model;
  3. using Model.Base;
  4. namespace Services
  5. {
  6. public interface ISysRoleService : IBaseService<SysRole>
  7. {
  8. /// <summary>
  9. /// 根据条件分页查询角色数据
  10. /// </summary>
  11. /// <param name="role">角色信息</param>
  12. /// <param name="pager"></param>
  13. /// <returns>角色数据集合信息</returns>
  14. public PagedInfo<SysRole> SelectRoleList(SysRole role, PagerInfo pager);
  15. /// <summary>
  16. /// 查询所有角色
  17. /// </summary>
  18. /// <returns></returns>
  19. public List<SysRole> SelectRoleAll();
  20. /// <summary>
  21. /// 根据用户查询
  22. /// </summary>
  23. /// <param name="userId"></param>
  24. /// <returns></returns>
  25. public List<SysRole> SelectRolePermissionByUserId(long userId);
  26. /// <summary>
  27. /// 通过角色ID查询角色
  28. /// </summary>
  29. /// <param name="roleId">角色ID</param>
  30. /// <returns>角色对象信息</returns>
  31. public SysRole SelectRoleById(long roleId);
  32. /// <summary>
  33. /// 批量删除角色信息
  34. /// </summary>
  35. /// <param name="roleIds">需要删除的角色ID</param>
  36. /// <returns></returns>
  37. public int DeleteRoleByRoleId(long[] roleIds);
  38. /// <summary>
  39. /// 更改角色权限状态
  40. /// </summary>
  41. /// <param name="roleDto"></param>
  42. /// <returns></returns>
  43. public int UpdateRoleStatus(SysRole roleDto);
  44. /// <summary>
  45. /// 校验角色权限是否唯一
  46. /// </summary>
  47. /// <param name="sysRole">角色信息</param>
  48. /// <returns></returns>
  49. public string CheckRoleKeyUnique(SysRole sysRole);
  50. /// <summary>
  51. /// 校验角色是否允许操作
  52. /// </summary>
  53. /// <param name="role"></param>
  54. public void CheckRoleAllowed(SysRole role);
  55. /// <summary>
  56. /// 新增保存角色信息
  57. /// </summary>
  58. /// <param name="sysRole">角色信息</param>
  59. /// <returns></returns>
  60. public long InsertRole(SysRole sysRole);
  61. /// <summary>
  62. /// 通过角色ID删除角色和菜单关联
  63. /// </summary>
  64. /// <param name="roleId">角色ID</param>
  65. /// <returns></returns>
  66. public int DeleteRoleMenuByRoleId(long roleId);
  67. /// <summary>
  68. /// 授权数据范围
  69. /// </summary>
  70. /// <param name="role"></param>
  71. /// <returns></returns>
  72. bool AuthDataScope(SysRoleDto role);
  73. #region Service
  74. /// <summary>
  75. /// 新增角色菜单信息
  76. /// </summary>
  77. /// <param name="sysRoleDto"></param>
  78. /// <returns></returns>
  79. public int InsertRoleMenu(SysRoleDto sysRoleDto);
  80. /// <summary>
  81. /// 判断是否是管理员
  82. /// </summary>
  83. /// <param name="userid"></param>
  84. /// <returns></returns>
  85. public bool IsAdmin(long userid);
  86. /// <summary>
  87. /// 获取角色菜单id集合
  88. /// </summary>
  89. /// <param name="roleId"></param>
  90. /// <returns></returns>
  91. public List<long> SelectUserRoleMenus(long roleId);
  92. List<long> SelectRoleMenuByRoleIds(long[] roleIds);
  93. /// <summary>
  94. /// 获取用户角色列表
  95. /// </summary>
  96. /// <param name="userId"></param>
  97. /// <returns></returns>
  98. public List<SysRole> SelectUserRoleListByUserId(long userId);
  99. /// <summary>
  100. /// 获取用户权限集合
  101. /// </summary>
  102. /// <param name="userId"></param>
  103. /// <returns></returns>
  104. public List<long> SelectUserRoles(long userId);
  105. /// <summary>
  106. /// 获取用户权限字符串集合
  107. /// </summary>
  108. /// <param name="userId"></param>
  109. /// <returns></returns>
  110. public List<string> SelectUserRoleKeys(long userId);
  111. public List<string> SelectUserRoleNames(long userId);
  112. #endregion
  113. /// <summary>
  114. /// 修改保存角色信息
  115. /// </summary>
  116. /// <param name="sysRole">角色信息</param>
  117. /// <returns></returns>
  118. public int UpdateRole(SysRole sysRole);
  119. int UpdateSysRole(SysRole sysRole);
  120. }
  121. }