54 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package dto
 | 
						|
 | 
						|
import "git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
 | 
						|
 | 
						|
// PigHouseResponse 定义了猪舍信息的响应结构
 | 
						|
type PigHouseResponse struct {
 | 
						|
	ID          uint   `json:"id"`
 | 
						|
	Name        string `json:"name"`
 | 
						|
	Description string `json:"description"`
 | 
						|
}
 | 
						|
 | 
						|
// PenResponse 定义了猪栏信息的响应结构
 | 
						|
type PenResponse struct {
 | 
						|
	ID              uint             `json:"id"`
 | 
						|
	PenNumber       string           `json:"pen_number"`
 | 
						|
	HouseID         uint             `json:"house_id"`
 | 
						|
	Capacity        int              `json:"capacity"`
 | 
						|
	Status          models.PenStatus `json:"status"`
 | 
						|
	PigBatchID      *uint            `json:"pig_batch_id,omitempty"`
 | 
						|
	CurrentPigCount int              `json:"current_pig_count"`
 | 
						|
}
 | 
						|
 | 
						|
// CreatePigHouseRequest 定义了创建猪舍的请求结构
 | 
						|
type CreatePigHouseRequest struct {
 | 
						|
	Name        string `json:"name" binding:"required"`
 | 
						|
	Description string `json:"description"`
 | 
						|
}
 | 
						|
 | 
						|
// UpdatePigHouseRequest 定义了更新猪舍的请求结构
 | 
						|
type UpdatePigHouseRequest struct {
 | 
						|
	Name        string `json:"name" binding:"required"`
 | 
						|
	Description string `json:"description"`
 | 
						|
}
 | 
						|
 | 
						|
// CreatePenRequest 定义了创建猪栏的请求结构
 | 
						|
type CreatePenRequest struct {
 | 
						|
	PenNumber string `json:"pen_number" binding:"required"`
 | 
						|
	HouseID   uint   `json:"house_id" binding:"required"`
 | 
						|
	Capacity  int    `json:"capacity" binding:"required"`
 | 
						|
}
 | 
						|
 | 
						|
// UpdatePenRequest 定义了更新猪栏的请求结构
 | 
						|
type UpdatePenRequest struct {
 | 
						|
	PenNumber string           `json:"pen_number" binding:"required"`
 | 
						|
	HouseID   uint             `json:"house_id" binding:"required"`
 | 
						|
	Capacity  int              `json:"capacity" binding:"required"`
 | 
						|
	Status    models.PenStatus `json:"status" binding:"required,oneof=空闲 使用中 病猪栏 康复栏 清洗消毒 维修中"` // 添加oneof校验
 | 
						|
}
 | 
						|
 | 
						|
// UpdatePenStatusRequest 定义了更新猪栏状态的请求结构
 | 
						|
type UpdatePenStatusRequest struct {
 | 
						|
	Status models.PenStatus `json:"status" binding:"required,oneof=空闲 使用中 病猪栏 康复栏 清洗消毒 维修中" example:"病猪栏"`
 | 
						|
}
 |