Skip to content

部门

获取部门

GET /org/{type}

权限

  • 需要认证

请求参数

名称位置类型必选说明
typepathstringtrue'userManageOrg'管理的组织机构,用于设置所属部门, 'resourcePermissionOrg'资源发布范围加入范围,人员的管理范围
settingOrgIdsquerystringfalse类型为'resourcePermissionOrg'表示资源已经设置的数据

响应

json
[
  {
    "id": "1",
    "name": "测试企业微信",
    "parentId": "0",
    "depth": "1",
    "seq": "0",
    "code": "FullSite",
    "orgCode": "1.",
    "selectable": true,
    "disableCheckbox": false,
    "nodes": [
      {
        "id": "1046",
        "name": "技术部",
        "parentId": "1",
        "depth": "2",
        "seq": "0",
        "code": "dingtalk2",
        "orgCode": "1.1046.",
        "selectable": true,
        "disableCheckbox": false,
        "nodes": [
          {
            "id": "1050",
            "name": "sql审计",
            "parentId": "1046",
            "depth": "3",
            "seq": "0",
            "code": "dingtalk8",
            "orgCode": "1.1046.1050.",
            "selectable": true,
            "disableCheckbox": false,
            "nodes": []
          }
        ]
      },
      {
        "id": "1047",
        "name": "销售部1",
        "parentId": "1",
        "depth": "2",
        "seq": "0",
        "code": "dingtalk4",
        "orgCode": "1.1047.",
        "selectable": true,
        "disableCheckbox": false,
        "nodes": [
          {
            "id": "1049",
            "name": "催收部",
            "parentId": "1047",
            "depth": "3",
            "seq": "0",
            "code": "dingtalk6",
            "orgCode": "1.1047.1049.",
            "selectable": true,
            "disableCheckbox": false,
            "nodes": []
          }
        ]
      },
      {
        "id": "1048",
        "name": "质控部",
        "parentId": "1",
        "depth": "2",
        "seq": "0",
        "code": "dingtalk5",
        "orgCode": "1.1048.",
        "selectable": true,
        "disableCheckbox": false,
        "nodes": []
      },
      {
        "id": "1051",
        "name": "市场部",
        "parentId": "1",
        "depth": "2",
        "seq": "0",
        "code": "dingtalk10",
        "orgCode": "1.1051.",
        "selectable": true,
        "disableCheckbox": false,
        "nodes": []
      },
      {
        "id": "1052",
        "name": "132312",
        "parentId": "1",
        "depth": "2",
        "seq": "0",
        "code": "dingtalk14",
        "orgCode": "1.1052.",
        "selectable": true,
        "disableCheckbox": false,
        "nodes": [
          {
            "id": "1053",
            "name": "32423",
            "parentId": "1052",
            "depth": "3",
            "seq": "0",
            "code": "dingtalk13",
            "orgCode": "1.1052.1053.",
            "selectable": true,
            "disableCheckbox": false,
            "nodes": []
          }
        ]
      },
      {
        "id": "1054",
        "name": "楚氏部门",
        "parentId": "1",
        "depth": "2",
        "seq": "0",
        "code": "CSBM",
        "orgCode": "1.1054.",
        "selectable": true,
        "disableCheckbox": false,
        "nodes": [
          {
            "id": "1055",
            "name": "楚家军部门",
            "parentId": "1054",
            "depth": "3",
            "seq": "0",
            "code": "CJJBM",
            "orgCode": "1.1054.1055.",
            "selectable": true,
            "disableCheckbox": false,
            "nodes": []
          }
        ]
      }
    ]
  }
]

字段说明

名称类型必选约束说明
» idinteger(int64)falsenonenone
» seqintegerfalsenonenone
» codestringfalsenonenone
» orgCodestringfalsenonenone
» selectablebooleanfalsenone是否可选中
» namestringfalsenonenone
» depthinteger(int64)falsenone层级
» nodesobjectfalsenonenone
»» idinteger(int64)falsenonenone
»» seqintegerfalsenonenone
»» codestringfalsenonenone
»» orgCodestringfalsenonenone
»» selectablebooleanfalsenone是否可选中
»» namestringfalsenonenone
»» depthinteger(int64)falsenone层级
»» nodesobjectfalsenonenone

