diff --git a/internal/query/audit/events.go b/internal/query/audit/events.go index ce44dde..66fa5df 100644 --- a/internal/query/audit/events.go +++ b/internal/query/audit/events.go @@ -310,6 +310,11 @@ func (q *Query) project(ctx context.Context, rows []model.AuditEvent) ([]EventVi Order("audit_event_id ASC, sort_order ASC, id ASC").Find(&resources).Error; err != nil { return nil, errors.Wrap(errors.CodeDatabaseError, err, "批量查询审计事件资源失败") } + var integrationRows []model.IntegrationLog + if err := q.db.WithContext(ctx).Where("audit_event_id IN ?", ids).Find(&integrationRows).Error; err != nil { + return nil, errors.Wrap(errors.CodeDatabaseError, err, "批量查询审计事件外部交互引用失败") + } + integrationByAudit := integrationRefsByAuditID(integrationRows) resourcesByEvent := make(map[uint][]ResourceView, len(rows)) for _, resource := range resources { view, err := projectResource(resource) @@ -342,6 +347,7 @@ func (q *Query) project(ctx context.Context, rows []model.AuditEvent) ([]EventVi items[index].Resources = []ResourceView{} } items[index].InvestigationRefs = investigationRefs(row, items[index].Resources) + items[index].InvestigationRefs.IntegrationRefs = uniqueIntegrationRefs(integrationByAudit[row.ID]) } return items, nil }