定义执行历史和执行队列model, 以及基础的增删改查功能

This commit is contained in:
2025-09-16 23:11:07 +08:00
parent 8980c29b07
commit 3271f820d4
7 changed files with 264 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ package models
import (
"fmt"
"sort"
"time"
"gorm.io/datatypes"
"gorm.io/gorm"
@@ -133,7 +134,11 @@ func (SubPlan) TableName() string {
// Task 代表计划中的一个任务,具有执行顺序
type Task struct {
gorm.Model
// 手动定义字段以将 ID 类型设置为 int以匹配 TaskExecutionLog 中的 TaskID
ID int `gorm:"primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"` // 保持软删除功能
PlanID uint `gorm:"not null;index" json:"plan_id"` // 此任务所属计划的ID
Name string `gorm:"not null" json:"name"`