ListWeighingRecords
This commit is contained in:
@@ -335,3 +335,30 @@ func NewListWeighingBatchResponse(data []models.WeighingBatch, total int64, page
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewListWeighingRecordResponse 从模型数据创建列表响应 DTO
|
||||
func NewListWeighingRecordResponse(data []models.WeighingRecord, total int64, page, pageSize int) *ListWeighingRecordResponse {
|
||||
dtos := make([]WeighingRecordDTO, len(data))
|
||||
for i, item := range data {
|
||||
dtos[i] = WeighingRecordDTO{
|
||||
ID: item.ID,
|
||||
CreatedAt: item.CreatedAt,
|
||||
UpdatedAt: item.UpdatedAt,
|
||||
Weight: item.Weight,
|
||||
WeighingBatchID: item.WeighingBatchID,
|
||||
PenID: item.PenID,
|
||||
OperatorID: item.OperatorID,
|
||||
Remark: item.Remark,
|
||||
WeighingTime: item.WeighingTime,
|
||||
}
|
||||
}
|
||||
|
||||
return &ListWeighingRecordResponse{
|
||||
List: dtos,
|
||||
Pagination: PaginationDTO{
|
||||
Total: total,
|
||||
Page: page,
|
||||
PageSize: pageSize,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user