This commit is contained in:
Mrx
2026-05-27 13:10:00 +08:00
parent 5cee8ff035
commit 9e136bbd6b
6 changed files with 15 additions and 30 deletions

View File

@@ -205,7 +205,7 @@ func (r *GormProductRepository) ListProducts(ctx context.Context, query *queries
}
// 预加载分类信息并获取数据
if err := dbQuery.Preload("Category").Find(&productEntities).Error; err != nil {
if err := dbQuery.Preload("Category").Preload("SubCategory").Find(&productEntities).Error; err != nil {
return nil, 0, err
}