ai_scheduler/internal/biz/task.go

36 lines
722 B
Go

package biz
import (
"ai_scheduler/internal/data/impl"
"ai_scheduler/internal/data/model"
"ai_scheduler/internal/entitys"
"context"
"xorm.io/builder"
"ai_scheduler/internal/config"
)
type TaskBiz struct {
taskRepo *impl.TaskImpl
conf *config.Config
}
func NewTaskBiz(conf *config.Config, taskRepo *impl.TaskImpl) *TaskBiz {
return &TaskBiz{
taskRepo: taskRepo,
conf: conf,
}
}
// taskList 功能列表
func (t *TaskBiz) TaskList(ctx context.Context, req *entitys.TaskRequest) (list []model.AiTask, err error) {
cond := builder.NewCond()
cond = cond.And(builder.Eq{"status": 1})
cond = cond.And(builder.Eq{"sys_id": req.SysId})
err = t.taskRepo.GetRangeToMapStruct(&cond, &list)
return
}