Merge origin/main

This commit is contained in:
Mikhail Chusavitin
2026-02-18 10:12:07 +03:00
18 changed files with 1236 additions and 159 deletions

View File

@@ -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").