This commit is contained in:
suyl
2021-06-08 14:01:33 +08:00
parent 74c0565ad0
commit 73d51012d6

View File

@@ -1099,6 +1099,7 @@ type GetStoresSkusSaleInfoNewResult struct {
StoreID int `orm:"column(store_id)" json:"storeID"`
StoreName string `json:"storeName"`
SkuID int `orm:"column(sku_id)" json:"skuID"`
SkuNameID int `orm:"column(name_id)" json:"skuNameID"`
SkuName string `json:"skuName"`
SaleCount int `json:"saleCount"` //销量
}
@@ -1116,7 +1117,7 @@ func GetStoresSkusSaleInfoNew(ctx *jxcontext.Context, vendorIDs, storeIDs, skuID
}
sql := `
SELECT SQL_CALC_FOUND_ROWS t1.* FROM (
SELECT d.id store_id, d.name store_name, c.id sku_id, e.name sku_name, a.vendor_id, SUM(IFNULL(a.count,0)) sale_count
SELECT d.id store_id, d.name store_name, c.id sku_id, e.name sku_name, e.id name_id, a.vendor_id, SUM(IFNULL(a.count,0)) sale_count
FROM store_sku_bind t
LEFT JOIN order_sku a ON t.sku_id = IF(a.jx_sku_id = 0, a.sku_id, a.jx_sku_id)
LEFT JOIN goods_order b ON t.store_id = IF(b.jx_store_id = 0, b.store_id, b.jx_store_id) AND a.vendor_id = b.vendor_id AND a.vendor_order_id = b.vendor_order_id
@@ -1146,7 +1147,7 @@ func GetStoresSkusSaleInfoNew(ctx *jxcontext.Context, vendorIDs, storeIDs, skuID
sql += " AND (e.name LIKE ? OR d.name LIKE ? OR d.id = ? OR a.vendor_order_id = ?)"
sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%", keyword, keyword)
}
sql += " GROUP BY 1, 2, 3, 4, 5"
sql += " GROUP BY 1, 2, 3, 4, 5, 6"
if dataMap["saleCountBegin"] != nil || dataMap["saleCountEnd"] != nil {
sql += " HAVING"
if dataMap["saleCountBegin"] != nil {