All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 51s
29 lines
1.2 KiB
Markdown
29 lines
1.2 KiB
Markdown
## Context
|
|
|
|
事件投影已批量加载资源,但未加载 `tb_integration_log`;请求和关联时间线已有按 `audit_event_id` 归集集成引用的逻辑。
|
|
|
|
## Goals / Non-Goals
|
|
|
|
**Goals:**
|
|
- 为列表和详情的事件投影一次批量补全稳定集成交互引用。
|
|
- 复用现有去重规则,保持空数组响应形态。
|
|
|
|
**Non-Goals:**
|
|
- 不通过请求、关联标识、资源、名称或时间推断关联。
|
|
- 不变更 Integration Log 写入链路、数据库结构或现有时间线行为。
|
|
|
|
## Decisions
|
|
|
|
- 在事件投影中使用当前页/当前详情的内部审计事件 ID 批量查询 `tb_integration_log.audit_event_id IN (...)`,再按 ID 归集。该字段是唯一明确的事件归属;逐事件查询会造成 N+1 查询。
|
|
- 复用 `integrationRefsByAuditID` 和 `uniqueIntegrationRefs`。不增加新的查询层或 DTO。
|
|
|
|
## Risks / Trade-offs
|
|
|
|
- [历史集成日志未写入 `audit_event_id`] → 保持为空,不猜测关系;由写入链路后续补齐新数据。
|
|
|
|
## Migration Plan
|
|
|
|
1. 部署查询代码变更,无迁移。
|
|
2. 用同时存在关联与未关联日志的事件验证列表和详情响应。
|
|
3. 回滚时恢复事件投影的关联日志批量查询与引用合并代码。
|