This commit is contained in:
2025-11-16 21:44:50 +08:00
parent 148fa1f2bb
commit aa94b47773
6 changed files with 31 additions and 19 deletions

View File

@@ -90,7 +90,7 @@ func (r *gormRawMaterialRepository) ListRawMaterialPurchases(ctx context.Context
if opts.OrderBy != "" {
orderBy = opts.OrderBy
}
query = query.Order(orderBy).Preload("RawMaterial")
query = query.Order(orderBy).Preload("RawMaterials")
offset := (page - 1) * pageSize
err := query.Limit(pageSize).Offset(offset).Find(&results).Error
@@ -178,7 +178,7 @@ func (r *gormRawMaterialRepository) ListFeedUsageRecords(ctx context.Context, op
if opts.OrderBy != "" {
orderBy = opts.OrderBy
}
query = query.Order(orderBy).Preload("Pen").Preload("FeedFormula")
query = query.Order(orderBy).Preload("Pens").Preload("FeedFormulas")
offset := (page - 1) * pageSize
err := query.Limit(pageSize).Offset(offset).Find(&results).Error