controller调整, 增加计划类型

This commit is contained in:
2025-10-29 16:25:39 +08:00
parent 94e8768424
commit 1ee3e638f7
6 changed files with 149 additions and 64 deletions

View File

@@ -2,6 +2,13 @@ package dto
import "git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
// ListPlansQuery 定义了获取计划列表时的查询参数
type ListPlansQuery struct {
PlanType string `form:"planType,default=custom"` // 计划类型 (all, custom, system),默认为 custom
Page int `form:"page,default=1"` // 页码
PageSize int `form:"pageSize,default=10"` // 每页大小
}
// CreatePlanRequest 定义创建计划请求的结构体
type CreatePlanRequest struct {
Name string `json:"name" binding:"required" example:"猪舍温度控制计划"`
@@ -18,6 +25,7 @@ type PlanResponse struct {
ID uint `json:"id" example:"1"`
Name string `json:"name" example:"猪舍温度控制计划"`
Description string `json:"description" example:"根据温度自动调节风扇和加热器"`
PlanType models.PlanType `json:"plan_type" example:"自定义任务"`
ExecutionType models.PlanExecutionType `json:"execution_type" example:"自动"`
Status models.PlanStatus `json:"status" example:"已启用"`
ExecuteNum uint `json:"execute_num" example:"10"`
@@ -31,7 +39,7 @@ type PlanResponse struct {
// ListPlansResponse 定义获取计划列表响应的结构体
type ListPlansResponse struct {
Plans []PlanResponse `json:"plans"`
Total int `json:"total" example:"100"`
Total int64 `json:"total" example:"100"`
}
// UpdatePlanRequest 定义更新计划请求的结构体