46 lines
2.5 KiB
Go
46 lines
2.5 KiB
Go
|
|
package dto
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"time"
|
|||
|
|
|
|||
|
|
"git.huangwc.com/pig/pig-farm-controller/internal/infra/models" // 导入 models 包以使用 PigBatchOriginType 和 PigBatchStatus
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// PigBatchCreateDTO 定义了创建猪批次的请求结构
|
|||
|
|
type PigBatchCreateDTO struct {
|
|||
|
|
BatchNumber string `json:"batch_number" binding:"required"` // 批次编号,必填
|
|||
|
|
OriginType models.PigBatchOriginType `json:"origin_type" binding:"required"` // 批次来源,必填
|
|||
|
|
StartDate time.Time `json:"start_date" binding:"required"` // 批次开始日期,必填
|
|||
|
|
InitialCount int `json:"initial_count" binding:"required,min=1"` // 初始数量,必填,最小为1
|
|||
|
|
Status models.PigBatchStatus `json:"status" binding:"required"` // 批次状态,必填
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// PigBatchUpdateDTO 定义了更新猪批次的请求结构
|
|||
|
|
type PigBatchUpdateDTO struct {
|
|||
|
|
BatchNumber *string `json:"batch_number"` // 批次编号,可选
|
|||
|
|
OriginType *models.PigBatchOriginType `json:"origin_type"` // 批次来源,可选
|
|||
|
|
StartDate *time.Time `json:"start_date"` // 批次开始日期,可选
|
|||
|
|
EndDate *time.Time `json:"end_date"` // 批次结束日期,可选
|
|||
|
|
InitialCount *int `json:"initial_count"` // 初始数量,可选
|
|||
|
|
Status *models.PigBatchStatus `json:"status"` // 批次状态,可选
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// PigBatchQueryDTO 定义了查询猪批次的请求结构
|
|||
|
|
type PigBatchQueryDTO struct {
|
|||
|
|
IsActive *bool `json:"is_active" form:"is_active"` // 是否活跃,可选,用于URL查询参数
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// PigBatchResponseDTO 定义了猪批次信息的响应结构
|
|||
|
|
type PigBatchResponseDTO struct {
|
|||
|
|
ID uint `json:"id"` // 批次ID
|
|||
|
|
BatchNumber string `json:"batch_number"` // 批次编号
|
|||
|
|
OriginType models.PigBatchOriginType `json:"origin_type"` // 批次来源
|
|||
|
|
StartDate time.Time `json:"start_date"` // 批次开始日期
|
|||
|
|
EndDate time.Time `json:"end_date"` // 批次结束日期
|
|||
|
|
InitialCount int `json:"initial_count"` // 初始数量
|
|||
|
|
Status models.PigBatchStatus `json:"status"` // 批次状态
|
|||
|
|
IsActive bool `json:"is_active"` // 是否活跃
|
|||
|
|
CreateTime time.Time `json:"create_time"` // 创建时间
|
|||
|
|
UpdateTime time.Time `json:"update_time"` // 更新时间
|
|||
|
|
}
|