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

ISysOrgService.cs 4.9 KiB

4 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. 
  2. //
  3. namespace SafeCampus.System;
  4. /// <summary>
  5. /// 组织架构服务
  6. /// </summary>
  7. public interface ISysOrgService : ITransient
  8. {
  9. #region 查询
  10. /// <summary>
  11. /// 检查组织是否存在
  12. /// </summary>
  13. /// <param name="sysOrgList">组织列表</param>
  14. /// <param name="orgName">组织名称</param>
  15. /// <param name="parentId">父Id</param>
  16. /// <param name="orgId">组织Id</param>
  17. /// <returns>是否存在,存在返回组织ID</returns>
  18. bool IsExistOrgByName(List<SysOrg> sysOrgList, string orgName, long parentId,
  19. out long orgId);
  20. /// <summary>
  21. /// 组织详情
  22. /// </summary>
  23. /// <param name="input">id参数</param>
  24. /// <returns>组织信息</returns>
  25. Task<SysOrg> Detail(BaseIdInput input);
  26. /// <summary>
  27. /// 根据组织ID获取 下级
  28. /// </summary>
  29. /// <param name="orgId">组织ID</param>
  30. /// <param name="isContainOneself">是否包含自己</param>
  31. /// <param name="sysOrgList">组织列表</param>
  32. /// <returns></returns>
  33. Task<List<SysOrg>> GetChildListById(long orgId, bool isContainOneself = true, List<SysOrg> sysOrgList = null);
  34. /// <summary>
  35. /// 获取所有组织
  36. /// </summary>
  37. /// <param name="showDisabled">是否显示禁用的</param>
  38. /// <returns></returns>
  39. Task<List<SysOrg>> GetListAsync(bool showDisabled = true);
  40. /// <summary>
  41. /// 获取机构及下级ID列表
  42. /// </summary>
  43. /// <param name="orgId"></param>
  44. /// <param name="isContainOneself"></param>
  45. /// <param name="sysOrgList">组织列表</param>
  46. /// <returns></returns>
  47. Task<List<long>> GetOrgChildIds(long orgId, bool isContainOneself = true, List<SysOrg> sysOrgList = null);
  48. /// <summary>
  49. /// 根据组织Id递归获取上级
  50. /// </summary>
  51. /// <param name="allOrgList">组织列表</param>
  52. /// <param name="orgId">组织Id</param>
  53. /// <param name="includeSelf">是否包含自己</param>
  54. /// <returns></returns>
  55. List<SysOrg> GetOrgParents(List<SysOrg> allOrgList, long orgId, bool includeSelf = true);
  56. /// <summary>
  57. /// 获取组织信息
  58. /// </summary>
  59. /// <param name="id">组织id</param>
  60. /// <returns>组织信息</returns>
  61. Task<SysOrg> GetSysOrgById(long id);
  62. /// <summary>
  63. /// 组织分页查询
  64. /// </summary>
  65. /// <param name="input">查询参数</param>
  66. /// <returns>分页信息</returns>
  67. Task<SqlSugarPagedList<SysOrg>> Page(SysOrgPageInput input);
  68. /// <summary>
  69. /// 根据ID列表获取组织列表
  70. /// </summary>
  71. /// <param name="input"></param>
  72. /// <returns></returns>
  73. Task<List<SysOrg>> GetOrgListByIdList(IdListInput input);
  74. /// <summary>
  75. /// 获取租户列表
  76. /// </summary>
  77. /// <returns></returns>
  78. Task<List<SysOrg>> GetTenantList();
  79. /// <summary>
  80. /// 根据组织ID获取租户ID
  81. /// </summary>
  82. /// <param name="orgId">组织id</param>
  83. /// <param name="sysOrgList">租户id</param>
  84. /// <returns></returns>
  85. Task<long?> GetTenantIdByOrgId(long orgId, List<SysOrg> sysOrgList = null);
  86. #endregion 查询
  87. #region 新增
  88. /// <summary>
  89. /// 添加组织
  90. /// </summary>
  91. /// <param name="input">添加参数</param>
  92. /// <param name="name">名称</param>
  93. /// <returns></returns>
  94. Task Add(SysOrgAddInput input, string name = SystemConst.SYS_ORG);
  95. /// <summary>
  96. /// 复制组织
  97. /// </summary>
  98. /// <param name="input">机构复制参数</param>
  99. /// <returns></returns>
  100. Task Copy(SysOrgCopyInput input);
  101. #endregion 新增
  102. #region 编辑
  103. /// <summary>
  104. /// 编辑组织
  105. /// </summary>
  106. /// <param name="input">编辑参数</param>
  107. /// <param name="name">名称</param>
  108. /// <returns></returns>
  109. Task Edit(SysOrgEditInput input, string name = SystemConst.SYS_ORG);
  110. #endregion 编辑
  111. #region 删除
  112. /// <summary>
  113. /// 删除组织
  114. /// </summary>
  115. /// <param name="input">删除参数</param>
  116. /// <param name="name">名称</param>
  117. /// <returns></returns>
  118. Task Delete(BaseIdListInput input, string name = SystemConst.SYS_ORG);
  119. #endregion 删除
  120. #region 其他
  121. /// <summary>
  122. /// 构建组织树形结构
  123. /// </summary>
  124. /// <param name="orgList">组织列表</param>
  125. /// <param name="parentId">父ID</param>
  126. /// <returns>树型结构</returns>
  127. List<SysOrg> ConstructOrgTrees(List<SysOrg> orgList, long parentId = SafeCampusConst.ZERO);
  128. /// <summary>
  129. /// 刷新缓存
  130. /// </summary>
  131. /// <returns></returns>
  132. Task RefreshCache();
  133. /// <summary>
  134. /// 获取组织树型结构
  135. /// </summary>
  136. /// <param name="orgIds">机构ID列表</param>
  137. /// <param name="treeInput">组织选择器(懒加载用)</param>
  138. /// <returns>组织树列表</returns>
  139. Task<List<SysOrg>> Tree(List<long> orgIds = null, SysOrgTreeInput treeInput = null);
  140. #endregion 其他
  141. }