Files
shanxia2.0/docs/data-migration/phase-0-foundation/step-01-dict.md
T
2026-07-13 20:26:43 +08:00

62 lines
1.6 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.
# P0-1:字典数据
> **结论(2026-07-12)**:sx 与门户快照 **同名类型下字典项无差异**,**无需批量导入**;仅做验收确认。
---
## 1. 分析过程
### 1.1 工具
```bash
cd backend && source venv/bin/activate
python scripts/compare_dict_snapshots.py
```
脚本对比:
- 源:`docs/sql/sx.sql`(`sys_dict_type` / `sys_dict_data`)
- 目标:`docs/sql/shanxia2.0.sql`
### 1.2 对比结果摘要
| 指标 | sx.sql | shanxia2.0.sql |
|------|--------|----------------|
| 字典类型数 | 240 | 276 |
| 字典项数 | 4658 | 4771 |
| 类型码一致 | 239/240 | — |
| 同名类型下项差异 | **0** | — |
说明:
- sx 多 1 个无效类型 `0` / `cw_attachment_type`(0 项),可忽略。
- 门户多 37 个类型(`pl_*` 运输、`wf_*` 工作流、`crm_pool_*`、门户别名等),为 2.0 新增能力,非迁移缺口。
- 报销、地磅**无独立字典表**;状态多在代码或字段枚举中。
### 1.3 决策
| 决策项 | 结论 |
|--------|------|
| 是否执行批量 INSERT | **否** |
| 生产切换前动作 | 对账 + 抽 5 个 CRM 业务用到的 dict_type 在门户 API 可查 |
---
## 2. 验收标准
- [ ] `GET /api/web/admin/dict-data/all` 含 `sys_normal_disable`、`crm_*` 等 CRM 页用到的类型
- [ ] 产品分类页 `sys_normal_disable`:0=正常、1=停用 与源语义一致
- [ ] 无业务页因缺字典项白屏或显示 raw value
---
## 3. 执行日志
若仅做验收、无写库操作,在 `logs/` 追加:
`logs/YYYY-MM-DD-HHMM-dict-verify.md`
记录:对比脚本输出摘要、API 抽样 dict_type 列表、验收人。
**本步骤无 `mappings/` 产物。**