diff --git a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/OrganizationServiceApi.java b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/OrganizationServiceApi.java index b9e59fd87..133f366af 100644 --- a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/OrganizationServiceApi.java +++ b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/api/OrganizationServiceApi.java @@ -73,13 +73,28 @@ public interface OrganizationServiceApi { /** * 获取指定组织机构的上级组织机构是什么 + *

+ * 逐级向上获取直到获取到最高级 * * @param orgId 指定机构id - * @param parentLevelNum 上级机构的层级数,从0开始 + * @param parentLevelNum 上级机构的层级数,从0开始,0代表直接返回本部门 * @return 上级机构的id * @author fengshuonan * @date 2022/9/18 15:02 */ Long getParentLevelOrgId(Long orgId, Integer parentLevelNum); + /** + * 获取该部门从最高一级上级开始计算的子组织 + *

+ * 逐级向下获取,直到获取到本层机构 + * + * @param orgId 指定机构id + * @param highestLevelNum 自上而下的层级数,从0开始,0代表直接返回本部门 + * @return 计算后的上级机构id + * @author fengshuonan + * @date 2022/10/1 11:37 + */ + Long getHighestLevelOrgId(Long orgId, Integer highestLevelNum); + } diff --git a/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/service/impl/HrOrganizationServiceImpl.java b/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/service/impl/HrOrganizationServiceImpl.java index bfb411cdf..5f7be6333 100644 --- a/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/service/impl/HrOrganizationServiceImpl.java +++ b/kernel-s-system/system-business-organization/src/main/java/cn/stylefeng/roses/kernel/system/modular/organization/service/impl/HrOrganizationServiceImpl.java @@ -415,44 +415,12 @@ public class HrOrganizationServiceImpl extends ServiceImpl