CRITICAL — Before starting, you MUST first use the Read tool to read ../ziniao-shared/SKILL.md, which contains authentication, error handling, and security rules
CRITICAL — Before executing any Shortcuts, you MUST first use the Read tool to read the corresponding references/ documentation. Do not directly call commands blindly.
Core Scenarios
View Organizational Structure
When users want to understand the company's department structure, use --tree to display the hierarchical relationships:
ziniao-cli department list --tree
Output tree structure:
├── 技术部 (id: 15868464646076)
│ ├── 前端组 (id: 15954943062431)
│ └── 后端组 (id: 15954943062432)
└── 市场部 (id: 15868464646077)
Create Department
hierarchy is automatically calculated by the CLI (parent department level +1), users do not need to worry about it:
# 在已有部门下创建子部门(parentId 必须为已存在的部门 ID,不支持传 0)
ziniao-cli department create --name "华东区" --parent-id 15868464646076
⚠
--parent-idcannot be 0; you must pass an existing parent department ID. To query available parent department IDs, first executedepartment list --tree。
Dangerous Operations
Deleting a department is high-risk-write, and will require confirmation.Deleting a parent department will cascade delete all sub-departments and cannot be recovered. Before deleting, it is recommended to check whether there are sub-departments or employees:
ziniao-cli department list --tree # 检查子部门
ziniao-cli staff list --department-id xxx # 检查是否有员工
ziniao-cli department delete --id xxx # 执行删除(需确认)
Shortcuts
| Command | Description | Detailed Documentation |
|---|---|---|
department list |
Query department list | references/ziniao-department-list.md |
department create |
Add department | references/ziniao-department-create.md |
department update |
Modify department | Only send modified fields:--id xxx --name "新名" |
department delete |
Delete department (sub-departments and employee affiliations will be cleared) | high-risk-write,--yes skip confirmation |
department reorder |
Adjust sorting | --parent-id xxx --order "id1,id2,id3" |
General API Coverage
All department interfaces can also be called through the general api command:
ziniao-cli api /superbrowser/rest/v1/erp/department/list
ziniao-cli api /superbrowser/rest/v1/erp/department/add --data '{"name":"xxx","parentId":"<父部门ID>","hierarchy":"0"}'
ziniao-cli api /superbrowser/rest/v1/erp/department/update --data '{"id":"xxx","name":"新名"}'
ziniao-cli api /superbrowser/rest/v1/erp/department/delete --data '{"id":"xxx"}'
ziniao-cli api /superbrowser/rest/v1/erp/department/order --data '{"parentId":"xxx","order":["id1","id2"]}'