From 3af45c77fba5810b746a0859be0b93faa96b9fb4 Mon Sep 17 00:00:00 2001 From: taolx0 Date: Thu, 27 Jul 2023 14:27:12 +0800 Subject: [PATCH] chore:store task executor user list --- sqle/model/workflow.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sqle/model/workflow.go b/sqle/model/workflow.go index 824e5b31d0..6767f2a7e5 100644 --- a/sqle/model/workflow.go +++ b/sqle/model/workflow.go @@ -423,8 +423,9 @@ func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User, allExecutor[i] = executor instanceRecords[i] = &WorkflowInstanceRecord{ - TaskId: task.ID, - InstanceId: task.InstanceId, + TaskId: task.ID, + InstanceId: task.InstanceId, + ExecutorUserList: executor, } } @@ -466,6 +467,13 @@ func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User, return errors.New(errors.ConnectStorageError, err) } + for _, instanceRecord := range record.InstanceRecords { + if tx.Model(instanceRecord).Association("ExecutorUserList").Replace(instanceRecord.ExecutorUserList).Error != nil { + tx.Rollback() + return errors.New(errors.ConnectStorageError, err) + } + } + workflow.WorkflowRecordId = record.ID err = tx.Save(workflow).Error if err != nil {