MarketingSystemDataExportTool/docs/field_mapping_rules.md

16 lines
1004 B
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.

# 字段映射与导出校验规则
- 模板字段按保存顺序导出,严格保持数量与顺序一致。
- YMT 物理表名 `order_info.*` 在模板保存时可使用,导出阶段统一标准化为逻辑 `order.*`
- 营销系统立减金批次别名:`order_voucher.channel_batch_no` 标准化为 `order_voucher.channel_activity_id`
- 白名单校验:所有字段必须在白名单中(见 `server/internal/schema/fields.go`),否则导出拒绝并提示具体字段列表。
- 不做自动去重:如模板包含同名或同义字段,将按模板原样导出。
- SQL 构建使用列别名 `AS \`table.field\``,表头通过 `FieldLabels()` 映射中文名。
## 失败返回
- 若模板字段不在白名单HTTP 400`模板字段不在白名单: <列表>`。
- 若字段数量不一致,将在日志记录 `field_count_mismatch` 事件供排查。
## 测试
- 单元测试 `server/internal/exporter/sqlbuilder_test.go` 验证别名数量与模板字段数量一致。