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

114 lines
3.4 KiB

  1. //
  2. namespace SafeCampus.System;
  3. /// <summary>
  4. /// 资源服务
  5. /// </summary>
  6. public interface IResourceService : ITransient
  7. {
  8. /// <summary>
  9. /// 获取所有的菜单和模块以及单页面列表,并按分类和排序码排序
  10. /// </summary>
  11. /// <returns>所有的菜单和模块以及单页面列表</returns>
  12. Task<List<SysResource>> GetAllModuleAndMenuAndSpaList();
  13. /// <summary>
  14. /// 根据模块ID获取菜单和单页面列表
  15. /// </summary>
  16. /// <param name="id"></param>
  17. /// <returns></returns>
  18. Task<List<SysResource>> GetMenuAndSpaListByModuleId(long id);
  19. /// <summary>
  20. /// 根据资源ID获取所有下级资源
  21. /// </summary>
  22. /// <param name="resId">资源ID</param>
  23. /// <param name="isContainOneself">是否包含自己</param>
  24. /// <returns>资源列表</returns>
  25. Task<List<SysResource>> GetChildListById(long resId, bool isContainOneself = true);
  26. /// <summary>
  27. /// 根据资源ID获取所有下级资源
  28. /// </summary>
  29. /// <param name="sysResources">资源列表</param>
  30. /// <param name="resId">资源ID</param>
  31. /// <param name="isContainOneself">是否包含自己</param>
  32. /// <returns>资源列表</returns>
  33. List<SysResource> GetChildListById(List<SysResource> sysResources, long resId, bool isContainOneself = true);
  34. /// <summary>
  35. /// 获取ID获取Code列表
  36. /// </summary>
  37. /// <param name="ids">id列表</param>
  38. /// <param name="category">分类</param>
  39. /// <returns>Code列表</returns>
  40. Task<List<string>> GetCodeByIds(List<long> ids, string category);
  41. /// <summary>
  42. /// 获取资源列表
  43. /// </summary>
  44. /// <param name="categoryList">资源分类列表</param>
  45. /// <returns></returns>
  46. Task<List<SysResource>> GetListAsync(List<string>? categoryList = null);
  47. /// <summary>
  48. /// 根据分类获取资源列表
  49. /// </summary>
  50. /// <param name="category">分类名称</param>
  51. /// <returns>资源列表</returns>
  52. Task<List<SysResource>> GetListByCategory(string category);
  53. /// <summary>
  54. /// 根据菜单ID获取菜单
  55. /// </summary>
  56. /// <param name="ids">id列表</param>
  57. /// <param name="category">分类</param>
  58. /// <returns></returns>
  59. Task<List<SysResource>> GetResourcesByIds(List<long> ids, string category);
  60. /// <summary>
  61. /// 获取权限授权树
  62. /// </summary>
  63. /// <param name="routes">路由列表</param>
  64. /// <returns></returns>
  65. List<PermissionTreeSelector> PermissionTreeSelector(List<string> routes);
  66. /// <summary>
  67. /// 刷新缓存
  68. /// </summary>
  69. /// <param name="category">分类名称</param>
  70. /// <returns></returns>
  71. Task RefreshCache(string category = null);
  72. /// <summary>
  73. /// 角色授权资源树
  74. /// </summary>
  75. /// <returns></returns>
  76. Task<List<ResTreeSelector>> ResourceTreeSelector();
  77. /// <summary>
  78. /// 获取上级
  79. /// </summary>
  80. /// <param name="resourceList"></param>
  81. /// <param name="parentId"></param>
  82. /// <returns></returns>
  83. List<SysResource> GetResourceParent(List<SysResource> resourceList, long parentId);
  84. /// <summary>
  85. /// 获取授权菜单类菜单名称
  86. /// </summary>
  87. /// <param name="menuList">菜单列表</param>
  88. /// <param name="menu">当前菜单</param>
  89. /// <returns></returns>
  90. string GetRoleGrantResourceMenuTitle(List<SysResource> menuList, SysResource menu);
  91. }