Files
AI-Check-Test/.gitea/checker/notify-templates/field-description.md
dongzi e367d4257f
All checks were successful
类变更检测 / class-change-check (push) Successful in 14s
字段修改匹配规则优化
2026-06-08 16:16:39 +08:00

56 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 字段说明规则
字段变更采用 **引用块 + 单行合并 + font 颜色**,遵循企微 `markdown` v1不支持列表
## 说明提取优先级
| 优先级 | 来源 |
|:------:|------|
| 1 | `@Schema(description = "...")` |
| 2 | `@ApiModelProperty` |
| 3 | `/** ... */` 字段注释 |
| 4 | 空串 |
## 字段变更行格式
每条变更占**一行**,标签、说明、类型横向排列,冒号后两空格:
```
> **共 <font color="warning">2</font> 项变更**
> <font color="warning">[重命名]</font> <font color="comment">taskId</font> → <font color="info">taskIds</font> 说明: <font color="comment">流程主键</font>
> <font color="warning">[删除]</font> `changeUserNickName` 说明: <font color="comment">变更人员别名</font>
```
| 操作 | 标签 | 类型段 |
|------|------|--------|
| 新增 | info `[新增]` | 无 |
| 删除 | warning `[删除]` | 无 |
| 修改 | warning `[修改]` | 仅类型变化时出现 |
| 重命名 | warning `[重命名]` | 说明匹配时合并删除+新增;类型变化时附带类型行 |
### 重命名配对规则
- 删除+新增且**类型相同、说明相同**(非空)→ `[重命名]`
- 删除+新增且**说明相同但类型不同** → `[重命名]` + 类型行
- 说明均为空时也可配对
- 说明不同则不配对,保持删除+新增
- 统计行加粗,数字用 warning橙色文案为「共 N 项变更」(不含「字段」)
- 多条变更之间用**空行**分隔
- 说明为空时显示 `<font color="comment">(无说明)</font>`
- 头部四行加粗,用 `quoteKvBold`;不要在 `<font>` 内嵌 `**bold**`
## 接口行格式
```
> <font color="info">POST</font> `/apply/clockIn`
```
## 实现
- `ClassFieldParser.extractFieldLabel()`
- `FieldDiffEngine` — 类型变化产生 `[修改]`,说明匹配的删除+新增合并为 `[重命名]`
- `WeComNotifier.formatFieldChange()`