部门
## 概述
> 部门
类名
`
DepartmentApi.java
`
成员方法
名称 | 方法 | Method | Path
------------- | ------------- | ------------- | -------------
[新增部门](#addDepartment) | [**addDepartment**](#addDepartment) | POST | /api-organization/dept/addDepartment
[删除部门](#deleteDepartment) | [**deleteDepartment**](#deleteDepartment) | POST | /api-organization/dept/deleteDepartment
[获取企业所有部门](#getCompanyAllDepartmentList) | [**getCompanyAllDepartmentList**](#getCompanyAllDepartmentList) | POST | /api-organization/dept/getCompanyAllDepartmentList
[获取部门列表](#getDepartmentList) | [**getDepartmentList**](#getDepartmentList) | POST | /api-organization/dept/getDepartmentList
[修改部门](#updateDepartment) | [**updateDepartment**](#updateDepartment) | POST | /api-organization/dept/updateDepartment
<a id="addDepartment"></a>
## **新增部门**
> ResultObject addDepartment(departForm)
新增部门
### 请求参数
名称 | 类型 | 描述 | 备注
------------- | ------------- | ------------- | -------------
**departForm** | **DepartForm**| departForm |
#### DepartForm
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**id** | **String** | 部门id(修改时必须有,添加时不需要) | -
**name** | **String** | 部门名称 |
**parentId** | **String** | 父级部门id |
**remark** | **String** | 描述 | -
**sort** | **Integer** | 排序号 | -
### 返回参数
ResultObject
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**code** | **String** | 响应码 | -
**data** | **Object** | 响应数据 | -
**msg** | **String** | 响应消息 | -
**time** | **OffsetDateTime** | 响应时间 | -
### java-sdk 调用示例
```java
//实例化api类,传入token
DepartmentApi apiInstance = new DepartmentApi(token);
//实例化请求参数
DepartForm departForm = new DepartForm();
try {
ResultObject result = apiInstance.addDepartment(departForm);
System.out.println(result);
} catch (ApiException e) {
System.err.println("调用DepartmentApi.addDepartment异常: " + e.getMessage());
e.printStackTrace();
}
```
### HTTP 调用示例
| 属性 | 名称 |
| --------------- | ------------------------ |
| HTTP请求地址 | http://[server]:[port]/api-organization/dept/addDepartment|
| 请求方式 | POST |
| Content-Type | application/json |
| header:key | Authorization|
| header:value |Bearer *YOUR_ACCESS_TOKEN*|
请求参数:
```json
{
"name":"",
"remark":"",
"id":"",
"sort":0,
"parentId":""
}
```
<a id="deleteDepartment"></a>
## **删除部门**
> ResultObject deleteDepartment(deptId)
根据部门Id删除部门
### 请求参数
名称 | 类型 | 描述 | 备注
------------- | ------------- | ------------- | -------------
**deptId** | **String**| 部门ID | -
### 返回参数
ResultObject
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**code** | **String** | 响应码 | -
**data** | **Object** | 响应数据 | -
**msg** | **String** | 响应消息 | -
**time** | **OffsetDateTime** | 响应时间 | -
### java-sdk 调用示例
```java
//实例化api类,传入token
DepartmentApi apiInstance = new DepartmentApi(token);
//实例化请求参数
String deptId = "deptId_example";
try {
ResultObject result = apiInstance.deleteDepartment(deptId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("调用DepartmentApi.deleteDepartment异常: " + e.getMessage());
e.printStackTrace();
}
```
### HTTP 调用示例
| 属性 | 名称 |
| --------------- | ------------------------ |
| HTTP请求地址 | http://[server]:[port]/api-organization/dept/deleteDepartment|
| 请求方式 | POST |
| Content-Type | application/json |
| header:key | Authorization|
| header:value |Bearer *YOUR_ACCESS_TOKEN*|
请求参数:
```json
{
"deptId":""
}
```
<a id="getCompanyAllDepartmentList"></a>
## **获取企业所有部门**
> ResultListDepartment getCompanyAllDepartmentList()
获取企业所有部门
### 请求参数
请求参数为空.
### 返回参数
ResultListDepartment
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**code** | **String** | 响应码 | -
**data** | **List<Department>** | 响应数据 | -
**msg** | **String** | 响应消息 | -
**time** | **OffsetDateTime** | 响应时间 | -
Department
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**children** | **List<Department>** | 子部门 | -
**companyId** | **String** | 企业id | -
**createdBy** | **String** | 创建人 | -
**createdTime** | **OffsetDateTime** | 创建时间 | -
**id** | **String** | 主键 | -
**name** | **String** | 名称 | -
**parentId** | **String** | 父级id | -
**remark** | **String** | 备注 | -
**sort** | **Integer** | 排序号 | -
**updatedTime** | **OffsetDateTime** | 修改时间 | -
Department
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**children** | **List<Department>** | 子部门 | -
**companyId** | **String** | 企业id | -
**createdBy** | **String** | 创建人 | -
**createdTime** | **OffsetDateTime** | 创建时间 | -
**id** | **String** | 主键 | -
**name** | **String** | 名称 | -
**parentId** | **String** | 父级id | -
**remark** | **String** | 备注 | -
**sort** | **Integer** | 排序号 | -
**updatedTime** | **OffsetDateTime** | 修改时间 | -
### java-sdk 调用示例
```java
//实例化api类,传入token
DepartmentApi apiInstance = new DepartmentApi(token);
try {
ResultListDepartment result = apiInstance.getCompanyAllDepartmentList();
System.out.println(result);
} catch (ApiException e) {
System.err.println("调用DepartmentApi.getCompanyAllDepartmentList异常: " + e.getMessage());
e.printStackTrace();
}
```
### HTTP 调用示例
| 属性 | 名称 |
| --------------- | ------------------------ |
| HTTP请求地址 | http://[server]:[port]/api-organization/dept/getCompanyAllDepartmentList|
| 请求方式 | POST |
| Content-Type | application/json |
| header:key | Authorization|
| header:value |Bearer *YOUR_ACCESS_TOKEN*|
请求参数:
```json
{}
```
<a id="getDepartmentList"></a>
## **获取部门列表**
> ResultListDepartment getDepartmentList()
根据当前登录用户ID查询所在部门及子部门
### 请求参数
请求参数为空.
### 返回参数
ResultListDepartment
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**code** | **String** | 响应码 | -
**data** | **List<Department>** | 响应数据 | -
**msg** | **String** | 响应消息 | -
**time** | **OffsetDateTime** | 响应时间 | -
Department
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**children** | **List<Department>** | 子部门 | -
**companyId** | **String** | 企业id | -
**createdBy** | **String** | 创建人 | -
**createdTime** | **OffsetDateTime** | 创建时间 | -
**id** | **String** | 主键 | -
**name** | **String** | 名称 | -
**parentId** | **String** | 父级id | -
**remark** | **String** | 备注 | -
**sort** | **Integer** | 排序号 | -
**updatedTime** | **OffsetDateTime** | 修改时间 | -
Department
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**children** | **List<Department>** | 子部门 | -
**companyId** | **String** | 企业id | -
**createdBy** | **String** | 创建人 | -
**createdTime** | **OffsetDateTime** | 创建时间 | -
**id** | **String** | 主键 | -
**name** | **String** | 名称 | -
**parentId** | **String** | 父级id | -
**remark** | **String** | 备注 | -
**sort** | **Integer** | 排序号 | -
**updatedTime** | **OffsetDateTime** | 修改时间 | -
### java-sdk 调用示例
```java
//实例化api类,传入token
DepartmentApi apiInstance = new DepartmentApi(token);
try {
ResultListDepartment result = apiInstance.getDepartmentList();
System.out.println(result);
} catch (ApiException e) {
System.err.println("调用DepartmentApi.getDepartmentList异常: " + e.getMessage());
e.printStackTrace();
}
```
### HTTP 调用示例
| 属性 | 名称 |
| --------------- | ------------------------ |
| HTTP请求地址 | http://[server]:[port]/api-organization/dept/getDepartmentList|
| 请求方式 | POST |
| Content-Type | application/json |
| header:key | Authorization|
| header:value |Bearer *YOUR_ACCESS_TOKEN*|
请求参数:
```json
{}
```
<a id="updateDepartment"></a>
## **修改部门**
> ResultObject updateDepartment(departForm)
修改部门
### 请求参数
名称 | 类型 | 描述 | 备注
------------- | ------------- | ------------- | -------------
**departForm** | **DepartForm**| departForm |
#### DepartForm
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**id** | **String** | 部门id(修改时必须有,添加时不需要) | -
**name** | **String** | 部门名称 |
**parentId** | **String** | 父级部门id |
**remark** | **String** | 描述 | -
**sort** | **Integer** | 排序号 | -
### 返回参数
ResultObject
名称 | 类型 | 描述 | 备注
------------ | ------------- | ------------- | -------------
**code** | **String** | 响应码 | -
**data** | **Object** | 响应数据 | -
**msg** | **String** | 响应消息 | -
**time** | **OffsetDateTime** | 响应时间 | -
### java-sdk 调用示例
```java
//实例化api类,传入token
DepartmentApi apiInstance = new DepartmentApi(token);
//实例化请求参数
DepartForm departForm = new DepartForm();
try {
ResultObject result = apiInstance.updateDepartment(departForm);
System.out.println(result);
} catch (ApiException e) {
System.err.println("调用DepartmentApi.updateDepartment异常: " + e.getMessage());
e.printStackTrace();
}
```
### HTTP 调用示例
| 属性 | 名称 |
| --------------- | ------------------------ |
| HTTP请求地址 | http://[server]:[port]/api-organization/dept/updateDepartment|
| 请求方式 | POST |
| Content-Type | application/json |
| header:key | Authorization|
| header:value |Bearer *YOUR_ACCESS_TOKEN*|
请求参数:
```json
{
"name":"",
"remark":"",
"id":"",
"sort":0,
"parentId":""
}
```