uint/uint64全部改为uint32

This commit is contained in:
2025-11-10 22:23:31 +08:00
parent 3e711551e7
commit ecd2d37c70
96 changed files with 775 additions and 785 deletions

View File

@@ -74,15 +74,15 @@ const (
// Plan 代表系统中的一个计划,可以包含子计划或任务
type Plan struct {
gorm.Model
Model
Name PlanName `gorm:"not null" json:"name"`
Description string `json:"description"`
PlanType PlanType `gorm:"not null;index" json:"plan_type"` // 任务类型, 包括系统任务和用户自定义任务
ExecutionType PlanExecutionType `gorm:"not null;index" json:"execution_type"`
Status PlanStatus `gorm:"default:'已禁用';index" json:"status"` // 计划是否被启动
ExecuteNum uint `gorm:"default:0" json:"execute_num"` // 计划预期执行次数
ExecuteCount uint `gorm:"default:0" json:"execute_count"` // 执行计数器
ExecuteNum uint32 `gorm:"default:0" json:"execute_num"` // 计划预期执行次数
ExecuteCount uint32 `gorm:"default:0" json:"execute_count"` // 执行计数器
// 针对 PlanExecutionTypeAutomatic使用 Cron 表达式定义调度规则
CronExpression string `json:"cron_expression"`
@@ -163,12 +163,12 @@ func (p *Plan) ReorderSteps() {
// SubPlan 代表作为另一个计划一部分的子计划,具有执行顺序
type SubPlan struct {
gorm.Model
Model
ParentPlanID uint `gorm:"not null;index" json:"parent_plan_id"` // 父计划的ID
ChildPlanID uint `gorm:"not null;index" json:"child_plan_id"` // 子计划的ID (它本身也是一个 Plan)
ExecutionOrder int `gorm:"not null" json:"execution_order"` // 在父计划中的执行顺序
ChildPlan *Plan `gorm:"-" json:"child_plan"` // 完整子计划数据,仅内存中
ParentPlanID uint32 `gorm:"not null;index" json:"parent_plan_id"` // 父计划的ID
ChildPlanID uint32 `gorm:"not null;index" json:"child_plan_id"` // 子计划的ID (它本身也是一个 Plan)
ExecutionOrder int `gorm:"not null" json:"execution_order"` // 在父计划中的执行顺序
ChildPlan *Plan `gorm:"-" json:"child_plan"` // 完整子计划数据,仅内存中
}
// TableName 自定义 GORM 使用的数据库表名
@@ -184,7 +184,7 @@ type Task struct {
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"` // 保持软删除功能
PlanID uint `gorm:"not null;index" json:"plan_id"` // 此任务所属计划的ID
PlanID uint32 `gorm:"not null;index" json:"plan_id"` // 此任务所属计划的ID
Name string `gorm:"not null" json:"name"`
Description string `json:"description"`
ExecutionOrder int `gorm:"not null" json:"execution_order"` // 在计划中的执行顺序
@@ -229,9 +229,9 @@ func (t *Task) SaveParameters(v interface{}) error {
// DeviceTask 是设备和任务之间的关联模型,表示一个设备可以执行多个任务,一个任务可以被多个设备执行。
type DeviceTask struct {
gorm.Model
DeviceID uint `gorm:"not null;index"` // 设备ID
TaskID uint `gorm:"not null;index"` // 任务ID
Model
DeviceID uint32 `gorm:"not null;index"` // 设备ID
TaskID uint32 `gorm:"not null;index"` // 任务ID
// 可选:如果需要存储关联的额外信息,可以在这里添加字段,例如:
// Configuration datatypes.JSON `json:"configuration"` // 任务在特定设备上的配置