package hpc import ( "context" "github.com/rs/zerolog/log" "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type GetHpcAppClusterLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewGetHpcAppClusterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHpcAppClusterLogic { return &GetHpcAppClusterLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *GetHpcAppClusterLogic) GetHpcAppCluster(req *types.HpcAppClusterReq) (resp *types.ListResult, err error) { resp = &types.ListResult{} var clusterIds []string err = l.svcCtx.DbEngin.Table("hpc_app_template").Distinct("cluster_id"). Where(" app = ? and status = 1 and deleted_at is null", req.App). Find(&clusterIds).Error if err != nil { log.Error().Msgf("GetHpcAppCluster err:%v", err) return nil, err } resp.List = clusterIds return }