diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java index d638fe0..3639794 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java @@ -215,4 +215,5 @@ public interface IApiConsts { * 部门列表 */ String LIST_DEPARTMENT_SORT = "%s/resource/department/list-sort"; + } diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/IDepartmentService.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/IDepartmentService.java index 9325f60..3feb35c 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/IDepartmentService.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/IDepartmentService.java @@ -3,7 +3,6 @@ package com.cm.common.plugin.oauth.service.department; import com.alibaba.fastjson.JSONArray; import com.cm.common.exception.AccessTokenException; import com.cm.common.exception.SearchException; -import com.cm.common.plugin.pojo.bos.department.DepartmentResourceBO; import com.cm.common.pojo.dtos.department.DepartmentSortDTO; import java.util.List; @@ -69,4 +68,12 @@ public interface IDepartmentService { * @return */ List listSortByType(String type); + + /** + * 部门列表 + * + * @param parentId 上级ID + * @return + */ + List listSortByParentId(String parentId); } diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/impl/DepartmentServiceImpl.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/impl/DepartmentServiceImpl.java index cc5ef68..7061ccf 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/impl/DepartmentServiceImpl.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/impl/DepartmentServiceImpl.java @@ -89,4 +89,14 @@ public class DepartmentServiceImpl extends AbstractService implements IDepartmen searchResourceResult(result, "获取部门列表失败"); return JSONArray.parseArray(result, DepartmentSortDTO.class); } + + @Override + public List listSortByParentId(String parentId) { + Map params = new HashMap<>(2); + params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken()); + params.put("departmentParentId", parentId); + String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_DEPARTMENT_SORT, apiPathProperties.getUserCenter()), params); + searchResourceResult(result, "获取部门列表失败"); + return JSONArray.parseArray(result, DepartmentSortDTO.class); + } }