uint/uint64全部改为uint32
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
// SnoozeAlarmRequest 定义了忽略告警的请求体
|
||||
type SnoozeAlarmRequest struct {
|
||||
DurationMinutes uint `json:"duration_minutes" validate:"required,min=1"` // 忽略时长,单位分钟
|
||||
DurationMinutes uint32 `json:"duration_minutes" validate:"required,min=1"` // 忽略时长,单位分钟
|
||||
}
|
||||
|
||||
// ListActiveAlarmRequest 定义了获取活跃告警列表的请求参数
|
||||
@@ -16,7 +16,7 @@ type ListActiveAlarmRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
SourceType *models.AlarmSourceType `json:"source_type" query:"source_type"` // 按告警来源类型过滤
|
||||
SourceID *uint `json:"source_id" query:"source_id"` // 按告警来源ID过滤
|
||||
SourceID *uint32 `json:"source_id" query:"source_id"` // 按告警来源ID过滤
|
||||
Level *models.SeverityLevel `json:"level" query:"level"` // 按告警严重性等级过滤
|
||||
IsIgnored *bool `json:"is_ignored" query:"is_ignored"` // 按是否被忽略过滤
|
||||
TriggerTime *time.Time `json:"trigger_time" query:"trigger_time"` // 告警触发时间范围 - 开始时间
|
||||
@@ -26,11 +26,11 @@ type ListActiveAlarmRequest struct {
|
||||
|
||||
// ActiveAlarmDTO 是用于API响应的活跃告警结构
|
||||
type ActiveAlarmDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
SourceType models.AlarmSourceType `json:"source_type"`
|
||||
SourceID uint `json:"source_id"`
|
||||
SourceID uint32 `json:"source_id"`
|
||||
AlarmCode models.AlarmCode `json:"alarm_code"`
|
||||
AlarmSummary string `json:"alarm_summary"`
|
||||
Level models.SeverityLevel `json:"level"`
|
||||
@@ -52,7 +52,7 @@ type ListHistoricalAlarmRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
SourceType *models.AlarmSourceType `json:"source_type" query:"source_type"` // 按告警来源类型过滤
|
||||
SourceID *uint `json:"source_id" query:"source_id"` // 按告警来源ID过滤
|
||||
SourceID *uint32 `json:"source_id" query:"source_id"` // 按告警来源ID过滤
|
||||
Level *models.SeverityLevel `json:"level" query:"level"` // 按告警严重性等级过滤
|
||||
TriggerTimeStart *time.Time `json:"trigger_time_start" query:"trigger_time_start"` // 告警触发时间范围 - 开始时间
|
||||
TriggerTimeEnd *time.Time `json:"trigger_time_end" query:"trigger_time_end"` // 告警触发时间范围 - 结束时间
|
||||
@@ -63,9 +63,9 @@ type ListHistoricalAlarmRequest struct {
|
||||
|
||||
// HistoricalAlarmDTO 是用于API响应的历史告警结构
|
||||
type HistoricalAlarmDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
SourceType models.AlarmSourceType `json:"source_type"`
|
||||
SourceID uint `json:"source_id"`
|
||||
SourceID uint32 `json:"source_id"`
|
||||
AlarmCode models.AlarmCode `json:"alarm_code"`
|
||||
AlarmSummary string `json:"alarm_summary"`
|
||||
Level models.SeverityLevel `json:"level"`
|
||||
@@ -73,7 +73,7 @@ type HistoricalAlarmDTO struct {
|
||||
TriggerTime time.Time `json:"trigger_time"`
|
||||
ResolveTime time.Time `json:"resolve_time"`
|
||||
ResolveMethod string `json:"resolve_method"`
|
||||
ResolvedBy *uint `json:"resolved_by"`
|
||||
ResolvedBy *uint32 `json:"resolved_by"`
|
||||
}
|
||||
|
||||
// ListHistoricalAlarmResponse 是获取历史告警列表的响应结构
|
||||
@@ -84,7 +84,7 @@ type ListHistoricalAlarmResponse struct {
|
||||
|
||||
// CreateDeviceThresholdAlarmDTO 创建设备阈值告警的请求DTO
|
||||
type CreateDeviceThresholdAlarmDTO struct {
|
||||
DeviceID uint `json:"device_id" binding:"required"` // 设备ID
|
||||
DeviceID uint32 `json:"device_id" binding:"required"` // 设备ID
|
||||
SensorType models.SensorType `json:"sensor_type" binding:"required"` // 传感器类型
|
||||
Thresholds float32 `json:"thresholds" binding:"required"` // 阈值
|
||||
Operator models.Operator `json:"operator" binding:"required"` // 操作符 (使用string类型,与前端交互更通用)
|
||||
@@ -100,7 +100,7 @@ type UpdateDeviceThresholdAlarmDTO struct {
|
||||
|
||||
// CreateAreaThresholdAlarmDTO 创建区域阈值告警的请求DTO
|
||||
type CreateAreaThresholdAlarmDTO struct {
|
||||
AreaControllerID uint `json:"area_controller_id" binding:"required"` // 区域主控ID
|
||||
AreaControllerID uint32 `json:"area_controller_id" binding:"required"` // 区域主控ID
|
||||
SensorType models.SensorType `json:"sensor_type" binding:"required"` // 传感器类型
|
||||
Thresholds float32 `json:"thresholds" binding:"required"` // 阈值
|
||||
Operator models.Operator `json:"operator" binding:"required"` // 操作符
|
||||
@@ -122,7 +122,7 @@ type DeleteDeviceThresholdAlarmDTO struct {
|
||||
// AreaThresholdAlarmDTO 用于表示一个区域阈值告警任务的详细信息
|
||||
type AreaThresholdAlarmDTO struct {
|
||||
ID int `json:"id"`
|
||||
AreaControllerID uint `json:"area_controller_id"`
|
||||
AreaControllerID uint32 `json:"area_controller_id"`
|
||||
SensorType models.SensorType `json:"sensor_type"`
|
||||
Thresholds float32 `json:"thresholds"`
|
||||
Operator models.Operator `json:"operator"`
|
||||
@@ -132,7 +132,7 @@ type AreaThresholdAlarmDTO struct {
|
||||
// DeviceThresholdAlarmDTO 用于表示一个设备阈值告警任务的详细信息
|
||||
type DeviceThresholdAlarmDTO struct {
|
||||
ID int `json:"id"`
|
||||
DeviceID uint `json:"device_id"`
|
||||
DeviceID uint32 `json:"device_id"`
|
||||
SensorType models.SensorType `json:"sensor_type"`
|
||||
Thresholds float32 `json:"thresholds"`
|
||||
Operator models.Operator `json:"operator"`
|
||||
|
||||
@@ -5,8 +5,8 @@ import "git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
|
||||
// CreateDeviceRequest 定义了创建设备时需要传入的参数
|
||||
type CreateDeviceRequest struct {
|
||||
Name string `json:"name" validate:"required"`
|
||||
DeviceTemplateID uint `json:"device_template_id" validate:"required"`
|
||||
AreaControllerID uint `json:"area_controller_id" validate:"required"`
|
||||
DeviceTemplateID uint32 `json:"device_template_id" validate:"required"`
|
||||
AreaControllerID uint32 `json:"area_controller_id" validate:"required"`
|
||||
Location string `json:"location,omitempty" validate:"omitempty"`
|
||||
Properties map[string]interface{} `json:"properties,omitempty" validate:"omitempty"`
|
||||
}
|
||||
@@ -14,8 +14,8 @@ type CreateDeviceRequest struct {
|
||||
// UpdateDeviceRequest 定义了更新设备时需要传入的参数
|
||||
type UpdateDeviceRequest struct {
|
||||
Name string `json:"name" validate:"required"`
|
||||
DeviceTemplateID uint `json:"device_template_id" validate:"required"`
|
||||
AreaControllerID uint `json:"area_controller_id" validate:"required"`
|
||||
DeviceTemplateID uint32 `json:"device_template_id" validate:"required"`
|
||||
AreaControllerID uint32 `json:"area_controller_id" validate:"required"`
|
||||
Location string `json:"location,omitempty" validate:"omitempty"`
|
||||
Properties map[string]interface{} `json:"properties,omitempty" validate:"omitempty"`
|
||||
}
|
||||
@@ -64,11 +64,11 @@ type UpdateDeviceTemplateRequest struct {
|
||||
|
||||
// DeviceResponse 定义了返回给客户端的单个设备信息的结构
|
||||
type DeviceResponse struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
DeviceTemplateID uint `json:"device_template_id"`
|
||||
DeviceTemplateID uint32 `json:"device_template_id"`
|
||||
DeviceTemplateName string `json:"device_template_name"`
|
||||
AreaControllerID uint `json:"area_controller_id"`
|
||||
AreaControllerID uint32 `json:"area_controller_id"`
|
||||
AreaControllerName string `json:"area_controller_name"`
|
||||
Location string `json:"location"`
|
||||
Properties map[string]interface{} `json:"properties"`
|
||||
@@ -78,7 +78,7 @@ type DeviceResponse struct {
|
||||
|
||||
// AreaControllerResponse 定义了返回给客户端的单个区域主控信息的结构
|
||||
type AreaControllerResponse struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
NetworkID string `json:"network_id"`
|
||||
Location string `json:"location"`
|
||||
@@ -90,7 +90,7 @@ type AreaControllerResponse struct {
|
||||
|
||||
// DeviceTemplateResponse 定义了返回给客户端的单个设备模板信息的结构
|
||||
type DeviceTemplateResponse struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Manufacturer string `json:"manufacturer"`
|
||||
Description string `json:"description"`
|
||||
|
||||
@@ -54,7 +54,7 @@ func NewListDeviceCommandLogResponse(data []models.DeviceCommandLog, total int64
|
||||
|
||||
// NewListPlanExecutionLogResponse 从模型数据创建列表响应 DTO
|
||||
func NewListPlanExecutionLogResponse(planLogs []models.PlanExecutionLog, plans []models.Plan, total int64, page, pageSize int) *ListPlanExecutionLogResponse {
|
||||
planId2Name := make(map[uint]string)
|
||||
planId2Name := make(map[uint32]string)
|
||||
for _, plan := range plans {
|
||||
planId2Name[plan.ID] = string(plan.Name)
|
||||
}
|
||||
@@ -95,7 +95,7 @@ func NewListTaskExecutionLogResponse(data []models.TaskExecutionLog, total int64
|
||||
PlanExecutionLogID: item.PlanExecutionLogID,
|
||||
TaskID: item.TaskID,
|
||||
Task: TaskDTO{
|
||||
ID: uint(item.Task.ID),
|
||||
ID: uint32(item.Task.ID),
|
||||
Name: item.Task.Name,
|
||||
Description: item.Task.Description,
|
||||
},
|
||||
@@ -373,7 +373,7 @@ func NewListWeighingRecordResponse(data []models.WeighingRecord, total int64, pa
|
||||
func NewListPigTransferLogResponse(data []models.PigTransferLog, total int64, page, pageSize int) *ListPigTransferLogResponse {
|
||||
dtos := make([]PigTransferLogDTO, len(data))
|
||||
for i, item := range data {
|
||||
// 注意:PigTransferLog 的 ID, CreatedAt, UpdatedAt 字段是 gorm.Model 嵌入的
|
||||
// 注意:PigTransferLog 的 ID, CreatedAt, UpdatedAt 字段是 Model 嵌入的
|
||||
dtos[i] = PigTransferLogDTO{
|
||||
ID: item.ID,
|
||||
CreatedAt: item.CreatedAt,
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
type ListSensorDataRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
DeviceID *uint `json:"device_id" query:"device_id"`
|
||||
DeviceID *uint32 `json:"device_id" query:"device_id"`
|
||||
SensorType *string `json:"sensor_type" query:"sensor_type"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
@@ -23,8 +23,8 @@ type ListSensorDataRequest struct {
|
||||
// SensorDataDTO 是用于API响应的传感器数据结构
|
||||
type SensorDataDTO struct {
|
||||
Time time.Time `json:"time"`
|
||||
DeviceID uint `json:"device_id"`
|
||||
AreaControllerID uint `json:"area_controller_id"`
|
||||
DeviceID uint32 `json:"device_id"`
|
||||
AreaControllerID uint32 `json:"area_controller_id"`
|
||||
SensorType models.SensorType `json:"sensor_type"`
|
||||
Data json.RawMessage `json:"data"`
|
||||
}
|
||||
@@ -41,7 +41,7 @@ type ListSensorDataResponse struct {
|
||||
type ListDeviceCommandLogRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
DeviceID *uint `json:"device_id" query:"device_id"`
|
||||
DeviceID *uint32 `json:"device_id" query:"device_id"`
|
||||
ReceivedSuccess *bool `json:"received_success" query:"received_success"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
@@ -51,7 +51,7 @@ type ListDeviceCommandLogRequest struct {
|
||||
// DeviceCommandLogDTO 是用于API响应的设备命令日志结构
|
||||
type DeviceCommandLogDTO struct {
|
||||
MessageID string `json:"message_id"`
|
||||
DeviceID uint `json:"device_id"`
|
||||
DeviceID uint32 `json:"device_id"`
|
||||
SentAt time.Time `json:"sent_at"`
|
||||
AcknowledgedAt *time.Time `json:"acknowledged_at"`
|
||||
ReceivedSuccess bool `json:"received_success"`
|
||||
@@ -69,7 +69,7 @@ type ListDeviceCommandLogResponse struct {
|
||||
type ListPlanExecutionLogRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
PlanID *uint `json:"plan_id" query:"plan_id"`
|
||||
PlanID *uint32 `json:"plan_id" query:"plan_id"`
|
||||
Status *string `json:"status" query:"status"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
@@ -78,10 +78,10 @@ type ListPlanExecutionLogRequest struct {
|
||||
|
||||
// PlanExecutionLogDTO 是用于API响应的计划执行日志结构
|
||||
type PlanExecutionLogDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
PlanID uint `json:"plan_id"`
|
||||
PlanID uint32 `json:"plan_id"`
|
||||
PlanName string `json:"plan_name"`
|
||||
Status models.ExecutionStatus `json:"status"`
|
||||
StartedAt time.Time `json:"started_at"`
|
||||
@@ -101,7 +101,7 @@ type ListPlanExecutionLogResponse struct {
|
||||
type ListTaskExecutionLogRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
PlanExecutionLogID *uint `json:"plan_execution_log_id" query:"plan_execution_log_id"`
|
||||
PlanExecutionLogID *uint32 `json:"plan_execution_log_id" query:"plan_execution_log_id"`
|
||||
TaskID *int `json:"task_id" query:"task_id"`
|
||||
Status *string `json:"status" query:"status"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
@@ -111,17 +111,17 @@ type ListTaskExecutionLogRequest struct {
|
||||
|
||||
// TaskDTO 是用于API响应的简化版任务结构
|
||||
type TaskDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// TaskExecutionLogDTO 是用于API响应的任务执行日志结构
|
||||
type TaskExecutionLogDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
PlanExecutionLogID uint `json:"plan_execution_log_id"`
|
||||
PlanExecutionLogID uint32 `json:"plan_execution_log_id"`
|
||||
TaskID int `json:"task_id"`
|
||||
Task TaskDTO `json:"task"` // 嵌套的任务信息
|
||||
Status models.ExecutionStatus `json:"status"`
|
||||
@@ -142,7 +142,7 @@ type ListTaskExecutionLogResponse struct {
|
||||
type ListPendingCollectionRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
DeviceID *uint `json:"device_id" query:"device_id"`
|
||||
DeviceID *uint32 `json:"device_id" query:"device_id"`
|
||||
Status *string `json:"status" query:"status"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
@@ -152,7 +152,7 @@ type ListPendingCollectionRequest struct {
|
||||
// PendingCollectionDTO 是用于API响应的待采集请求结构
|
||||
type PendingCollectionDTO struct {
|
||||
CorrelationID string `json:"correlation_id"`
|
||||
DeviceID uint `json:"device_id"`
|
||||
DeviceID uint32 `json:"device_id"`
|
||||
CommandMetadata models.UintArray `json:"command_metadata"`
|
||||
Status models.PendingCollectionStatus `json:"status"`
|
||||
FulfilledAt *time.Time `json:"fulfilled_at"`
|
||||
@@ -171,7 +171,7 @@ type ListPendingCollectionResponse struct {
|
||||
type ListUserActionLogRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
UserID *uint `json:"user_id" query:"user_id"`
|
||||
UserID *uint32 `json:"user_id" query:"user_id"`
|
||||
Username *string `json:"username" query:"username"`
|
||||
ActionType *string `json:"action_type" query:"action_type"`
|
||||
Status *string `json:"status" query:"status"`
|
||||
@@ -182,9 +182,9 @@ type ListUserActionLogRequest struct {
|
||||
|
||||
// UserActionLogDTO 是用于API响应的用户操作日志结构
|
||||
type UserActionLogDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
Time time.Time `json:"time"`
|
||||
UserID uint `json:"user_id"`
|
||||
UserID uint32 `json:"user_id"`
|
||||
Username string `json:"username"`
|
||||
SourceIP string `json:"source_ip"`
|
||||
ActionType string `json:"action_type"`
|
||||
@@ -208,7 +208,7 @@ type ListUserActionLogResponse struct {
|
||||
type ListRawMaterialPurchaseRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
RawMaterialID *uint `json:"raw_material_id" query:"raw_material_id"`
|
||||
RawMaterialID *uint32 `json:"raw_material_id" query:"raw_material_id"`
|
||||
Supplier *string `json:"supplier" query:"supplier"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
@@ -217,14 +217,14 @@ type ListRawMaterialPurchaseRequest struct {
|
||||
|
||||
// RawMaterialDTO 是用于API响应的简化版原料结构
|
||||
type RawMaterialDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// RawMaterialPurchaseDTO 是用于API响应的原料采购结构
|
||||
type RawMaterialPurchaseDTO struct {
|
||||
ID uint `json:"id"`
|
||||
RawMaterialID uint `json:"raw_material_id"`
|
||||
ID uint32 `json:"id"`
|
||||
RawMaterialID uint32 `json:"raw_material_id"`
|
||||
RawMaterial RawMaterialDTO `json:"raw_material"`
|
||||
Supplier string `json:"supplier"`
|
||||
Amount float32 `json:"amount"`
|
||||
@@ -246,9 +246,9 @@ type ListRawMaterialPurchaseResponse struct {
|
||||
type ListRawMaterialStockLogRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
RawMaterialID *uint `json:"raw_material_id" query:"raw_material_id"`
|
||||
RawMaterialID *uint32 `json:"raw_material_id" query:"raw_material_id"`
|
||||
SourceType *string `json:"source_type" query:"source_type"`
|
||||
SourceID *uint `json:"source_id" query:"source_id"`
|
||||
SourceID *uint32 `json:"source_id" query:"source_id"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
OrderBy string `json:"order_by" query:"order_by"`
|
||||
@@ -256,11 +256,11 @@ type ListRawMaterialStockLogRequest struct {
|
||||
|
||||
// RawMaterialStockLogDTO 是用于API响应的原料库存日志结构
|
||||
type RawMaterialStockLogDTO struct {
|
||||
ID uint `json:"id"`
|
||||
RawMaterialID uint `json:"raw_material_id"`
|
||||
ID uint32 `json:"id"`
|
||||
RawMaterialID uint32 `json:"raw_material_id"`
|
||||
ChangeAmount float32 `json:"change_amount"`
|
||||
SourceType models.StockLogSourceType `json:"source_type"`
|
||||
SourceID uint `json:"source_id"`
|
||||
SourceID uint32 `json:"source_id"`
|
||||
HappenedAt time.Time `json:"happened_at"`
|
||||
Remarks string `json:"remarks"`
|
||||
}
|
||||
@@ -277,9 +277,9 @@ type ListRawMaterialStockLogResponse struct {
|
||||
type ListFeedUsageRecordRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
PenID *uint `json:"pen_id" query:"pen_id"`
|
||||
FeedFormulaID *uint `json:"feed_formula_id" query:"feed_formula_id"`
|
||||
OperatorID *uint `json:"operator_id" query:"operator_id"`
|
||||
PenID *uint32 `json:"pen_id" query:"pen_id"`
|
||||
FeedFormulaID *uint32 `json:"feed_formula_id" query:"feed_formula_id"`
|
||||
OperatorID *uint32 `json:"operator_id" query:"operator_id"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
OrderBy string `json:"order_by" query:"order_by"`
|
||||
@@ -287,26 +287,26 @@ type ListFeedUsageRecordRequest struct {
|
||||
|
||||
// PenDTO 是用于API响应的简化版猪栏结构
|
||||
type PenDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// FeedFormulaDTO 是用于API响应的简化版饲料配方结构
|
||||
type FeedFormulaDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// FeedUsageRecordDTO 是用于API响应的饲料使用记录结构
|
||||
type FeedUsageRecordDTO struct {
|
||||
ID uint `json:"id"`
|
||||
PenID uint `json:"pen_id"`
|
||||
ID uint32 `json:"id"`
|
||||
PenID uint32 `json:"pen_id"`
|
||||
Pen PenDTO `json:"pen"`
|
||||
FeedFormulaID uint `json:"feed_formula_id"`
|
||||
FeedFormulaID uint32 `json:"feed_formula_id"`
|
||||
FeedFormula FeedFormulaDTO `json:"feed_formula"`
|
||||
Amount float32 `json:"amount"`
|
||||
RecordedAt time.Time `json:"recorded_at"`
|
||||
OperatorID uint `json:"operator_id"`
|
||||
OperatorID uint32 `json:"operator_id"`
|
||||
Remarks string `json:"remarks"`
|
||||
}
|
||||
|
||||
@@ -322,10 +322,10 @@ type ListFeedUsageRecordResponse struct {
|
||||
type ListMedicationLogRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
PigBatchID *uint `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
MedicationID *uint `json:"medication_id" query:"medication_id"`
|
||||
PigBatchID *uint32 `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
MedicationID *uint32 `json:"medication_id" query:"medication_id"`
|
||||
Reason *string `json:"reason" query:"reason"`
|
||||
OperatorID *uint `json:"operator_id" query:"operator_id"`
|
||||
OperatorID *uint32 `json:"operator_id" query:"operator_id"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
OrderBy string `json:"order_by" query:"order_by"`
|
||||
@@ -333,21 +333,21 @@ type ListMedicationLogRequest struct {
|
||||
|
||||
// MedicationDTO 是用于API响应的简化版药品结构
|
||||
type MedicationDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// MedicationLogDTO 是用于API响应的用药记录结构
|
||||
type MedicationLogDTO struct {
|
||||
ID uint `json:"id"`
|
||||
PigBatchID uint `json:"pig_batch_id"`
|
||||
MedicationID uint `json:"medication_id"`
|
||||
ID uint32 `json:"id"`
|
||||
PigBatchID uint32 `json:"pig_batch_id"`
|
||||
MedicationID uint32 `json:"medication_id"`
|
||||
Medication MedicationDTO `json:"medication"`
|
||||
DosageUsed float32 `json:"dosage_used"`
|
||||
TargetCount int `json:"target_count"`
|
||||
Reason models.MedicationReasonType `json:"reason"`
|
||||
Description string `json:"description"`
|
||||
OperatorID uint `json:"operator_id"`
|
||||
OperatorID uint32 `json:"operator_id"`
|
||||
HappenedAt time.Time `json:"happened_at"`
|
||||
}
|
||||
|
||||
@@ -363,9 +363,9 @@ type ListMedicationLogResponse struct {
|
||||
type ListPigBatchLogRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
PigBatchID *uint `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
PigBatchID *uint32 `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
ChangeType *string `json:"change_type" query:"change_type"`
|
||||
OperatorID *uint `json:"operator_id" query:"operator_id"`
|
||||
OperatorID *uint32 `json:"operator_id" query:"operator_id"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
OrderBy string `json:"order_by" query:"order_by"`
|
||||
@@ -373,16 +373,16 @@ type ListPigBatchLogRequest struct {
|
||||
|
||||
// PigBatchLogDTO 是用于API响应的猪批次日志结构
|
||||
type PigBatchLogDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
PigBatchID uint `json:"pig_batch_id"`
|
||||
PigBatchID uint32 `json:"pig_batch_id"`
|
||||
ChangeType models.LogChangeType `json:"change_type"`
|
||||
ChangeCount int `json:"change_count"`
|
||||
Reason string `json:"reason"`
|
||||
BeforeCount int `json:"before_count"`
|
||||
AfterCount int `json:"after_count"`
|
||||
OperatorID uint `json:"operator_id"`
|
||||
OperatorID uint32 `json:"operator_id"`
|
||||
HappenedAt time.Time `json:"happened_at"`
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ type ListPigBatchLogResponse struct {
|
||||
type ListWeighingBatchRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
PigBatchID *uint `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
PigBatchID *uint32 `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
OrderBy string `json:"order_by" query:"order_by"`
|
||||
@@ -406,12 +406,12 @@ type ListWeighingBatchRequest struct {
|
||||
|
||||
// WeighingBatchDTO 是用于API响应的批次称重记录结构
|
||||
type WeighingBatchDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
WeighingTime time.Time `json:"weighing_time"`
|
||||
Description string `json:"description"`
|
||||
PigBatchID uint `json:"pig_batch_id"`
|
||||
PigBatchID uint32 `json:"pig_batch_id"`
|
||||
}
|
||||
|
||||
// ListWeighingBatchResponse 是获取批次称重记录列表的响应结构
|
||||
@@ -426,9 +426,9 @@ type ListWeighingBatchResponse struct {
|
||||
type ListWeighingRecordRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
WeighingBatchID *uint `json:"weighing_batch_id" query:"weighing_batch_id"`
|
||||
PenID *uint `json:"pen_id" query:"pen_id"`
|
||||
OperatorID *uint `json:"operator_id" query:"operator_id"`
|
||||
WeighingBatchID *uint32 `json:"weighing_batch_id" query:"weighing_batch_id"`
|
||||
PenID *uint32 `json:"pen_id" query:"pen_id"`
|
||||
OperatorID *uint32 `json:"operator_id" query:"operator_id"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
OrderBy string `json:"order_by" query:"order_by"`
|
||||
@@ -436,13 +436,13 @@ type ListWeighingRecordRequest struct {
|
||||
|
||||
// WeighingRecordDTO 是用于API响应的单次称重记录结构
|
||||
type WeighingRecordDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Weight float32 `json:"weight"`
|
||||
WeighingBatchID uint `json:"weighing_batch_id"`
|
||||
PenID uint `json:"pen_id"`
|
||||
OperatorID uint `json:"operator_id"`
|
||||
WeighingBatchID uint32 `json:"weighing_batch_id"`
|
||||
PenID uint32 `json:"pen_id"`
|
||||
OperatorID uint32 `json:"operator_id"`
|
||||
Remark string `json:"remark"`
|
||||
WeighingTime time.Time `json:"weighing_time"`
|
||||
}
|
||||
@@ -459,10 +459,10 @@ type ListWeighingRecordResponse struct {
|
||||
type ListPigTransferLogRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
PigBatchID *uint `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
PenID *uint `json:"pen_id" query:"pen_id"`
|
||||
PigBatchID *uint32 `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
PenID *uint32 `json:"pen_id" query:"pen_id"`
|
||||
TransferType *string `json:"transfer_type" query:"transfer_type"`
|
||||
OperatorID *uint `json:"operator_id" query:"operator_id"`
|
||||
OperatorID *uint32 `json:"operator_id" query:"operator_id"`
|
||||
CorrelationID *string `json:"correlation_id" query:"correlation_id"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
@@ -471,16 +471,16 @@ type ListPigTransferLogRequest struct {
|
||||
|
||||
// PigTransferLogDTO 是用于API响应的猪只迁移日志结构
|
||||
type PigTransferLogDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
TransferTime time.Time `json:"transfer_time"`
|
||||
PigBatchID uint `json:"pig_batch_id"`
|
||||
PenID uint `json:"pen_id"`
|
||||
PigBatchID uint32 `json:"pig_batch_id"`
|
||||
PenID uint32 `json:"pen_id"`
|
||||
Quantity int `json:"quantity"`
|
||||
Type models.PigTransferType `json:"type"`
|
||||
CorrelationID string `json:"correlation_id"`
|
||||
OperatorID uint `json:"operator_id"`
|
||||
OperatorID uint32 `json:"operator_id"`
|
||||
Remarks string `json:"remarks"`
|
||||
}
|
||||
|
||||
@@ -496,11 +496,11 @@ type ListPigTransferLogResponse struct {
|
||||
type ListPigSickLogRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
PigBatchID *uint `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
PenID *uint `json:"pen_id" query:"pen_id"`
|
||||
PigBatchID *uint32 `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
PenID *uint32 `json:"pen_id" query:"pen_id"`
|
||||
Reason *string `json:"reason" query:"reason"`
|
||||
TreatmentLocation *string `json:"treatment_location" query:"treatment_location"`
|
||||
OperatorID *uint `json:"operator_id" query:"operator_id"`
|
||||
OperatorID *uint32 `json:"operator_id" query:"operator_id"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
OrderBy string `json:"order_by" query:"order_by"`
|
||||
@@ -508,18 +508,18 @@ type ListPigSickLogRequest struct {
|
||||
|
||||
// PigSickLogDTO 是用于API响应的病猪日志结构
|
||||
type PigSickLogDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
PigBatchID uint `json:"pig_batch_id"`
|
||||
PenID uint `json:"pen_id"`
|
||||
PigBatchID uint32 `json:"pig_batch_id"`
|
||||
PenID uint32 `json:"pen_id"`
|
||||
ChangeCount int `json:"change_count"`
|
||||
Reason models.PigBatchSickPigReasonType `json:"reason"`
|
||||
BeforeCount int `json:"before_count"`
|
||||
AfterCount int `json:"after_count"`
|
||||
Remarks string `json:"remarks"`
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatment_location"`
|
||||
OperatorID uint `json:"operator_id"`
|
||||
OperatorID uint32 `json:"operator_id"`
|
||||
HappenedAt time.Time `json:"happened_at"`
|
||||
}
|
||||
|
||||
@@ -535,9 +535,9 @@ type ListPigSickLogResponse struct {
|
||||
type ListPigPurchaseRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
PigBatchID *uint `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
PigBatchID *uint32 `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
Supplier *string `json:"supplier" query:"supplier"`
|
||||
OperatorID *uint `json:"operator_id" query:"operator_id"`
|
||||
OperatorID *uint32 `json:"operator_id" query:"operator_id"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
OrderBy string `json:"order_by" query:"order_by"`
|
||||
@@ -545,17 +545,17 @@ type ListPigPurchaseRequest struct {
|
||||
|
||||
// PigPurchaseDTO 是用于API响应的猪只采购记录结构
|
||||
type PigPurchaseDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
PigBatchID uint `json:"pig_batch_id"`
|
||||
PigBatchID uint32 `json:"pig_batch_id"`
|
||||
PurchaseDate time.Time `json:"purchase_date"`
|
||||
Supplier string `json:"supplier"`
|
||||
Quantity int `json:"quantity"`
|
||||
UnitPrice float32 `json:"unit_price"`
|
||||
TotalPrice float32 `json:"total_price"`
|
||||
Remarks string `json:"remarks"`
|
||||
OperatorID uint `json:"operator_id"`
|
||||
OperatorID uint32 `json:"operator_id"`
|
||||
}
|
||||
|
||||
// ListPigPurchaseResponse 是获取猪只采购记录列表的响应结构
|
||||
@@ -570,9 +570,9 @@ type ListPigPurchaseResponse struct {
|
||||
type ListPigSaleRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
PigBatchID *uint `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
PigBatchID *uint32 `json:"pig_batch_id" query:"pig_batch_id"`
|
||||
Buyer *string `json:"buyer" query:"buyer"`
|
||||
OperatorID *uint `json:"operator_id" query:"operator_id"`
|
||||
OperatorID *uint32 `json:"operator_id" query:"operator_id"`
|
||||
StartTime *time.Time `json:"start_time" query:"start_time"`
|
||||
EndTime *time.Time `json:"end_time" query:"end_time"`
|
||||
OrderBy string `json:"order_by" query:"order_by"`
|
||||
@@ -580,17 +580,17 @@ type ListPigSaleRequest struct {
|
||||
|
||||
// PigSaleDTO 是用于API响应的猪只销售记录结构
|
||||
type PigSaleDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
PigBatchID uint `json:"pig_batch_id"`
|
||||
PigBatchID uint32 `json:"pig_batch_id"`
|
||||
SaleDate time.Time `json:"sale_date"`
|
||||
Buyer string `json:"buyer"`
|
||||
Quantity int `json:"quantity"`
|
||||
UnitPrice float32 `json:"unit_price"`
|
||||
TotalPrice float32 `json:"total_price"`
|
||||
Remarks string `json:"remarks"`
|
||||
OperatorID uint `json:"operator_id"`
|
||||
OperatorID uint32 `json:"operator_id"`
|
||||
}
|
||||
|
||||
// ListPigSaleResponse 是获取猪只销售记录列表的响应结构
|
||||
|
||||
@@ -18,7 +18,7 @@ type SendTestNotificationRequest struct {
|
||||
type ListNotificationRequest struct {
|
||||
Page int `json:"page" query:"page"`
|
||||
PageSize int `json:"page_size" query:"page_size"`
|
||||
UserID *uint `json:"user_id" query:"user_id"`
|
||||
UserID *uint32 `json:"user_id" query:"user_id"`
|
||||
NotifierType *models.NotifierType `json:"notifier_type" query:"notifier_type"`
|
||||
Status *models.NotificationStatus `json:"status" query:"status"`
|
||||
Level *zapcore.Level `json:"level" query:"level"`
|
||||
@@ -29,11 +29,11 @@ type ListNotificationRequest struct {
|
||||
|
||||
// NotificationDTO 是用于API响应的通知结构
|
||||
type NotificationDTO struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
NotifierType models.NotifierType `json:"notifier_type"`
|
||||
UserID uint `json:"user_id"`
|
||||
UserID uint32 `json:"user_id"`
|
||||
Title string `json:"title"`
|
||||
Message string `json:"message"`
|
||||
Level models.SeverityLevel `json:"level"`
|
||||
|
||||
@@ -32,7 +32,7 @@ type PigBatchQueryDTO struct {
|
||||
|
||||
// PigBatchResponseDTO 定义了猪批次信息的响应结构
|
||||
type PigBatchResponseDTO struct {
|
||||
ID uint `json:"id"` // 批次ID
|
||||
ID uint32 `json:"id"` // 批次ID
|
||||
BatchNumber string `json:"batch_number"` // 批次编号
|
||||
OriginType models.PigBatchOriginType `json:"origin_type"` // 批次来源
|
||||
StartDate time.Time `json:"start_date"` // 批次开始日期
|
||||
@@ -48,31 +48,31 @@ type PigBatchResponseDTO struct {
|
||||
|
||||
// AssignEmptyPensToBatchRequest 用于为猪批次分配空栏的请求体
|
||||
type AssignEmptyPensToBatchRequest struct {
|
||||
PenIDs []uint `json:"pen_ids" validate:"required,min=1,dive" example:"1,2,3"` // 待分配的猪栏ID列表
|
||||
PenIDs []uint32 `json:"pen_ids" validate:"required,min=1,dive" example:"1,2,3"` // 待分配的猪栏ID列表
|
||||
}
|
||||
|
||||
// ReclassifyPenToNewBatchRequest 用于将猪栏划拨到新批次的请求体
|
||||
type ReclassifyPenToNewBatchRequest struct {
|
||||
ToBatchID uint `json:"to_batch_id" validate:"required"` // 目标猪批次ID
|
||||
PenID uint `json:"pen_id" validate:"required"` // 待划拨的猪栏ID
|
||||
ToBatchID uint32 `json:"to_batch_id" validate:"required"` // 目标猪批次ID
|
||||
PenID uint32 `json:"pen_id" validate:"required"` // 待划拨的猪栏ID
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// RemoveEmptyPenFromBatchRequest 用于从猪批次移除空栏的请求体
|
||||
type RemoveEmptyPenFromBatchRequest struct {
|
||||
PenID uint `json:"pen_id" validate:"required"` // 待移除的猪栏ID
|
||||
PenID uint32 `json:"pen_id" validate:"required"` // 待移除的猪栏ID
|
||||
}
|
||||
|
||||
// MovePigsIntoPenRequest 用于将猪只从“虚拟库存”移入指定猪栏的请求体
|
||||
type MovePigsIntoPenRequest struct {
|
||||
ToPenID uint `json:"to_pen_id" validate:"required"` // 目标猪栏ID
|
||||
ToPenID uint32 `json:"to_pen_id" validate:"required"` // 目标猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 移入猪只数量
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// SellPigsRequest 用于处理卖猪的请求体
|
||||
type SellPigsRequest struct {
|
||||
PenID uint `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
PenID uint32 `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 卖出猪只数量
|
||||
UnitPrice float32 `json:"unit_price" validate:"required,min=0"` // 单价
|
||||
TotalPrice float32 `json:"total_price" validate:"required,min=0"` // 总价
|
||||
@@ -83,7 +83,7 @@ type SellPigsRequest struct {
|
||||
|
||||
// BuyPigsRequest 用于处理买猪的请求体
|
||||
type BuyPigsRequest struct {
|
||||
PenID uint `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
PenID uint32 `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 买入猪只数量
|
||||
UnitPrice float32 `json:"unit_price" validate:"required,min=0"` // 单价
|
||||
TotalPrice float32 `json:"total_price" validate:"required,min=0"` // 总价
|
||||
@@ -94,24 +94,24 @@ type BuyPigsRequest struct {
|
||||
|
||||
// TransferPigsAcrossBatchesRequest 用于跨猪群调栏的请求体
|
||||
type TransferPigsAcrossBatchesRequest struct {
|
||||
DestBatchID uint `json:"dest_batch_id" validate:"required"` // 目标猪批次ID
|
||||
FromPenID uint `json:"from_pen_id" validate:"required"` // 源猪栏ID
|
||||
ToPenID uint `json:"to_pen_id" validate:"required"` // 目标猪栏ID
|
||||
Quantity uint `json:"quantity" validate:"required,min=1"` // 调栏猪只数量
|
||||
DestBatchID uint32 `json:"dest_batch_id" validate:"required"` // 目标猪批次ID
|
||||
FromPenID uint32 `json:"from_pen_id" validate:"required"` // 源猪栏ID
|
||||
ToPenID uint32 `json:"to_pen_id" validate:"required"` // 目标猪栏ID
|
||||
Quantity uint32 `json:"quantity" validate:"required,min=1"` // 调栏猪只数量
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// TransferPigsWithinBatchRequest 用于群内调栏的请求体
|
||||
type TransferPigsWithinBatchRequest struct {
|
||||
FromPenID uint `json:"from_pen_id" validate:"required"` // 源猪栏ID
|
||||
ToPenID uint `json:"to_pen_id" validate:"required"` // 目标猪栏ID
|
||||
Quantity uint `json:"quantity" validate:"required,min=1"` // 调栏猪只数量
|
||||
FromPenID uint32 `json:"from_pen_id" validate:"required"` // 源猪栏ID
|
||||
ToPenID uint32 `json:"to_pen_id" validate:"required"` // 目标猪栏ID
|
||||
Quantity uint32 `json:"quantity" validate:"required,min=1"` // 调栏猪只数量
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// RecordSickPigsRequest 用于记录新增病猪事件的请求体
|
||||
type RecordSickPigsRequest struct {
|
||||
PenID uint `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
PenID uint32 `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 病猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatment_location" validate:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happened_at" validate:"required"` // 发生时间
|
||||
@@ -120,7 +120,7 @@ type RecordSickPigsRequest struct {
|
||||
|
||||
// RecordSickPigRecoveryRequest 用于记录病猪康复事件的请求体
|
||||
type RecordSickPigRecoveryRequest struct {
|
||||
PenID uint `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
PenID uint32 `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 康复猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatment_location" validate:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happened_at" validate:"required"` // 发生时间
|
||||
@@ -129,7 +129,7 @@ type RecordSickPigRecoveryRequest struct {
|
||||
|
||||
// RecordSickPigDeathRequest 用于记录病猪死亡事件的请求体
|
||||
type RecordSickPigDeathRequest struct {
|
||||
PenID uint `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
PenID uint32 `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 死亡猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatment_location" validate:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happened_at" validate:"required"` // 发生时间
|
||||
@@ -138,7 +138,7 @@ type RecordSickPigDeathRequest struct {
|
||||
|
||||
// RecordSickPigCullRequest 用于记录病猪淘汰事件的请求体
|
||||
type RecordSickPigCullRequest struct {
|
||||
PenID uint `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
PenID uint32 `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 淘汰猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatment_location" validate:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happened_at" validate:"required"` // 发生时间
|
||||
@@ -147,7 +147,7 @@ type RecordSickPigCullRequest struct {
|
||||
|
||||
// RecordDeathRequest 用于记录正常猪只死亡事件的请求体
|
||||
type RecordDeathRequest struct {
|
||||
PenID uint `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
PenID uint32 `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 死亡猪数量
|
||||
HappenedAt time.Time `json:"happened_at" validate:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
@@ -155,7 +155,7 @@ type RecordDeathRequest struct {
|
||||
|
||||
// RecordCullRequest 用于记录正常猪只淘汰事件的请求体
|
||||
type RecordCullRequest struct {
|
||||
PenID uint `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
PenID uint32 `json:"pen_id" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 淘汰猪数量
|
||||
HappenedAt time.Time `json:"happened_at" validate:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
|
||||
@@ -4,19 +4,19 @@ import "git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
|
||||
|
||||
// PigHouseResponse 定义了猪舍信息的响应结构
|
||||
type PigHouseResponse struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// PenResponse 定义了猪栏信息的响应结构
|
||||
type PenResponse struct {
|
||||
ID uint `json:"id"`
|
||||
ID uint32 `json:"id"`
|
||||
PenNumber string `json:"pen_number"`
|
||||
HouseID uint `json:"house_id"`
|
||||
HouseID uint32 `json:"house_id"`
|
||||
Capacity int `json:"capacity"`
|
||||
Status models.PenStatus `json:"status"`
|
||||
PigBatchID *uint `json:"pig_batch_id,omitempty"`
|
||||
PigBatchID *uint32 `json:"pig_batch_id,omitempty"`
|
||||
CurrentPigCount int `json:"current_pig_count"`
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@ type UpdatePigHouseRequest struct {
|
||||
// CreatePenRequest 定义了创建猪栏的请求结构
|
||||
type CreatePenRequest struct {
|
||||
PenNumber string `json:"pen_number" validate:"required"`
|
||||
HouseID uint `json:"house_id" validate:"required"`
|
||||
HouseID uint32 `json:"house_id" validate:"required"`
|
||||
Capacity int `json:"capacity" validate:"required"`
|
||||
}
|
||||
|
||||
// UpdatePenRequest 定义了更新猪栏的请求结构
|
||||
type UpdatePenRequest struct {
|
||||
PenNumber string `json:"pen_number" validate:"required"`
|
||||
HouseID uint `json:"house_id" validate:"required"`
|
||||
HouseID uint32 `json:"house_id" validate:"required"`
|
||||
Capacity int `json:"capacity" validate:"required"`
|
||||
Status models.PenStatus `json:"status" validate:"required,oneof=空闲 使用中 病猪栏 康复栏 清洗消毒 维修中"` // 添加oneof校验
|
||||
}
|
||||
|
||||
@@ -17,22 +17,22 @@ type CreatePlanRequest struct {
|
||||
Name string `json:"name" validate:"required" example:"猪舍温度控制计划"`
|
||||
Description string `json:"description" example:"根据温度自动调节风扇和加热器"`
|
||||
ExecutionType models.PlanExecutionType `json:"execution_type" validate:"required" example:"自动"`
|
||||
ExecuteNum uint `json:"execute_num,omitempty" validate:"omitempty,min=0" example:"10"`
|
||||
ExecuteNum uint32 `json:"execute_num,omitempty" validate:"omitempty,min=0" example:"10"`
|
||||
CronExpression string `json:"cron_expression" validate:"omitempty,cron" example:"0 0 6 * * *"`
|
||||
SubPlanIDs []uint `json:"sub_plan_ids,omitempty" validate:"omitempty,dive"`
|
||||
SubPlanIDs []uint32 `json:"sub_plan_ids,omitempty" validate:"omitempty,dive"`
|
||||
Tasks []TaskRequest `json:"tasks,omitempty" validate:"omitempty,dive"`
|
||||
}
|
||||
|
||||
// PlanResponse 定义计划详情响应的结构体
|
||||
type PlanResponse struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
ID uint32 `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"`
|
||||
ExecuteCount uint `json:"execute_count" example:"0"`
|
||||
ExecuteNum uint32 `json:"execute_num" example:"10"`
|
||||
ExecuteCount uint32 `json:"execute_count" example:"0"`
|
||||
CronExpression string `json:"cron_expression" example:"0 0 6 * * *"`
|
||||
ContentType models.PlanContentType `json:"content_type" example:"任务"`
|
||||
SubPlans []SubPlanResponse `json:"sub_plans,omitempty"`
|
||||
@@ -50,17 +50,17 @@ type UpdatePlanRequest struct {
|
||||
Name string `json:"name" example:"猪舍温度控制计划V2"`
|
||||
Description string `json:"description" example:"更新后的描述"`
|
||||
ExecutionType models.PlanExecutionType `json:"execution_type" validate:"required" example:"自动"`
|
||||
ExecuteNum uint `json:"execute_num,omitempty" validate:"omitempty,min=0" example:"10"`
|
||||
ExecuteNum uint32 `json:"execute_num,omitempty" validate:"omitempty,min=0" example:"10"`
|
||||
CronExpression string `json:"cron_expression" validate:"omitempty,cron" example:"0 0 6 * * *"`
|
||||
SubPlanIDs []uint `json:"sub_plan_ids,omitempty" validate:"omitempty,dive"`
|
||||
SubPlanIDs []uint32 `json:"sub_plan_ids,omitempty" validate:"omitempty,dive"`
|
||||
Tasks []TaskRequest `json:"tasks,omitempty" validate:"omitempty,dive"`
|
||||
}
|
||||
|
||||
// SubPlanResponse 定义子计划响应结构体
|
||||
type SubPlanResponse struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
ParentPlanID uint `json:"parent_plan_id" example:"1"`
|
||||
ChildPlanID uint `json:"child_plan_id" example:"2"`
|
||||
ID uint32 `json:"id" example:"1"`
|
||||
ParentPlanID uint32 `json:"parent_plan_id" example:"1"`
|
||||
ChildPlanID uint32 `json:"child_plan_id" example:"2"`
|
||||
ExecutionOrder int `json:"execution_order" example:"1"`
|
||||
ChildPlan *PlanResponse `json:"child_plan,omitempty"`
|
||||
}
|
||||
@@ -77,7 +77,7 @@ type TaskRequest struct {
|
||||
// TaskResponse 定义任务响应结构体
|
||||
type TaskResponse struct {
|
||||
ID int `json:"id" example:"1"`
|
||||
PlanID uint `json:"plan_id" example:"1"`
|
||||
PlanID uint32 `json:"plan_id" example:"1"`
|
||||
Name string `json:"name" example:"打开风扇"`
|
||||
Description string `json:"description" example:"打开1号风扇"`
|
||||
ExecutionOrder int `json:"execution_order" example:"1"`
|
||||
|
||||
@@ -16,19 +16,19 @@ type LoginRequest struct {
|
||||
// CreateUserResponse 定义创建用户成功响应的结构体
|
||||
type CreateUserResponse struct {
|
||||
Username string `json:"username" example:"newuser"`
|
||||
ID uint `json:"id" example:"1"`
|
||||
ID uint32 `json:"id" example:"1"`
|
||||
}
|
||||
|
||||
// LoginResponse 定义登录成功响应的结构体
|
||||
type LoginResponse struct {
|
||||
Username string `json:"username" example:"testuser"`
|
||||
ID uint `json:"id" example:"1"`
|
||||
ID uint32 `json:"id" example:"1"`
|
||||
Token string `json:"token" example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."`
|
||||
}
|
||||
|
||||
// HistoryResponse 定义单条操作历史的响应结构体
|
||||
type HistoryResponse struct {
|
||||
UserID uint `json:"user_id" example:"101"`
|
||||
UserID uint32 `json:"user_id" example:"101"`
|
||||
Username string `json:"username" example:"testuser"`
|
||||
ActionType string `json:"action_type" example:"更新设备"`
|
||||
Description string `json:"description" example:"设备更新成功"`
|
||||
|
||||
Reference in New Issue
Block a user