ListPigSickLogs
This commit is contained in:
@@ -392,3 +392,34 @@ func NewListPigTransferLogResponse(data []models.PigTransferLog, total int64, pa
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewListPigSickLogResponse 从模型数据创建列表响应 DTO
|
||||
func NewListPigSickLogResponse(data []models.PigSickLog, total int64, page, pageSize int) *ListPigSickLogResponse {
|
||||
dtos := make([]PigSickLogDTO, len(data))
|
||||
for i, item := range data {
|
||||
dtos[i] = PigSickLogDTO{
|
||||
ID: item.ID,
|
||||
CreatedAt: item.CreatedAt,
|
||||
UpdatedAt: item.UpdatedAt,
|
||||
PigBatchID: item.PigBatchID,
|
||||
PenID: item.PenID,
|
||||
ChangeCount: item.ChangeCount,
|
||||
Reason: item.Reason,
|
||||
BeforeCount: item.BeforeCount,
|
||||
AfterCount: item.AfterCount,
|
||||
Remarks: item.Remarks,
|
||||
TreatmentLocation: item.TreatmentLocation,
|
||||
OperatorID: item.OperatorID,
|
||||
HappenedAt: item.HappenedAt,
|
||||
}
|
||||
}
|
||||
|
||||
return &ListPigSickLogResponse{
|
||||
List: dtos,
|
||||
Pagination: PaginationDTO{
|
||||
Total: total,
|
||||
Page: page,
|
||||
PageSize: pageSize,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user