Merge origin/main
This commit is contained in:
@@ -232,7 +232,8 @@ func (r *PricelistRepository) GetItems(pricelistID uint, offset, limit int, sear
|
||||
}
|
||||
|
||||
var items []models.PricelistItem
|
||||
// Optimized query with JOIN only for lot_description (category is now stored in pricelist_items)
|
||||
// Optimized query with JOIN to avoid N+1
|
||||
// lot_category is stored in pricelist_items, lot_description comes from JOIN
|
||||
itemsQuery := r.db.Table("qt_pricelist_items AS pi").
|
||||
Select("pi.*, COALESCE(l.lot_description, '') AS lot_description").
|
||||
Joins("LEFT JOIN lot AS l ON l.lot_name = pi.lot_name").
|
||||
|
||||
Reference in New Issue
Block a user