# 部门API

# 列表

# 请求

  • Method: GET

  • Url: /personnel/api/departments/

  • Headers:

    • Content-Type: application/json
    • Authorization: "JWT ey.........oQi98"
  • Query Parameters

参数 描述
page
page_size
dept_code
dept_name
dept_code_icontains
dept_name_icontains
ordering id, dept_code, dept_name

# 响应

{
    "count": 27,
    "next": "null",
    "previous": null,
    "msg": "",
    "code": 0,
    "data": [
        {
            "id": 1,
            "dept_code": "1",
            "dept_name": "WORLD",
            "parent_dept": null
        },
        {
            "id": 93,
            "dept_code": "5190062",
            "dept_name": "shenzhen",
            "parent_dept": null
        },
        ...
        ...
}

# 读取

# 请求

  • Method: GET

  • Url: /personnel/api/departments/{id}/

  • Headers:

    • Content-Type: application/json
    • Authorization: "JWT ey.........oQi98"
  • Path Parameters

参数 描述
id required

# 响应

- **Url:** /personnel/api/departments/1/
{
    "id": 1,
    "dept_code": "1",
    "dept_name": "WORLD",
    "parent_dept": null
}

# 创建

  • Method: POST
  • Url: /personnel/api/departments/
  • Headers:
    • Content-Type: application/json
    • Authorization: "JWT ey.........oQi98"
  • Request Body
{
    "dept_code": "test dept code",
    "dept_name": "test dept name",
    "parent_dept": null
}
参数 必填 类型 描述
dept_code Y String 部门编号
dept_name Y String 部门名称
parent_dept N Integer 上级部门

# 响应

{
    "id": 100,
    "dept_code": "test dept code",
    "dept_name": "test dept name",
    "parent_dept": null
}

# 更新

# 请求

  • Method: PUT

  • Url: /personnel/api/departments/{id}/

  • Headers:

    • Content-Type: application/json
    • Authorization: "JWT ey.........oQi98"
  • Path Parameters

Parameter Description
id 必填
  • Request Body
{
    "dept_code": "11",
    "dept_name": "test dept name",
}
参数 必填 类型 描述
dept_code Y String 部门编号
dept_name Y String 部门名称
parent_dept N Integer 上级部门

# 响应

- **Url:** PUT /personnel/api/departments/1/
{
    "id": 1,
    "dept_code": "11",
    "dept_name": "WORLD WORLD",
    "parent_dept": null
}

# 删除

# 请求

  • Method: DELETE

  • Url: /personnel/api/departments/{id}/

  • Headers:

    • Content-Type: application/json
    • Authorization: "JWT ey.........oQi98"
  • Path Parameters

参数 描述
id 必填

# 响应

None