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

179 lines
4.9 KiB

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