From 5dad8a3ccb52ea81c137278ceaa8537dc86220d2 Mon Sep 17 00:00:00 2001 From: liangzai <2440983361@qq.com> Date: Sat, 23 Aug 2025 16:02:03 +0800 Subject: [PATCH] add subscription gorm preload --- .../repositories/product/gorm_subscription_repository.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/infrastructure/database/repositories/product/gorm_subscription_repository.go b/internal/infrastructure/database/repositories/product/gorm_subscription_repository.go index 6bb18d6..d4bc834 100644 --- a/internal/infrastructure/database/repositories/product/gorm_subscription_repository.go +++ b/internal/infrastructure/database/repositories/product/gorm_subscription_repository.go @@ -172,10 +172,10 @@ func (r *GormSubscriptionRepository) ListSubscriptions(ctx context.Context, quer dbQuery = dbQuery.Offset(offset).Limit(query.PageSize) } - // 预加载Product的id、name、code字段,并同时预加载ProductCategory的id、name、code字段 + // 预加载Product的id、name、code、price、is_package字段,并同时预加载ProductCategory的id、name、code字段 if err := dbQuery. Preload("Product", func(db *gorm.DB) *gorm.DB { - return db.Select("id", "name", "code", "category_id"). + return db.Select("id", "name", "code", "price", "is_package", "category_id"). Preload("Category", func(db2 *gorm.DB) *gorm.DB { return db2.Select("id", "name", "code") })