issue-5 #8

Merged
huang merged 13 commits from issue-5 into main 2025-09-21 12:43:59 +08:00
3 changed files with 5 additions and 1 deletions
Showing only changes of commit 3af1b4949f - Show all commits

View File

@@ -53,6 +53,7 @@ func PlanFromCreateRequest(req *CreatePlanRequest) (*models.Plan, error) {
Name: req.Name, Name: req.Name,
Description: req.Description, Description: req.Description,
ExecutionType: req.ExecutionType, ExecutionType: req.ExecutionType,
ExecuteNum: req.ExecuteNum,
CronExpression: req.CronExpression, CronExpression: req.CronExpression,
ContentType: req.ContentType, ContentType: req.ContentType,
} }
@@ -99,6 +100,7 @@ func PlanFromUpdateRequest(req *UpdatePlanRequest) (*models.Plan, error) {
Name: req.Name, Name: req.Name,
Description: req.Description, Description: req.Description,
ExecutionType: req.ExecutionType, ExecutionType: req.ExecutionType,
ExecuteNum: req.ExecuteNum,
CronExpression: req.CronExpression, CronExpression: req.CronExpression,
ContentType: req.ContentType, ContentType: req.ContentType,
} }

View File

@@ -20,6 +20,7 @@ type CreatePlanRequest struct {
Name string `json:"name" binding:"required" example:"猪舍温度控制计划"` Name string `json:"name" binding:"required" example:"猪舍温度控制计划"`
Description string `json:"description" example:"根据温度自动调节风扇和加热器"` Description string `json:"description" example:"根据温度自动调节风扇和加热器"`
ExecutionType models.PlanExecutionType `json:"execution_type" binding:"required" example:"automatic"` ExecutionType models.PlanExecutionType `json:"execution_type" binding:"required" example:"automatic"`
ExecuteNum uint `json:"execute_num,omitempty" example:"10"`
CronExpression string `json:"cron_expression" example:"0 0 6 * * *"` CronExpression string `json:"cron_expression" example:"0 0 6 * * *"`
ContentType models.PlanContentType `json:"content_type" binding:"required" example:"tasks"` ContentType models.PlanContentType `json:"content_type" binding:"required" example:"tasks"`
SubPlanIDs []uint `json:"sub_plan_ids,omitempty"` SubPlanIDs []uint `json:"sub_plan_ids,omitempty"`
@@ -52,6 +53,7 @@ type UpdatePlanRequest struct {
Name string `json:"name" example:"猪舍温度控制计划V2"` Name string `json:"name" example:"猪舍温度控制计划V2"`
Description string `json:"description" example:"更新后的描述"` Description string `json:"description" example:"更新后的描述"`
ExecutionType models.PlanExecutionType `json:"execution_type" example:"automatic"` ExecutionType models.PlanExecutionType `json:"execution_type" example:"automatic"`
ExecuteNum uint `json:"execute_num,omitempty" example:"10"`
CronExpression string `json:"cron_expression" example:"0 0 6 * * *"` CronExpression string `json:"cron_expression" example:"0 0 6 * * *"`
ContentType models.PlanContentType `json:"content_type" example:"tasks"` ContentType models.PlanContentType `json:"content_type" example:"tasks"`
SubPlanIDs []uint `json:"sub_plan_ids,omitempty"` SubPlanIDs []uint `json:"sub_plan_ids,omitempty"`

View File

@@ -275,7 +275,7 @@ func (r *gormPlanRepository) reconcilePlanNode(tx *gorm.DB, plan *models.Plan) e
return nil return nil
} }
// 1. 更新节点本身的基础字段 // 1. 更新节点本身的基础字段
if err := tx.Model(plan).Select("Name", "Description", "ExecutionType", "CronExpression", "ContentType").Updates(plan).Error; err != nil { if err := tx.Model(plan).Select("Name", "Description", "ExecutionType", "ExecuteNum", "CronExpression", "ContentType").Updates(plan).Error; err != nil {
return err return err
} }