完成任务5
This commit is contained in:
@@ -8,11 +8,11 @@ import (
|
||||
|
||||
// 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"` // 批次状态,必填
|
||||
BatchNumber string `json:"batch_number" validate:"required"` // 批次编号,必填
|
||||
OriginType models.PigBatchOriginType `json:"origin_type" validate:"required"` // 批次来源,必填
|
||||
StartDate time.Time `json:"start_date" validate:"required"` // 批次开始日期,必填
|
||||
InitialCount int `json:"initial_count" validate:"required,min=1"` // 初始数量,必填,最小为1
|
||||
Status models.PigBatchStatus `json:"status" validate:"required"` // 批次状态,必填
|
||||
}
|
||||
|
||||
// PigBatchUpdateDTO 定义了更新猪批次的请求结构
|
||||
@@ -27,7 +27,7 @@ type PigBatchUpdateDTO struct {
|
||||
|
||||
// PigBatchQueryDTO 定义了查询猪批次的请求结构
|
||||
type PigBatchQueryDTO struct {
|
||||
IsActive *bool `json:"is_active" form:"is_active"` // 是否活跃,可选,用于URL查询参数
|
||||
IsActive *bool `json:"is_active" query:"is_active"` // 是否活跃,可选,用于URL查询参数
|
||||
}
|
||||
|
||||
// PigBatchResponseDTO 定义了猪批次信息的响应结构
|
||||
@@ -48,115 +48,115 @@ type PigBatchResponseDTO struct {
|
||||
|
||||
// AssignEmptyPensToBatchRequest 用于为猪批次分配空栏的请求体
|
||||
type AssignEmptyPensToBatchRequest struct {
|
||||
PenIDs []uint `json:"penIDs" binding:"required,min=1" example:"[1,2,3]"` // 待分配的猪栏ID列表
|
||||
PenIDs []uint `json:"penIDs" validate:"required,min=1,dive" example:"[1,2,3]"` // 待分配的猪栏ID列表
|
||||
}
|
||||
|
||||
// ReclassifyPenToNewBatchRequest 用于将猪栏划拨到新批次的请求体
|
||||
type ReclassifyPenToNewBatchRequest struct {
|
||||
ToBatchID uint `json:"toBatchID" binding:"required"` // 目标猪批次ID
|
||||
PenID uint `json:"penID" binding:"required"` // 待划拨的猪栏ID
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
ToBatchID uint `json:"toBatchID" validate:"required"` // 目标猪批次ID
|
||||
PenID uint `json:"penID" validate:"required"` // 待划拨的猪栏ID
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// RemoveEmptyPenFromBatchRequest 用于从猪批次移除空栏的请求体
|
||||
type RemoveEmptyPenFromBatchRequest struct {
|
||||
PenID uint `json:"penID" binding:"required"` // 待移除的猪栏ID
|
||||
PenID uint `json:"penID" validate:"required"` // 待移除的猪栏ID
|
||||
}
|
||||
|
||||
// MovePigsIntoPenRequest 用于将猪只从“虚拟库存”移入指定猪栏的请求体
|
||||
type MovePigsIntoPenRequest struct {
|
||||
ToPenID uint `json:"toPenID" binding:"required"` // 目标猪栏ID
|
||||
Quantity int `json:"quantity" binding:"required,min=1"` // 移入猪只数量
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
ToPenID uint `json:"toPenID" validate:"required"` // 目标猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 移入猪只数量
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// SellPigsRequest 用于处理卖猪的请求体
|
||||
type SellPigsRequest struct {
|
||||
PenID uint `json:"penID" binding:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" binding:"required,min=1"` // 卖出猪只数量
|
||||
UnitPrice float64 `json:"unitPrice" binding:"required,min=0"` // 单价
|
||||
TotalPrice float64 `json:"totalPrice" binding:"required,min=0"` // 总价
|
||||
TraderName string `json:"traderName" binding:"required"` // 交易方名称
|
||||
TradeDate time.Time `json:"tradeDate" binding:"required"` // 交易日期
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
PenID uint `json:"penID" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 卖出猪只数量
|
||||
UnitPrice float64 `json:"unitPrice" validate:"required,min=0"` // 单价
|
||||
TotalPrice float64 `json:"totalPrice" validate:"required,min=0"` // 总价
|
||||
TraderName string `json:"traderName" validate:"required"` // 交易方名称
|
||||
TradeDate time.Time `json:"tradeDate" validate:"required"` // 交易日期
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// BuyPigsRequest 用于处理买猪的请求体
|
||||
type BuyPigsRequest struct {
|
||||
PenID uint `json:"penID" binding:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" binding:"required,min=1"` // 买入猪只数量
|
||||
UnitPrice float64 `json:"unitPrice" binding:"required,min=0"` // 单价
|
||||
TotalPrice float64 `json:"totalPrice" binding:"required,min=0"` // 总价
|
||||
TraderName string `json:"traderName" binding:"required"` // 交易方名称
|
||||
TradeDate time.Time `json:"tradeDate" binding:"required"` // 交易日期
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
PenID uint `json:"penID" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 买入猪只数量
|
||||
UnitPrice float64 `json:"unitPrice" validate:"required,min=0"` // 单价
|
||||
TotalPrice float64 `json:"totalPrice" validate:"required,min=0"` // 总价
|
||||
TraderName string `json:"traderName" validate:"required"` // 交易方名称
|
||||
TradeDate time.Time `json:"tradeDate" validate:"required"` // 交易日期
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// TransferPigsAcrossBatchesRequest 用于跨猪群调栏的请求体
|
||||
type TransferPigsAcrossBatchesRequest struct {
|
||||
DestBatchID uint `json:"destBatchID" binding:"required"` // 目标猪批次ID
|
||||
FromPenID uint `json:"fromPenID" binding:"required"` // 源猪栏ID
|
||||
ToPenID uint `json:"toPenID" binding:"required"` // 目标猪栏ID
|
||||
Quantity uint `json:"quantity" binding:"required,min=1"` // 调栏猪只数量
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
DestBatchID uint `json:"destBatchID" validate:"required"` // 目标猪批次ID
|
||||
FromPenID uint `json:"fromPenID" validate:"required"` // 源猪栏ID
|
||||
ToPenID uint `json:"toPenID" validate:"required"` // 目标猪栏ID
|
||||
Quantity uint `json:"quantity" validate:"required,min=1"` // 调栏猪只数量
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// TransferPigsWithinBatchRequest 用于群内调栏的请求体
|
||||
type TransferPigsWithinBatchRequest struct {
|
||||
FromPenID uint `json:"fromPenID" binding:"required"` // 源猪栏ID
|
||||
ToPenID uint `json:"toPenID" binding:"required"` // 目标猪栏ID
|
||||
Quantity uint `json:"quantity" binding:"required,min=1"` // 调栏猪只数量
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
FromPenID uint `json:"fromPenID" validate:"required"` // 源猪栏ID
|
||||
ToPenID uint `json:"toPenID" validate:"required"` // 目标猪栏ID
|
||||
Quantity uint `json:"quantity" validate:"required,min=1"` // 调栏猪只数量
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// RecordSickPigsRequest 用于记录新增病猪事件的请求体
|
||||
type RecordSickPigsRequest struct {
|
||||
PenID uint `json:"penID" binding:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" binding:"required,min=1"` // 病猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatmentLocation" binding:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happenedAt" binding:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
PenID uint `json:"penID" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 病猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatmentLocation" validate:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happenedAt" validate:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// RecordSickPigRecoveryRequest 用于记录病猪康复事件的请求体
|
||||
type RecordSickPigRecoveryRequest struct {
|
||||
PenID uint `json:"penID" binding:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" binding:"required,min=1"` // 康复猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatmentLocation" binding:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happenedAt" binding:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
PenID uint `json:"penID" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 康复猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatmentLocation" validate:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happenedAt" validate:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// RecordSickPigDeathRequest 用于记录病猪死亡事件的请求体
|
||||
type RecordSickPigDeathRequest struct {
|
||||
PenID uint `json:"penID" binding:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" binding:"required,min=1"` // 死亡猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatmentLocation" binding:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happenedAt" binding:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
PenID uint `json:"penID" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 死亡猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatmentLocation" validate:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happenedAt" validate:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// RecordSickPigCullRequest 用于记录病猪淘汰事件的请求体
|
||||
type RecordSickPigCullRequest struct {
|
||||
PenID uint `json:"penID" binding:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" binding:"required,min=1"` // 淘汰猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatmentLocation" binding:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happenedAt" binding:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
PenID uint `json:"penID" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 淘汰猪数量
|
||||
TreatmentLocation models.PigBatchSickPigTreatmentLocation `json:"treatmentLocation" validate:"required"` // 治疗地点
|
||||
HappenedAt time.Time `json:"happenedAt" validate:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// RecordDeathRequest 用于记录正常猪只死亡事件的请求体
|
||||
type RecordDeathRequest struct {
|
||||
PenID uint `json:"penID" binding:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" binding:"required,min=1"` // 死亡猪数量
|
||||
HappenedAt time.Time `json:"happenedAt" binding:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
PenID uint `json:"penID" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 死亡猪数量
|
||||
HappenedAt time.Time `json:"happenedAt" validate:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
// RecordCullRequest 用于记录正常猪只淘汰事件的请求体
|
||||
type RecordCullRequest struct {
|
||||
PenID uint `json:"penID" binding:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" binding:"required,min=1"` // 淘汰猪数量
|
||||
HappenedAt time.Time `json:"happenedAt" binding:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
PenID uint `json:"penID" validate:"required"` // 猪栏ID
|
||||
Quantity int `json:"quantity" validate:"required,min=1"` // 淘汰猪数量
|
||||
HappenedAt time.Time `json:"happenedAt" validate:"required"` // 发生时间
|
||||
Remarks string `json:"remarks"` // 备注
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user