搜索部门

GET /org/search

权限

  • 需要认证

请求参数

名称位置类型必选说明
namequerystringfalse部门名称

响应

json
{
  "data": [
    {
      "id": "3",
      "name": "1234",
      "parentId": "1",
      "childrenNum": "1",
      "depth": "2",
      "seq": "0",
      "description": null,
      "code": "JXEQ",
      "orgCode": "1.3.",
      "createdUserId": "2",
      "createdTime": "1644914071",
      "updateTime": "1644914144",
      "syncId": "0",
      "fullName": "1234"
    },
    {
      "id": "2",
      "name": "123",
      "parentId": "1",
      "childrenNum": "0",
      "depth": "2",
      "seq": "1",
      "description": null,
      "code": "YJY",
      "orgCode": "1.2.",
      "createdUserId": "2",
      "createdTime": "1644914071",
      "updateTime": "1644914144",
      "syncId": "0",
      "fullName": "123"
    },
    {
      "id": "4",
      "name": "1234",
      "parentId": "3",
      "childrenNum": "0",
      "depth": "3",
      "seq": "0",
      "description": null,
      "code": "PMHL",
      "orgCode": "1.3.4.",
      "createdUserId": "2",
      "createdTime": "1644919061",
      "updateTime": "1644919061",
      "syncId": "0",
      "fullName": "1234-1234"
    },
    {
      "id": "6",
      "name": "111111",
      "parentId": "5",
      "childrenNum": "0",
      "depth": "3",
      "seq": "0",
      "description": null,
      "code": "BTSMKB",
      "orgCode": "1.5.6.",
      "createdUserId": "2",
      "createdTime": "1645003086",
      "updateTime": "1645003086",
      "syncId": "0",
      "fullName": "55555-111111"
    }
  ],
  "paging": {
    "total": 4,
    "offset": 0,
    "limit": 10
  }
}

字段说明

名称类型必选约束说明
» idinteger(int64)falsenonenone
» namestringfalsenone名称
» fullNamestringfalsenone包含上级部门名称(除顶级)

创建部门

POST /api_v3/admin/org
  • 支持版本 >=24.2.3
  • 权限 admin_org_manage

参数

字段是否必须描述
name string(200)名称
parentCode string(200)父级部门编码
code string(200) unique部门编码

成功响应

更新部门

POST /api_v3/admin/org/{orgId}
  • 支持版本 >=24.2.3
  • 权限 admin_org_manage

参数

字段是否必须描述
orgId int部门ID
name string(200)名称
parentCode string(200)父部门编码
code string(200) unique机构编码

成功响应

删除部门

POST /api_v3/admin/org/{orgId}/delete
  • 支持版本 >=24.2.3
  • 权限 admin_org_manage

参数

字段是否必须描述
orgId int部门ID

成功响应

json
{
    "status": true
}

实体

部门

示例

json
{
  "id": 123,
  "name": "Department A",
  "parentId": 0,
  "childrenNum": 5,
  "depth": 1,
  "seq": 0,
  "description": "This is Department A",
  "code": "DEPT-A",
  "orgCode": "1.DEPT-A.",
  "createdUserId": 456,
  "createdTime": 1644914071,
  "updateTime": 1644914144,
  "syncId": "SYNC-123"
}

字段说明

名称说明
id integer(int64)部门ID
name string名称
parentId integer(int64)部门父ID
childrenNum integer(uint32)辖下部门数量
depth integer当前部门层级
seq integer排序
description string描述
code string(255)编码
orgCode string(255)内部编码
createdUserId integer创建用户ID
createdTime integer(uint32)创建时间
updateTime integer(uint32)最后更新时间
syncId string(255)同步部门ID