新增通过上级部门查询部门列表方法

This commit is contained in:
wanggeng 2021-08-03 16:15:24 +08:00
parent bd71a0bfd6
commit 124672f4db
3 changed files with 19 additions and 1 deletions

View File

@ -215,4 +215,5 @@ public interface IApiConsts {
* 部门列表
*/
String LIST_DEPARTMENT_SORT = "%s/resource/department/list-sort";
}

View File

@ -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<DepartmentSortDTO> listSortByType(String type);
/**
* 部门列表
*
* @param parentId 上级ID
* @return
*/
List<DepartmentSortDTO> listSortByParentId(String parentId);
}

View File

@ -89,4 +89,14 @@ public class DepartmentServiceImpl extends AbstractService implements IDepartmen
searchResourceResult(result, "获取部门列表失败");
return JSONArray.parseArray(result, DepartmentSortDTO.class);
}
@Override
public List<DepartmentSortDTO> listSortByParentId(String parentId) {
Map<String, Object> 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);
}
}