@lark-people/cli 0.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +324 -0
- package/LICENSE +21 -0
- package/README.md +232 -0
- package/README.zh.md +232 -0
- package/bin/people-cli_darwin_amd64 +0 -0
- package/bin/people-cli_darwin_arm64 +0 -0
- package/bin/people-cli_linux_amd64 +0 -0
- package/bin/people-cli_linux_arm64 +0 -0
- package/bin/people-cli_windows_amd64.exe +0 -0
- package/bin/people-cli_windows_arm64.exe +0 -0
- package/package.json +41 -0
- package/scripts/install-wizard.js +700 -0
- package/scripts/install.js +56 -0
- package/scripts/run.js +36 -0
- package/skills/people-attendance/SKILL.md +667 -0
- package/skills/people-attendance/references/people-attendance-submission.md +426 -0
- package/skills/people-attendance/scripts/resolve_date.py +894 -0
- package/skills/people-corehr/references/people-corehr-pre-hire-search.md +0 -0
- package/skills/people-corehr-employee/SKILL.md +111 -0
- package/skills/people-corehr-employee/references/people-corehr-employee-basic-info-query.md +97 -0
- package/skills/people-corehr-employee/references/people-corehr-employee-fields-list.md +87 -0
- package/skills/people-corehr-employee/references/people-corehr-employee-filter.md +403 -0
- package/skills/people-corehr-employee/references/people-corehr-employee-search.md +73 -0
- package/skills/people-corehr-job-change/SKILL.md +212 -0
- package/skills/people-corehr-job-change/references/people-job-change-business-rules.md +113 -0
- package/skills/people-corehr-job-change/references/people-job-change-lookup-filters.md +82 -0
- package/skills/people-corehr-job-change/references/people-job-change-output-and-empty.md +207 -0
- package/skills/people-corehr-job-change/references/people-job-change-search-advanced.md +226 -0
- package/skills/people-corehr-job-change/references/people-job-change-search-fields.md +119 -0
- package/skills/people-corehr-job-change/references/people-job-change-search-option.md +72 -0
- package/skills/people-corehr-job-change/references/people-job-change-search.md +215 -0
- package/skills/people-corehr-offboarding/SKILL.md +188 -0
- package/skills/people-corehr-offboarding/references/people-corehr-offboarding-business-knowledge.md +27 -0
- package/skills/people-corehr-offboarding/references/people-corehr-offboarding-search-option.md +187 -0
- package/skills/people-corehr-offboarding/references/people-corehr-offboarding-search.md +54 -0
- package/skills/people-corehr-organization/SKILL.md +42 -0
- package/skills/people-corehr-organization/references/aggregate.md +11 -0
- package/skills/people-corehr-organization/references/detail.md +39 -0
- package/skills/people-corehr-organization/references/field-values.md +44 -0
- package/skills/people-corehr-organization/references/hierarchy.md +61 -0
- package/skills/people-corehr-organization/references/lookup.md +41 -0
- package/skills/people-corehr-organization/references/metadata.md +40 -0
- package/skills/people-corehr-organization/references/tree.md +45 -0
- package/skills/people-corehr-prehire/SKILL.md +160 -0
- package/skills/people-corehr-prehire/references/command-resolution.md +48 -0
- package/skills/people-corehr-prehire/references/filter-fields.md +151 -0
- package/skills/people-corehr-prehire/references/return-fields.md +153 -0
- package/skills/people-corehr-prehire/references/templates.md +202 -0
- package/skills/people-corehr-prehire/references/troubleshooting.md +93 -0
- package/skills/people-corehr-query-id-by-name/SKILL.md +154 -0
- package/skills/people-corehr-renewal/SKILL.md +186 -0
- package/skills/people-corehr-renewal/references/people-corehr-renewal-fields-query.md +62 -0
- package/skills/people-corehr-renewal/references/people-corehr-renewal-routing.md +54 -0
- package/skills/people-corehr-renewal/references/people-corehr-renewal-search.md +137 -0
- package/skills/people-corehr-renewal/references/people-corehr-renewal.md +39 -0
- package/skills/people-corehr-workforce-plan/SKILL.md +52 -0
- package/skills/people-corehr-workforce-plan/references/people-corehr-workforce-plan-detail-list.md +238 -0
- package/skills/people-corehr-workforce-plan/references/people-corehr-workforce-plan-detail-summary.md +221 -0
- package/skills/people-corehr-workforce-plan/references/people-corehr-workforce-plan.md +79 -0
- package/skills/people-hire/SKILL.md +255 -0
- package/skills/people-hire/references/people-hire-application.md +334 -0
- package/skills/people-hire/references/people-hire-evaluation-task-list.md +233 -0
- package/skills/people-hire/references/people-hire-evaluation.md +127 -0
- package/skills/people-hire/references/people-hire-interview-record.md +109 -0
- package/skills/people-hire/references/people-hire-interview-task-list.md +250 -0
- package/skills/people-hire/references/people-hire-interview.md +146 -0
- package/skills/people-hire/references/people-hire-job-process.md +93 -0
- package/skills/people-hire/references/people-hire-job-requirement.md +227 -0
- package/skills/people-hire/references/people-hire-job.md +277 -0
- package/skills/people-hire/references/people-hire-minutes.md +91 -0
- package/skills/people-hire/references/people-hire-talent.md +105 -0
- package/skills/people-hire/references/people-hire-test.md +197 -0
- package/skills/people-overtime/SKILL.md +992 -0
- package/skills/people-overtime/references/people-attendance-overtime-apply.md +491 -0
- package/skills/people-overtime/references/people-attendance-overtime.md +51 -0
- package/skills/people-overtime/references/people-attendance-submission.md +203 -0
- package/skills/people-overtime/scripts/resolve_date.py +894 -0
- package/skills/people-shared/SKILL.md +94 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
# +employee-filter
|
|
2
|
+
|
|
3
|
+
- 根据筛选条件查询符合要求的员工列表和员工信息。
|
|
4
|
+
- 支持分页查询(search_after)。
|
|
5
|
+
- 支持自定义显示字段。
|
|
6
|
+
- 支持排序字段。
|
|
7
|
+
|
|
8
|
+
## 前置流程(必须遵守!)
|
|
9
|
+
|
|
10
|
+
### ⚠️ 默认展示字段铁律(与 SKILL.md D5 等价)
|
|
11
|
+
|
|
12
|
+
**用户未明确指定要查看哪些属性时,`--display-fields` 必须且仅传:**
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
["employment.person.preferred_name", "employment.employee_number"]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
即默认只展示「姓名 + 工号」。
|
|
19
|
+
|
|
20
|
+
- ❌ 严禁默认追加 `employment.department` / `employment.job_level` / `employment.job_family` / `employment.work_location` 等任何字段;
|
|
21
|
+
- ❌ 严禁因为本文档下文示例里出现了 `department` / `job_level` 就把它们当成"默认推荐字段";下文示例仅用于演示**用户已显式要求**这些字段时的写法;
|
|
22
|
+
- ✅ 仅当用户在自然语言中**明确点名**某个属性(如"显示部门""带上职级""把工作地点也列出来")时,才把对应 `api_name` 追加到 `--display-fields`。
|
|
23
|
+
|
|
24
|
+
> 该规则在每次 `+employee-filter` 调用前必须复核一次,违反此规则等同于违反 SKILL.md D5。
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
在调用此命令前,必须先判断筛选条件中是否包含需要通过名称转换为ID的字段:
|
|
29
|
+
|
|
30
|
+
### 必须先转换ID的字段类型
|
|
31
|
+
|
|
32
|
+
| 字段类型 | 转换方法 | 业务场景 |
|
|
33
|
+
|---------|---------|---------|
|
|
34
|
+
| 部门名称 | 直接在 filters 中使用 `value_names` | `team` |
|
|
35
|
+
| 人员类型名称 | 直接在 filters 中使用 `value_names` | `team` |
|
|
36
|
+
| 职级名称 | 直接在 filters 中使用 `value_names` | `team` |
|
|
37
|
+
| 序列名称 | 直接在 filters 中使用 `value_names` | `team` |
|
|
38
|
+
| 工作地点名称 | 直接在 filters 中使用 `value_names` | `team` |
|
|
39
|
+
| 成本中心名称 | 直接在 filters 中使用 `value_names` | `team` |
|
|
40
|
+
| 人员子类型名称 | 直接在 filters 中使用 `value_names` | `team` |
|
|
41
|
+
| 直属上级姓名 | 使用 `+employee-search` 换 `employment_id` | - |
|
|
42
|
+
|
|
43
|
+
### 内置 value_names 自动解析
|
|
44
|
+
|
|
45
|
+
`+employee-filter` 已内置名称→ID 解析能力(business_scene=team),**禁止再调用 `+query-id-by-name`**。在 filters 中:
|
|
46
|
+
|
|
47
|
+
- 使用 `values: [<id>...]` 直接传 ID(与历史用法一致);
|
|
48
|
+
- 使用 `value_names: [<name>...]` 由命令自动解析为 ID 后再请求接口,**仅** 对以下字段有效:
|
|
49
|
+
- `employment.department`
|
|
50
|
+
- `employment.job_level`
|
|
51
|
+
- `employment.job_family`
|
|
52
|
+
- `employment.work_location`
|
|
53
|
+
- `employment.cost_center`
|
|
54
|
+
- `employment.workforce_type`
|
|
55
|
+
- `employment.employee_subtype`
|
|
56
|
+
- `value_names` 与 `values` 可同时存在,最终取并集(自动去重)。
|
|
57
|
+
- 解析多匹配 / 无匹配时命令直接报错列出候选,不会静默忽略。
|
|
58
|
+
- **多匹配处理规则**:当某个 `value_names` 命中多条数据时,命令会按 `(id, name, name_path)` 成组列出全部候选,由**用户进一步甄别 / 指定更精确的查询名称**或**直接选取目标 id**。下一次重试时,必须将选定的 id 放入该 filter 的 `values` 字段,并**移除该 filter 上的 `value_names`**,禁止继续重复传 `value_names` 让命令再去解析。
|
|
59
|
+
- 其他字段(如 `employment.direct_manager`、`employment.dotted_line_manager`、`employment.manage_relations_all`)仍需先通过 `+employee-search` 取得 `employment_id` 再传入 `values`。
|
|
60
|
+
|
|
61
|
+
### field_api_name 命名规范
|
|
62
|
+
- `field_api_name` **必须使用** `+employee-fields-query` 返回的完整 `api_name`(含命名空间前缀),禁止省略前缀。
|
|
63
|
+
- 查询员工相关字段一律以 `employment.` 开头,例如:
|
|
64
|
+
- ✅ `employment.workforce_type`(人员类型)- 用于查询正式/实习/顾问等员工类型
|
|
65
|
+
- ✅ `employment.department`(部门)
|
|
66
|
+
- ✅ `employment.job_level`(职级)
|
|
67
|
+
- ✅ `employment.job_family`(序列)
|
|
68
|
+
- ✅ `employment.work_location`(工作地点)
|
|
69
|
+
- ✅ `employment.cost_center`(成本中心)
|
|
70
|
+
- ✅ `employment.employee_subtype`(人员子类型)- 需配合特定业务场景使用
|
|
71
|
+
- ✅ `employment.direct_manager`(直属上级)
|
|
72
|
+
- ❌ `workforce_type`(缺少 `employment.` 前缀,会导致 API 报 `config not found` 错误)
|
|
73
|
+
- ❌ `department`(缺少 `employment.` 前缀)
|
|
74
|
+
- ❌ `job_level`(缺少 `employment.` 前缀)
|
|
75
|
+
|
|
76
|
+
### 转换流程示例
|
|
77
|
+
|
|
78
|
+
#### 1. 部门名称筛选
|
|
79
|
+
```bash
|
|
80
|
+
people-cli corehr +employee-filter --filters '[{"field_api_name":"employment.department","operator":"in","value_names":["技术部"],"is_strand_id_in":true}]'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### 2. 人员类型名称筛选
|
|
84
|
+
```bash
|
|
85
|
+
people-cli corehr +employee-filter --filters '[{"field_api_name":"employment.workforce_type","operator":"eq","value_names":["正式"],"is_strand_id_in":false}]'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 基本用法
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
people-cli corehr +employee-filter [flags]
|
|
92
|
+
```
|
|
93
|
+
### 查看帮助信息
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
#查看所有命令行
|
|
97
|
+
people-cli corehr--help
|
|
98
|
+
|
|
99
|
+
# 查看帮助 +employee-filter信息
|
|
100
|
+
people-cli corehr +employee-filter --help
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## 所需权限
|
|
104
|
+
|
|
105
|
+
| Scope |
|
|
106
|
+
|-------|
|
|
107
|
+
| `corehr:employment_info_filter:read` |
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 查询参数说明
|
|
111
|
+
|
|
112
|
+
| Flag | 类型 | 必填 | 默认值 | 说明 |
|
|
113
|
+
|------|---------|------|---|--------------------------------------------------------------|
|
|
114
|
+
| `--filters` | string (JSON) | 否 | - | 筛选条件,JSON 数组格式 |
|
|
115
|
+
| `--sort-fields` | string (JSON) | 否 | - | 排序字段,JSON 数组格式 |
|
|
116
|
+
| `--display-fields` | string (JSON) | 否 | - | 展示字段,JSON 数组格式 |
|
|
117
|
+
| `--limit` | int | 否 | `30` | 返回结果数量上限(最大 100) |
|
|
118
|
+
| `--search_after` | string | 否 | - | 分页游标,用于分页(首次请求为空,后续请求使用上次返回的 search_after 值,返回结果数量上限(最大 100) |
|
|
119
|
+
| `--accept-language` | string | 否 | `zh-CN` | 响应语言:`zh-CN`(中文)、`en-US`(英文) |
|
|
120
|
+
|
|
121
|
+
### accept-language 选择策略
|
|
122
|
+
|
|
123
|
+
根据用户使用的语言自动选择:
|
|
124
|
+
- 用户使用**中文**时 → 使用 `zh-CN`(默认)
|
|
125
|
+
- 用户使用**英文**时 → 使用 `en-US`
|
|
126
|
+
- 不确定时默认使用 `zh-CN`
|
|
127
|
+
|
|
128
|
+
### filters 格式
|
|
129
|
+
|
|
130
|
+
#### 严格约束(必须遵守)
|
|
131
|
+
|
|
132
|
+
1. **字段名称必须来源于 `+employee-fields-query`**
|
|
133
|
+
- 所有 filters 中使用的字段 API 名称,必须与 `+employee-fields-query` 返回结果中的字段名称**严格一致**,不得自行拼写或猜测。
|
|
134
|
+
|
|
135
|
+
2. **"XX 团队的员工"优先理解为"以 XX 为直属上级的员工"**
|
|
136
|
+
- 先通过 `+employee-search` 查询 XX 的 `employment_id`;
|
|
137
|
+
- 再以 `employment.manage_relations_all` 作为筛选条件,查询其下属员工。
|
|
138
|
+
|
|
139
|
+
3. **不支持的筛选字段 → 直接拒绝并提示**
|
|
140
|
+
- 若用户要求的筛选条件在 `+employee-fields-query` 返回结果中**不存在**,或其 `filterable` 属性为 `false`:
|
|
141
|
+
- **禁止**尝试通过其他接口、字段组合或任何变通方式绕过此限制;
|
|
142
|
+
- **仅返回**当前所有支持筛选的字段name(以 JSON 数组格式),不附加额外说明或建议。
|
|
143
|
+
- 示例回复格式:该字段不支持筛选。当前支持的筛选字段:["人员类型","职级","序列","工作地点"]
|
|
144
|
+
|
|
145
|
+
#### 示例
|
|
146
|
+
```json
|
|
147
|
+
[
|
|
148
|
+
{
|
|
149
|
+
"field_api_name": "employment.department",
|
|
150
|
+
"operator": "in",
|
|
151
|
+
"values": ["部门ID"],
|
|
152
|
+
"is_strand_id_in": true
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
或者使用 `value_names` 让命令自动解析:
|
|
158
|
+
```json
|
|
159
|
+
[
|
|
160
|
+
{
|
|
161
|
+
"field_api_name": "employment.department",
|
|
162
|
+
"operator": "in",
|
|
163
|
+
"value_names": ["技术部"],
|
|
164
|
+
"is_strand_id_in": true
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
```
|
|
168
|
+
#### 字段说明
|
|
169
|
+
| 字段 | 说明 |
|
|
170
|
+
|------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
171
|
+
| `field_api_name` | 字段API名称(可通过 `+employee-fields-query` 获取,仅 `filterable` 为 `true` 的字段才能参与筛选。**注意**:`field_api_name` 必须使用完整命名空间前缀,如 `employment.department`、`employment.workforce_type`,禁止省略前缀) |
|
|
172
|
+
| `operator` | 操作符,与 `field_api_name` 配套使用(由 `+employee-fields-query` 返回的 `type` 决定可用操作符,`operators` 字段列出具体操作符) |
|
|
173
|
+
| `values` | 筛选值数组(ID 列表)。传值方式由 `+employee-fields-query` 返回的 `type` 决定,详见 [`people-corehr-employee-fields-list.md`](./people-corehr-employee-fields-list.md) 的 type 字段类型说明 |
|
|
174
|
+
| `value_names` | (可选)名称列表。命令会自动解析(business_scene=team)为 ID 后再请求接口,**禁止再调用 `+query-id-by-name`**。仅对 `employment.department / job_level / job_family / work_location / cost_center / workforce_type / employee_subtype` 生效;与 `values` 可同时存在,取并集 |
|
|
175
|
+
| `is_strand_id_in` | 是否包含下级,详见下方 `is_strand_id_in` 说明 |
|
|
176
|
+
|
|
177
|
+
### is_strand_id_in 说明
|
|
178
|
+
|
|
179
|
+
`is_strand_id_in` 控制筛选时是否包含下级数据,取值规则如下:
|
|
180
|
+
|
|
181
|
+
| `field_api_name` | `is_strand_id_in` 值 |
|
|
182
|
+
|------------|---------------------|
|
|
183
|
+
| `employment.department` | 可选:`true`(默认,包含下级)/ `false`(不包含下级) |
|
|
184
|
+
| `employment.work_location` | 可选:`true`(默认,包含下级)/ `false`(不包含下级) |
|
|
185
|
+
| `employment.cost_center` | 可选:`true`(默认,包含下级)/ `false`(不包含下级) |
|
|
186
|
+
| `employment.job_family` | 可选:`true`(默认,包含下级)/ `false`(不包含下级) |
|
|
187
|
+
| `employment.direct_manager` | 恒传 `true` |
|
|
188
|
+
| `employment.dotted_line_manager` | 恒传 `true` |
|
|
189
|
+
| 其他 `field_api_name` | 传 `false` |
|
|
190
|
+
|
|
191
|
+
### 常用筛选字段示例
|
|
192
|
+
|
|
193
|
+
#### 人员类型筛选
|
|
194
|
+
```json
|
|
195
|
+
[
|
|
196
|
+
{
|
|
197
|
+
"field_api_name": "employment.workforce_type",
|
|
198
|
+
"operator": "eq",
|
|
199
|
+
"values": ["正式员工ID"],
|
|
200
|
+
"is_strand_id_in": false
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### 入职日期范围筛选
|
|
206
|
+
```json
|
|
207
|
+
[
|
|
208
|
+
{
|
|
209
|
+
"field_api_name": "employment.effective_time",
|
|
210
|
+
"operator": "gte",
|
|
211
|
+
"values": ["2024-10-01"],
|
|
212
|
+
"is_strand_id_in": false
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### 组合筛选(正式员工 + 2024-10-01后入职)
|
|
218
|
+
```json
|
|
219
|
+
[
|
|
220
|
+
{
|
|
221
|
+
"field_api_name": "employment.effective_time",
|
|
222
|
+
"operator": "gte",
|
|
223
|
+
"values": ["2024-10-01"],
|
|
224
|
+
"is_strand_id_in": false
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"field_api_name": "employment.workforce_type",
|
|
228
|
+
"operator": "eq",
|
|
229
|
+
"values": ["7186577930586457611"],
|
|
230
|
+
"is_strand_id_in": false
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### sort-fields 格式
|
|
236
|
+
#### 严格约束(必须遵守!)
|
|
237
|
+
**所有 sort-fields 中使用的字段API名称必须从 `+employee-fields-query` 命令返回的结果中获取,并且必须严格一致。如果出现不一致的情况,必须立即停止执行。询问用户是否继续。**
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
| 字段 | 说明 |
|
|
241
|
+
|------|------|
|
|
242
|
+
| `field_api_name` | 字段 API 标识(可通过 `+employee-fields-query` 获取) |
|
|
243
|
+
| `order` | 排序方向:`0` 升序、`1` 降序 |
|
|
244
|
+
|
|
245
|
+
### 常用排序字段示例
|
|
246
|
+
```json
|
|
247
|
+
[
|
|
248
|
+
{
|
|
249
|
+
"field_api_name": "employment.job_level",
|
|
250
|
+
"order": 0
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### display-fields 格式
|
|
256
|
+
|
|
257
|
+
#### 严格约束(必须遵守!)
|
|
258
|
+
|
|
259
|
+
1. **默认值规则(与 SKILL.md D5 等价)**:用户未明确指定要查看哪些属性时,`--display-fields` 必须且仅传 `["employment.person.preferred_name", "employment.employee_number"]`(姓名 + 工号)。仅当用户在自然语言中显式点名某属性(如"显示部门""带上职级")时,才将对应 `api_name` 追加进来。
|
|
260
|
+
2. **所有 display-fields 中使用的字段API名称必须从 `+employee-fields-query` 命令返回的结果中获取,并且必须严格一致。如果出现不一致的情况,必须立即停止执行。询问用户是否继续。**
|
|
261
|
+
|
|
262
|
+
#### 执行前自检(每次调用 `+employee-filter` 前必须逐条核对)
|
|
263
|
+
|
|
264
|
+
> 以下三条任意一条不通过,**禁止追加任何业务字段**到 `--display-fields`,必须回退到默认最小集 `["employment.person.preferred_name","employment.employee_number"]`。
|
|
265
|
+
|
|
266
|
+
- [ ] 用户**原话**是否包含"显示 / 查看 / 带上 / 列出 / 给我看 + 具体字段名(部门 / 职级 / 序列 / 工作地点 / 入职时间 等)"?
|
|
267
|
+
- [ ] 我准备追加到 `--display-fields` 的每个字段,是否都能从用户原话中**直接引述**到对应词?
|
|
268
|
+
- [ ] 是否存在"看着示例像就照搬"、"为了表格更丰富所以多加几个"、"用户问的是部门所以顺便显示部门"(**注意**:用户问"X 部门的员工"是**筛选条件**,不是要求**展示部门列**)等情形?若有,立即停止追加。
|
|
269
|
+
|
|
270
|
+
#### 默认场景(用户未指定字段):
|
|
271
|
+
```bash
|
|
272
|
+
# 用户:"帮我查一下 XX 部门的员工" —— 未点名任何属性,使用默认最小集
|
|
273
|
+
people-cli corehr +employee-filter \
|
|
274
|
+
--filters '[{"field_api_name":"employment.department","operator":"in","value_names":["XX"],"is_strand_id_in":true}]' \
|
|
275
|
+
--display-fields '["employment.person.preferred_name","employment.employee_number"]' \
|
|
276
|
+
--format table
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
#### 用户显式要求字段时:
|
|
280
|
+
```bash
|
|
281
|
+
# 用户:"帮我查 XX 部门员工,并显示部门和职级" —— 在最小集基础上追加用户点名的字段
|
|
282
|
+
people-cli corehr +employee-filter --display-fields '["employment.person.preferred_name","employment.employee_number","employment.department","employment.job_level"]'
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### 错误示例:
|
|
286
|
+
```bash
|
|
287
|
+
# 错误 1:用户没要求看部门/职级,却默认追加了这些字段(违反 D5)
|
|
288
|
+
people-cli corehr +employee-filter --display-fields '["employment.person.preferred_name","employment.department","employment.job_level"]'
|
|
289
|
+
|
|
290
|
+
# 错误 2:用户问的是"XX 部门的实习生",部门是筛选条件而非展示要求,仍然追加了 department 列(违反 D5)
|
|
291
|
+
people-cli corehr +employee-filter --display-fields '["employment.person.preferred_name","employment.employee_number","employment.department"]'
|
|
292
|
+
|
|
293
|
+
# 错误 3:使用了不存在的字段API名称
|
|
294
|
+
people-cli corehr +employee-filter --display-fields '["employment.name"]' # employment.name 不是有效的字段API名称
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
## 输出
|
|
299
|
+
|
|
300
|
+
每条记录为固定列 + 动态列的结构:
|
|
301
|
+
|
|
302
|
+
| 字段 | 说明 |
|
|
303
|
+
|------|------|
|
|
304
|
+
| `Employment ID` | 员工ID(固定列) |
|
|
305
|
+
| `employment.xxx` | 由 `--display-fields` 指定的字段,列名为对应的 `api_name`,值为字段显示文本(无值时为 `null`) |
|
|
306
|
+
|
|
307
|
+
### 严格约束(必须遵守!)
|
|
308
|
+
#### 筛选结果数据获取逻辑,具体数据从控制台获取,控制台数据展示示例
|
|
309
|
+
```text
|
|
310
|
+
Next page: --search-after-key [{"larkmy":[1,"xuan hui he patsy ziemann","34216443","7628524534569944581"]},null]
|
|
311
|
+
Has more: true
|
|
312
|
+
Count: 33
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
#### 分页处理(强制),当用户请求查询数据详情时,必须检查接口返回的 Has more 字段:
|
|
316
|
+
- 若 Has more 为 true,必须主动提示用户是否需要查看下一页数据,不得静默忽略。
|
|
317
|
+
- 若 HasMore 为 false,正常结束输出即可。
|
|
318
|
+
### 输出示例
|
|
319
|
+
|
|
320
|
+
> 下例展示**默认场景**(用户未点名任何属性)的输出形态:仅包含姓名 + 工号。`employment.department` / `employment.job_level` 等业务字段**只有在用户显式要求时**才会出现。
|
|
321
|
+
|
|
322
|
+
```json
|
|
323
|
+
{
|
|
324
|
+
"ok": true,
|
|
325
|
+
"identity": "user",
|
|
326
|
+
"data": [
|
|
327
|
+
{
|
|
328
|
+
"Employment ID": "7342393515664573996",
|
|
329
|
+
"employment.person.preferred_name": "张三",
|
|
330
|
+
"employment.employee_number": "10086"
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"meta": {
|
|
334
|
+
"count": 1
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## 示例
|
|
340
|
+
|
|
341
|
+
> 以下示例中 `<...>` 为需替换的占位符,实际使用时请替换为具体值。
|
|
342
|
+
>
|
|
343
|
+
> **⚠️ 阅读示例时请注意**:下方示例中绝大多数 `--display-fields` 仅含 `["employment.person.preferred_name", "employment.employee_number"]`(默认最小集)。**仅有少数示例**显式标注了 `# ⚠️ 仅当用户原话包含「显示部门 / 带上职级 / 把工作地点也列出来」等明确要求时使用` 才会追加业务字段。如果你**不是**在响应这类显式要求,**禁止**照搬那少数示例的 `--display-fields`。
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# 第一步:查看可筛选字段及其 type、operators
|
|
347
|
+
people-cli corehr +employee-fields-query --format table
|
|
348
|
+
|
|
349
|
+
# 第二步(默认场景,用户未点名属性):按部门筛选员工,仅返回姓名+工号
|
|
350
|
+
people-cli corehr +employee-filter \
|
|
351
|
+
--filters '[{"field_api_name":"employment.department","operator":"in","values":["7519409170505483820"],"is_strand_id_in":true}]' \
|
|
352
|
+
--display-fields '["employment.person.preferred_name","employment.employee_number"]' \
|
|
353
|
+
--format table
|
|
354
|
+
|
|
355
|
+
# ⚠️ 仅当用户原话包含「显示部门 / 序列 / 职级」等明确要求时使用:按部门筛选员工
|
|
356
|
+
people-cli corehr +employee-filter \
|
|
357
|
+
--filters '[{"field_api_name":"employment.department","operator":"in","values":["7519409170505483820"],"is_strand_id_in":true}]' \
|
|
358
|
+
--display-fields '["employment.person.preferred_name","employment.employee_number","employment.department","employment.job_family","employment.job_level"]' \
|
|
359
|
+
--format table
|
|
360
|
+
|
|
361
|
+
# ⚠️ 仅当用户原话同时要求「按职级排序」并「显示职级」时使用:按部门筛选并按职级排序
|
|
362
|
+
people-cli corehr +employee-filter \
|
|
363
|
+
--filters '[{"field_api_name":"employment.department","operator":"in","values":["7519409170505483820"],"is_strand_id_in":true}]' \
|
|
364
|
+
--sort-fields '[{"field_api_name":"employment.job_level","order":0}]' \
|
|
365
|
+
--display-fields '["employment.person.preferred_name","employment.employee_number","employment.job_level"]' \
|
|
366
|
+
--limit 100
|
|
367
|
+
|
|
368
|
+
# 按人员类型筛选(默认场景,仅返回姓名+工号)
|
|
369
|
+
people-cli corehr +employee-filter \
|
|
370
|
+
--filters '[{"field_api_name":"employment.workforce_type","operator":"eq","values":["75194091705055483820"]}]' \
|
|
371
|
+
--display-fields '["employment.person.preferred_name","employment.employee_number"]' \
|
|
372
|
+
--format table
|
|
373
|
+
|
|
374
|
+
# 查询我的下级(默认场景:未点名属性 → 姓名+工号;manage_relations_all 恒传 is_strand_id_in 为 true,values 传当前用户 employment_id,可通过 +basic-user-info 获取)
|
|
375
|
+
people-cli corehr +employee-filter \
|
|
376
|
+
--filters '[{"field_api_name":"employment.manage_relations_all","operator":"in","values":["<employment_id,可通过 +basic-user-info 获取>"],"is_strand_id_in":true}]' \
|
|
377
|
+
--display-fields '["employment.person.preferred_name","employment.employee_number"]' \
|
|
378
|
+
--format table
|
|
379
|
+
|
|
380
|
+
# 查询我的直线下级(默认场景:仅姓名+工号;direct_manager 恒传 is_strand_id_in 为 true)
|
|
381
|
+
people-cli corehr +employee-filter \
|
|
382
|
+
--filters '[{"field_api_name":"employment.direct_manager","operator":"in","values":["<employment_id,可通过 +basic-user-info 获取>"],"is_strand_id_in":true}]' \
|
|
383
|
+
--display-fields '["employment.person.preferred_name","employment.employee_number"]' \
|
|
384
|
+
--format table
|
|
385
|
+
|
|
386
|
+
# 查询我的虚线下级(默认场景:仅姓名+工号;dotted_line_manager 恒传 is_strand_id_in 为 true)
|
|
387
|
+
people-cli corehr +employee-filter \
|
|
388
|
+
--filters '[{"field_api_name":"employment.dotted_line_manager","operator":"in","values":["<employment_id,可通过 +basic-user-info 获取>"],"is_strand_id_in":true}]' \
|
|
389
|
+
--display-fields '["employment.person.preferred_name","employment.employee_number"]' \
|
|
390
|
+
--format table
|
|
391
|
+
|
|
392
|
+
# 翻页查询(默认场景:仅姓名+工号)
|
|
393
|
+
people-cli corehr +employee-filter \
|
|
394
|
+
--filters '[{"field_api_name":"employment.department","operator":"in","values":["7519409170505483820"],"is_strand_id_in":true}]' \
|
|
395
|
+
--display-fields '["employment.person.preferred_name","employment.employee_number"]' \
|
|
396
|
+
--search-after-key "上一次返回的key"
|
|
397
|
+
|
|
398
|
+
# 查询 CIS 部门下职级为 L4 的员工(默认场景:仅姓名+工号;直接传 value_names,命令内部自动名称→ID 解析)
|
|
399
|
+
people-cli corehr +employee-filter \
|
|
400
|
+
--filters '[{"field_api_name":"employment.department","operator":"in","value_names":["CIS"],"is_strand_id_in":true},{"field_api_name":"employment.job_level","operator":"eq","value_names":["L4"]}]' \
|
|
401
|
+
--display-fields '["employment.person.preferred_name","employment.employee_number"]' \
|
|
402
|
+
--format table
|
|
403
|
+
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# +employee-search
|
|
2
|
+
|
|
3
|
+
通过关键词搜索员工,支持按姓名、工号、邮箱搜索。
|
|
4
|
+
|
|
5
|
+
## 用法
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
people-cli corehr +employee-search --keyword <关键词> [flags]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 参数
|
|
12
|
+
|
|
13
|
+
| Flag | 类型 | 必填 | 默认值 | 说明 |
|
|
14
|
+
| ------------------- | ------ | -- | ------- | ---------------------------- |
|
|
15
|
+
| `--keyword` | string | 是 | - | 搜索关键词(员工姓名、工号或邮箱) |
|
|
16
|
+
| `--accept-language` | string | 否 | `zh-CN` | 响应语言:`zh-CN`(中文)、`en-US`(英文) |
|
|
17
|
+
|
|
18
|
+
### accept-language 选择策略
|
|
19
|
+
|
|
20
|
+
根据用户使用的语言自动选择:
|
|
21
|
+
|
|
22
|
+
- 用户使用**中文**时 → 使用 `zh-CN`(默认)
|
|
23
|
+
- 用户使用**英文**时 → 使用 `en-US`
|
|
24
|
+
- 不确定时默认使用 `zh-CN`
|
|
25
|
+
|
|
26
|
+
### 自动识别的规则
|
|
27
|
+
|
|
28
|
+
- 手机号:数字
|
|
29
|
+
- 工号:4-10位字符(英文 数字 下划线)
|
|
30
|
+
- 姓名:其他情况,默认按姓名搜索
|
|
31
|
+
|
|
32
|
+
## 所需权限
|
|
33
|
+
|
|
34
|
+
| Scope |
|
|
35
|
+
| -------------------------------------- |
|
|
36
|
+
| `corehr:employment_info_search:read` |
|
|
37
|
+
|
|
38
|
+
## 输出
|
|
39
|
+
|
|
40
|
+
### 强制按照这个字段顺序拼成表格进行输出
|
|
41
|
+
|
|
42
|
+
| 字段 | 说明 |
|
|
43
|
+
| ----------------- |-------|
|
|
44
|
+
| `name` | 员工姓名 |
|
|
45
|
+
| `employee_number` | 工号 |
|
|
46
|
+
| `employment_id` | 雇佣 ID |
|
|
47
|
+
|
|
48
|
+
## 基本用法
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# 搜索姓名包含"李"的员工
|
|
52
|
+
people-cli corehr +employee-search --keyword 李
|
|
53
|
+
|
|
54
|
+
# 搜索工号
|
|
55
|
+
people-cli corehr +employee-search --keyword 5916335
|
|
56
|
+
|
|
57
|
+
# 按邮箱搜索
|
|
58
|
+
people-cli corehr +employee-search --keyword user@example.com
|
|
59
|
+
# 按邮箱搜索 可不带后缀
|
|
60
|
+
people-cli corehr +employee-search --keyword user
|
|
61
|
+
|
|
62
|
+
# 英文输出
|
|
63
|
+
people-cli corehr +employee-search --keyword 李 --accept-language en-US
|
|
64
|
+
```
|
|
65
|
+
### 查看帮助
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# 查看corehr所有命令
|
|
69
|
+
people-cli corehr --help
|
|
70
|
+
# 查看+employee-search命令帮助
|
|
71
|
+
people-cli corehr +employee-search --help
|
|
72
|
+
|
|
73
|
+
```
|