From 3d8ee4c04aa8f87687f58acb8b3698b9f81baa4e Mon Sep 17 00:00:00 2001 From: zhangwei <894646498@qq.com> Date: Wed, 26 Jul 2023 17:33:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4service=E2=80=94=E2=80=94name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 4627f81f93893c495a393022560c17298e1bcc03 --- api/desc/core/pcm-core.api | 6 +- api/internal/logic/core/jobtotallogic.go | 28 +++------ api/internal/logic/core/tasklistlogic.go | 27 +++----- api/internal/mqs/kq/ScheduleAi.go | 13 +++- api/internal/mqs/kq/ScheduleHpc.go | 13 ++-- api/internal/types/types.go | 30 ++++----- model/aimodel.go | 14 ----- model/aimodel_gen.go | 13 ---- model/hpcmodel.go | 14 ----- model/hpcmodel_gen.go | 13 ---- model/taskmodel.go | 14 ----- model/taskmodel_gen.go | 68 ++++++--------------- rpc/internal/logic/pcmcore/infolistlogic.go | 6 +- 13 files changed, 75 insertions(+), 184 deletions(-) diff --git a/api/desc/core/pcm-core.api b/api/desc/core/pcm-core.api index 659ccf5a..06909457 100644 --- a/api/desc/core/pcm-core.api +++ b/api/desc/core/pcm-core.api @@ -199,7 +199,7 @@ type ( TaskId int64 `json:"taskId,optional"` TaskType string `json:"taskType,optional"` matchLabels map[string]string `json:"matchLabels"` - serviceName string `json:"serviceName"` + participantId string `json:"participantId"` metadata interface{} `json:"metadata"` } ) @@ -214,7 +214,7 @@ type ( TrainJob { Name string `json:"name"` Status string `json:"status"` - ServiceName string `json:"serviceName"` + ParticipantName string `json:"participantName"` SynergyStatus string `json:"synergyStatus"` Strategy int `json:"strategy"` } @@ -231,7 +231,7 @@ type ( Name string `json:"name"` Status string `json:"status"` Strategy int `json:"strategy"` - ServiceName string `json:"serviceName"` + ParticipantName string `json:"participantName"` SynergyStatus string `json:"synergyStatus"` } ) diff --git a/api/internal/logic/core/jobtotallogic.go b/api/internal/logic/core/jobtotallogic.go index 72bdefea..95a3fd1d 100644 --- a/api/internal/logic/core/jobtotallogic.go +++ b/api/internal/logic/core/jobtotallogic.go @@ -2,14 +2,12 @@ package core import ( "context" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" "gitlink.org.cn/jcce-pcm/pcm-coordinator/model" "gitlink.org.cn/jcce-pcm/utils/enum" "gitlink.org.cn/jcce-pcm/utils/tool" "k8s.io/apimachinery/pkg/util/json" - "strings" - - "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) @@ -68,7 +66,7 @@ func (l *JobTotalLogic) JobTotal() (resp *types.JobTotalResp, err error) { SynergyStatus: "未协同", } if job.Tasks[0].CenterName != nil { - trainJob.ServiceName = job.Tasks[0].CenterName[0] + trainJob.ParticipantName = job.Tasks[0].CenterName[0] } resp.TrainJobs = append(resp.TrainJobs, trainJob) } @@ -83,26 +81,18 @@ func (l *JobTotalLogic) JobTotal() (resp *types.JobTotalResp, err error) { return nil, nil } for _, task := range tasks { - tx := l.svcCtx.DbEngin.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.service_name) ,GROUP_CONCAT(DISTINCT a.service_name) ,GROUP_CONCAT(DISTINCT c.service_name))as service_name from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?", task.Id).Scan(&task.ServiceName) + tx := l.svcCtx.DbEngin.Raw("SELECT name from sc_participant_phy_info where id in (SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.participant_id) ,GROUP_CONCAT(DISTINCT a.participant_id) ,GROUP_CONCAT(DISTINCT c.participant_id))as service_name from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?)", task.Id).Scan(&task.ParticipantName) if tx.Error != nil { logx.Error(err) return nil, tx.Error } // 承接方转义 - if task.ServiceName != "" { - var names []string - servicesName := strings.Split(task.ServiceName, ",") - for _, name := range servicesName { - names = append(names, enum.Partner(name).String()) - } - task.ServiceName = strings.Join(names, ",") - } resp.TrainJobs = append(resp.TrainJobs, types.TrainJob{ - ServiceName: task.ServiceName, - Name: task.Name, - Strategy: int(task.Strategy), - SynergyStatus: enum.SynergyStatus(task.SynergyStatus).String(), - Status: task.Status, + ParticipantName: task.ParticipantName, + Name: task.Name, + Strategy: int(task.Strategy), + SynergyStatus: enum.SynergyStatus(task.SynergyStatus).String(), + Status: task.Status, }) } diff --git a/api/internal/logic/core/tasklistlogic.go b/api/internal/logic/core/tasklistlogic.go index 42325a58..5b6a2aa0 100644 --- a/api/internal/logic/core/tasklistlogic.go +++ b/api/internal/logic/core/tasklistlogic.go @@ -2,12 +2,10 @@ package core import ( "context" - "gitlink.org.cn/jcce-pcm/pcm-coordinator/model" - "gitlink.org.cn/jcce-pcm/utils/enum" - "strings" - "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/model" + "gitlink.org.cn/jcce-pcm/utils/enum" "github.com/zeromicro/go-zero/core/logx" ) @@ -40,26 +38,19 @@ func (l *TaskListLogic) TaskList() (resp *types.TaskListResp, err error) { return nil, nil } for _, task := range tasks { - tx := l.svcCtx.DbEngin.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.service_name) ,GROUP_CONCAT(DISTINCT a.service_name) ,GROUP_CONCAT(DISTINCT c.service_name))as service_name from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?", task.Id).Scan(&task.ServiceName) + tx := l.svcCtx.DbEngin.Raw("SELECT name from sc_participant_phy_info where id in (SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.participant_id) ,GROUP_CONCAT(DISTINCT a.participant_id) ,GROUP_CONCAT(DISTINCT c.participant_id))as service_name from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?)", task.Id).Scan(&task.ParticipantName) if tx.Error != nil { logx.Error(err) return nil, tx.Error } // 承接方转义 - if task.ServiceName != "" { - var names []string - servicesName := strings.Split(task.ServiceName, ",") - for _, name := range servicesName { - names = append(names, enum.Partner(name).String()) - } - task.ServiceName = strings.Join(names, ",") - } + resp.Tasks = append(resp.Tasks, types.Task{ - ServiceName: task.ServiceName, - Name: task.Name, - Strategy: int(task.Strategy), - SynergyStatus: enum.SynergyStatus(task.SynergyStatus).String(), - Status: task.Status, + ParticipantName: task.ParticipantName, + Name: task.Name, + Strategy: int(task.Strategy), + SynergyStatus: enum.SynergyStatus(task.SynergyStatus).String(), + Status: task.Status, }) } diff --git a/api/internal/mqs/kq/ScheduleAi.go b/api/internal/mqs/kq/ScheduleAi.go index 857c2919..02b050ed 100644 --- a/api/internal/mqs/kq/ScheduleAi.go +++ b/api/internal/mqs/kq/ScheduleAi.go @@ -3,6 +3,7 @@ package kq import ( "context" "encoding/json" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/pkg/scheduler" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" "gitlink.org.cn/jcce-pcm/pcm-coordinator/model" @@ -29,10 +30,16 @@ func (l *ScheduleAiMq) Consume(_, val string) error { // 接受消息 var task *types.TaskInfo json.Unmarshal([]byte(val), &task) + + participantId, err := scheduler.MatchLabels(l.svcCtx.DbEngin, task) + if err != nil { + return err + } ai := model.Ai{ - TaskId: task.TaskId, - Status: "Saved", - YamlString: val, + ParticipantId: participantId[0], + TaskId: task.TaskId, + Status: "Saved", + YamlString: val, } tool.Convert(task.Metadata, &ai) // 存储数据 diff --git a/api/internal/mqs/kq/ScheduleHpc.go b/api/internal/mqs/kq/ScheduleHpc.go index af5bc4d7..8cbffefe 100644 --- a/api/internal/mqs/kq/ScheduleHpc.go +++ b/api/internal/mqs/kq/ScheduleHpc.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "github.com/zeromicro/go-zero/core/logx" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/pkg/scheduler" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" "gitlink.org.cn/jcce-pcm/pcm-coordinator/model" @@ -30,11 +31,15 @@ func (l *ScheduleHpcMq) Consume(_, val string) error { // 接受消息 var task *types.TaskInfo json.Unmarshal([]byte(val), &task) + participantId, err := scheduler.MatchLabels(l.svcCtx.DbEngin, task) + if err != nil { + return err + } hpc := model.Hpc{ - TaskId: task.TaskId, - Status: "Saved", - ServiceName: task.TaskType, - YamlString: val, + TaskId: task.TaskId, + Status: "Saved", + ParticipantId: participantId[0], + YamlString: val, } tool.Convert(task.Metadata, &hpc) // 存储数据 diff --git a/api/internal/types/types.go b/api/internal/types/types.go index 92e2f6f4..a27aaca6 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -176,11 +176,11 @@ type ScheduleTaskReq struct { } type TaskInfo struct { - TaskId int64 `json:"taskId,optional"` - TaskType string `json:"taskType,optional"` - MatchLabels map[string]string `json:"matchLabels"` - ServiceName string `json:"serviceName"` - Metadata interface{} `json:"metadata"` + TaskId int64 `json:"taskId,optional"` + TaskType string `json:"taskType,optional"` + MatchLabels map[string]string `json:"matchLabels"` + ParticipantId string `json:"participantId"` + Metadata interface{} `json:"metadata"` } type JobTotalResp struct { @@ -191,11 +191,11 @@ type JobTotalResp struct { } type TrainJob struct { - Name string `json:"name"` - Status string `json:"status"` - ServiceName string `json:"serviceName"` - SynergyStatus string `json:"synergyStatus"` - Strategy int `json:"strategy"` + Name string `json:"name"` + Status string `json:"status"` + ParticipantName string `json:"participantName"` + SynergyStatus string `json:"synergyStatus"` + Strategy int `json:"strategy"` } type TaskListResp struct { @@ -206,11 +206,11 @@ type TaskListResp struct { } type Task struct { - Name string `json:"name"` - Status string `json:"status"` - Strategy int `json:"strategy"` - ServiceName string `json:"serviceName"` - SynergyStatus string `json:"synergyStatus"` + Name string `json:"name"` + Status string `json:"status"` + Strategy int `json:"strategy"` + ParticipantName string `json:"participantName"` + SynergyStatus string `json:"synergyStatus"` } type ListCenterResp struct { diff --git a/model/aimodel.go b/model/aimodel.go index 9362b784..05a6cae0 100644 --- a/model/aimodel.go +++ b/model/aimodel.go @@ -1,12 +1,5 @@ package model -import ( - "github.com/zeromicro/go-zero/core/stores/cache" - "github.com/zeromicro/go-zero/core/stores/sqlx" -) - -var _ AiModel = (*customAiModel)(nil) - type ( // AiModel is an interface to be customized, add more methods here, // and implement the added methods in customAiModel. @@ -18,10 +11,3 @@ type ( *defaultAiModel } ) - -// NewAiModel returns a model for the database table. -func NewAiModel(conn sqlx.SqlConn, c cache.CacheConf) AiModel { - return &customAiModel{ - defaultAiModel: newAiModel(conn), - } -} diff --git a/model/aimodel_gen.go b/model/aimodel_gen.go index 696e2287..71c04124 100644 --- a/model/aimodel_gen.go +++ b/model/aimodel_gen.go @@ -49,7 +49,6 @@ type ( UpdatedBy int64 `db:"updated_by"` // 更新人 UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间 DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) - ServiceName string `db:"service_name"` Result string `db:"result"` YamlString string `db:"yaml_string"` JobId string `db:"job_id"` @@ -102,18 +101,6 @@ func (m *defaultAiModel) FindOneByServiceNameProjectIdName(ctx context.Context, } } -func (m *defaultAiModel) Insert(ctx context.Context, data *Ai) (sql.Result, error) { - query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, aiRowsExpectAutoSet) - ret, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.ProjectId, data.Name, data.Status, data.StartTime, data.RunningTime, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.ServiceName, data.Result, data.YamlString) - return ret, err -} - -func (m *defaultAiModel) Update(ctx context.Context, newData *Ai) error { - query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, aiRowsWithPlaceHolder) - _, err := m.conn.ExecCtx(ctx, query, newData.TaskId, newData.ProjectId, newData.Name, newData.Status, newData.StartTime, newData.RunningTime, newData.CreatedBy, newData.CreatedTime, newData.UpdatedBy, newData.UpdatedTime, newData.DeletedFlag, newData.ServiceName, newData.Result, newData.YamlString, newData.Id) - return err -} - func (m *defaultAiModel) tableName() string { return m.table } diff --git a/model/hpcmodel.go b/model/hpcmodel.go index 32b5469e..460263b7 100644 --- a/model/hpcmodel.go +++ b/model/hpcmodel.go @@ -1,12 +1,5 @@ package model -import ( - "github.com/zeromicro/go-zero/core/stores/cache" - "github.com/zeromicro/go-zero/core/stores/sqlx" -) - -var _ HpcModel = (*customHpcModel)(nil) - type ( // HpcModel is an interface to be customized, add more methods here, // and implement the added methods in customHpcModel. @@ -18,10 +11,3 @@ type ( *defaultHpcModel } ) - -// NewHpcModel returns a model for the database table. -func NewHpcModel(conn sqlx.SqlConn, c cache.CacheConf) HpcModel { - return &customHpcModel{ - defaultHpcModel: newHpcModel(conn), - } -} diff --git a/model/hpcmodel_gen.go b/model/hpcmodel_gen.go index 347ede7e..4d70e005 100644 --- a/model/hpcmodel_gen.go +++ b/model/hpcmodel_gen.go @@ -40,7 +40,6 @@ type ( TaskId int64 `db:"task_id"` // 任务id ParticipantId int64 `db:"participant_id"` // 集群静态信息id JobId string `db:"job_id"` // 作业id - ServiceName string `db:"service_name"` // 服务名称 Name string `db:"name"` // 名称 Status string `db:"status"` // 状态 StartTime string `db:"start_time"` // 开始时间 @@ -109,18 +108,6 @@ func (m *defaultHpcModel) FindOneByServiceNameName(ctx context.Context, serviceN } } -func (m *defaultHpcModel) Insert(ctx context.Context, data *Hpc) (sql.Result, error) { - query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, hpcRowsExpectAutoSet) - ret, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.JobId, data.ServiceName, data.Name, data.Status, data.StartTime, data.RunningTime, data.CardCount, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.WorkDir, data.WallTime, data.Result, data.YamlString) - return ret, err -} - -func (m *defaultHpcModel) Update(ctx context.Context, newData *Hpc) error { - query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, hpcRowsWithPlaceHolder) - _, err := m.conn.ExecCtx(ctx, query, newData.TaskId, newData.JobId, newData.ServiceName, newData.Name, newData.Status, newData.StartTime, newData.RunningTime, newData.CardCount, newData.CreatedBy, newData.CreatedTime, newData.UpdatedBy, newData.UpdatedTime, newData.DeletedFlag, newData.WorkDir, newData.WallTime, newData.Result, newData.YamlString, newData.Id) - return err -} - func (m *defaultHpcModel) tableName() string { return m.table } diff --git a/model/taskmodel.go b/model/taskmodel.go index 169e9316..7f1aee2d 100644 --- a/model/taskmodel.go +++ b/model/taskmodel.go @@ -1,12 +1,5 @@ package model -import ( - "github.com/zeromicro/go-zero/core/stores/cache" - "github.com/zeromicro/go-zero/core/stores/sqlx" -) - -var _ TaskModel = (*customTaskModel)(nil) - type ( // TaskModel is an interface to be customized, add more methods here, // and implement the added methods in customTaskModel. @@ -18,10 +11,3 @@ type ( *defaultTaskModel } ) - -// NewTaskModel returns a model for the database table. -func NewTaskModel(conn sqlx.SqlConn, c cache.CacheConf) TaskModel { - return &customTaskModel{ - defaultTaskModel: newTaskModel(conn), - } -} diff --git a/model/taskmodel_gen.go b/model/taskmodel_gen.go index ddb3cc8c..1ca281c4 100644 --- a/model/taskmodel_gen.go +++ b/model/taskmodel_gen.go @@ -5,12 +5,10 @@ package model import ( "context" "database/sql" - "fmt" "strings" "time" "github.com/zeromicro/go-zero/core/stores/builder" - "github.com/zeromicro/go-zero/core/stores/sqlc" "github.com/zeromicro/go-zero/core/stores/sqlx" "github.com/zeromicro/go-zero/core/stringx" ) @@ -36,23 +34,23 @@ type ( } Task struct { - Id int64 `db:"id"` // id - Name string `db:"name"` // 作业名称 - Description string `db:"description"` // 作业描述 - Status string `db:"status"` // 作业状态 - Strategy int64 `db:"strategy"` // 策略 - SynergyStatus int64 `db:"synergy_status"` // 协同状态(0-未协同、1-已协同) - StartTime time.Time `db:"start_time"` // 开始运行时间 - EndTime string `db:"end_time"` // 结束运行时间 - RunningTime int64 `db:"running_time"` // 已运行时间(单位秒) - YamlString string `db:"yaml_string"` - Result string `db:"result"` // 作业结果 - CreatedBy int64 `db:"created_by"` // 创建人 - CreatedTime time.Time `db:"created_time"` // 创建时间 - UpdatedBy int64 `db:"updated_by"` // 更新人 - UpdatedTime time.Time `db:"updated_time"` // 更新时间 - DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) - ServiceName string `db:"service_name"` + Id int64 `db:"id"` // id + Name string `db:"name"` // 作业名称 + Description string `db:"description"` // 作业描述 + Status string `db:"status"` // 作业状态 + Strategy int64 `db:"strategy"` // 策略 + SynergyStatus int64 `db:"synergy_status"` // 协同状态(0-未协同、1-已协同) + StartTime time.Time `db:"start_time"` // 开始运行时间 + EndTime string `db:"end_time"` // 结束运行时间 + RunningTime int64 `db:"running_time"` // 已运行时间(单位秒) + YamlString string `db:"yaml_string"` + Result string `db:"result"` // 作业结果 + CreatedBy int64 `db:"created_by"` // 创建人 + CreatedTime time.Time `db:"created_time"` // 创建时间 + UpdatedBy int64 `db:"updated_by"` // 更新人 + UpdatedTime time.Time `db:"updated_time"` // 更新时间 + DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) + ParticipantName string `db:"participant_name"` } ) @@ -63,38 +61,6 @@ func newTaskModel(conn sqlx.SqlConn) *defaultTaskModel { } } -func (m *defaultTaskModel) Delete(ctx context.Context, id int64) error { - query := fmt.Sprintf("delete from %s where `id` = ?", m.table) - _, err := m.conn.ExecCtx(ctx, query, id) - return err -} - -func (m *defaultTaskModel) FindOne(ctx context.Context, id int64) (*Task, error) { - query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", taskRows, m.table) - var resp Task - err := m.conn.QueryRowCtx(ctx, &resp, query, id) - switch err { - case nil: - return &resp, nil - case sqlc.ErrNotFound: - return nil, ErrNotFound - default: - return nil, err - } -} - -func (m *defaultTaskModel) Insert(ctx context.Context, data *Task) (sql.Result, error) { - query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, taskRowsExpectAutoSet) - ret, err := m.conn.ExecCtx(ctx, query, data.Name, data.Description, data.Status, data.Strategy, data.SynergyStatus, data.StartTime, data.EndTime, data.RunningTime, data.YamlString, data.Result, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.ServiceName) - return ret, err -} - -func (m *defaultTaskModel) Update(ctx context.Context, data *Task) error { - query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, taskRowsWithPlaceHolder) - _, err := m.conn.ExecCtx(ctx, query, data.Name, data.Description, data.Status, data.Strategy, data.SynergyStatus, data.StartTime, data.EndTime, data.RunningTime, data.YamlString, data.Result, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.ServiceName, data.Id) - return err -} - func (m *defaultTaskModel) tableName() string { return m.table } diff --git a/rpc/internal/logic/pcmcore/infolistlogic.go b/rpc/internal/logic/pcmcore/infolistlogic.go index 205c50e5..ecbf4c05 100644 --- a/rpc/internal/logic/pcmcore/infolistlogic.go +++ b/rpc/internal/logic/pcmcore/infolistlogic.go @@ -31,7 +31,7 @@ func (l *InfoListLogic) InfoList(in *pcmCore.InfoListReq) (*pcmCore.InfoListResp switch in.Kind { case "hpc": var hpcModelList []model.Hpc - tx := l.svcCtx.DbEngin.Where("service_name = ? AND status NOT IN ?", in.ParticipantId, []string{"Succeed", "Completed"}).Find(&hpcModelList) + tx := l.svcCtx.DbEngin.Where("participant_id = ? AND status NOT IN ?", in.ParticipantId, []string{"Succeed", "Completed"}).Find(&hpcModelList) if tx.Error != nil { return nil, tx.Error } @@ -40,7 +40,7 @@ func (l *InfoListLogic) InfoList(in *pcmCore.InfoListReq) (*pcmCore.InfoListResp result.HpcInfoList = hpcInfoList case "cloud": var cloudModelList []model.Cloud - tx := l.svcCtx.DbEngin.Where("service_name = ? AND status NOT IN ?", in.ParticipantId, []string{"Succeed", "Completed"}).Find(&cloudModelList) + tx := l.svcCtx.DbEngin.Where("participant_id = ? AND status NOT IN ?", in.ParticipantId, []string{"Succeed", "Completed"}).Find(&cloudModelList) if tx.Error != nil { return nil, tx.Error } @@ -49,7 +49,7 @@ func (l *InfoListLogic) InfoList(in *pcmCore.InfoListReq) (*pcmCore.InfoListResp result.CloudInfoList = cloudInfoList case "ai": var aiModelList []model.Ai - tx := l.svcCtx.DbEngin.Where("service_name = ? AND status NOT IN ?", in.ParticipantId, []string{"Succeed", "Completed"}).Find(&aiModelList) + tx := l.svcCtx.DbEngin.Where("participant_id = ? AND status NOT IN ?", in.ParticipantId, []string{"Succeed", "Completed"}).Find(&aiModelList) if tx.Error != nil { return nil, tx.Error }