refactor(go): simplify identity table keys

This commit is contained in:
lingniu
2026-07-03 07:22:18 +08:00
parent 04bafb4cd6
commit bb0d001d72
4 changed files with 26 additions and 8 deletions

View File

@@ -69,6 +69,8 @@ NATS 部署在 Kafka ECS 内网 `172.17.111.56:4222`。
| `vehicle_realtime_location` | `protocol``vin``plate`、经纬度、速度、总里程、SOC、事件时间 | Realtime API/projector | 每协议每 VIN 最新位置业务缓存 |
| `vehicle_daily_mileage` | `vin``stat_date``protocol``daily_mileage_km`、首末总里程、样本数 | Stat writer | 基于总里程差值的每日里程;无 VIN 数据不进入正式统计表 |
身份表使用业务主键:`vehicle_identity_binding``vin` 为主键,`jt808_registration``phone` 为主键;两者不保留代理自增主键和 `created_at`
日里程表使用 `(vin, stat_date, protocol)` 作为业务主键,不保留自增 `id``created_at`;首末总里程和样本数保留用于解释差值计算。
两张实时当前态表均使用 `(protocol, vin)` 作为业务主键,不保留自增 `id``created_at`;最新更新时间使用 `updated_at`