Files
bssapp/svc/queries/product.go
2026-02-11 17:46:22 +03:00

35 lines
709 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package queries
import (
"bssapp-backend/db"
"bssapp-backend/models"
)
// GetProductList → MSSQL'den ürün listesini döndürür
func GetProductList() ([]models.Product, error) {
rows, err := db.MssqlDB.Query(`
SELECT
ProductCode
FROM ProductFilterWithDescription('TR')
WHERE
ProductAtt42 IN ('SERI', 'AKSESUAR')
AND IsBlocked = 0
AND LEN(ProductCode) = 13 -- 🔹 yalnızca 13 karakterlik kodlar
ORDER BY ProductCode;
`)
if err != nil {
return nil, err
}
defer rows.Close()
var list []models.Product
for rows.Next() {
var p models.Product
if err := rows.Scan(&p.ProductCode); err != nil {
return nil, err
}
list = append(list, p)
}
return list, nil
}