From 3af1b4949faccf2aadf2f6fb6017706e21dd2120 Mon Sep 17 00:00:00 2001 From: huang <1724659546@qq.com> Date: Fri, 19 Sep 2025 13:35:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=88=9B=E5=BB=BA/=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E6=8C=87=E5=AE=9A=E6=89=A7=E8=A1=8C=E6=AC=A1?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/app/controller/plan/converter.go | 2 ++ internal/app/controller/plan/plan_controller.go | 2 ++ internal/infra/repository/plan_repository.go | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/app/controller/plan/converter.go b/internal/app/controller/plan/converter.go index 4af0d70..8410c14 100644 --- a/internal/app/controller/plan/converter.go +++ b/internal/app/controller/plan/converter.go @@ -53,6 +53,7 @@ func PlanFromCreateRequest(req *CreatePlanRequest) (*models.Plan, error) { Name: req.Name, Description: req.Description, ExecutionType: req.ExecutionType, + ExecuteNum: req.ExecuteNum, CronExpression: req.CronExpression, ContentType: req.ContentType, } @@ -99,6 +100,7 @@ func PlanFromUpdateRequest(req *UpdatePlanRequest) (*models.Plan, error) { Name: req.Name, Description: req.Description, ExecutionType: req.ExecutionType, + ExecuteNum: req.ExecuteNum, CronExpression: req.CronExpression, ContentType: req.ContentType, } diff --git a/internal/app/controller/plan/plan_controller.go b/internal/app/controller/plan/plan_controller.go index 42d15f5..604d6cd 100644 --- a/internal/app/controller/plan/plan_controller.go +++ b/internal/app/controller/plan/plan_controller.go @@ -20,6 +20,7 @@ type CreatePlanRequest struct { Name string `json:"name" binding:"required" example:"猪舍温度控制计划"` Description string `json:"description" example:"根据温度自动调节风扇和加热器"` 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 * * *"` ContentType models.PlanContentType `json:"content_type" binding:"required" example:"tasks"` SubPlanIDs []uint `json:"sub_plan_ids,omitempty"` @@ -52,6 +53,7 @@ type UpdatePlanRequest struct { Name string `json:"name" example:"猪舍温度控制计划V2"` Description string `json:"description" example:"更新后的描述"` 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 * * *"` ContentType models.PlanContentType `json:"content_type" example:"tasks"` SubPlanIDs []uint `json:"sub_plan_ids,omitempty"` diff --git a/internal/infra/repository/plan_repository.go b/internal/infra/repository/plan_repository.go index f9d7a03..e32236d 100644 --- a/internal/infra/repository/plan_repository.go +++ b/internal/infra/repository/plan_repository.go @@ -275,7 +275,7 @@ func (r *gormPlanRepository) reconcilePlanNode(tx *gorm.DB, plan *models.Plan) e return nil } // 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 }