aa
This commit is contained in:
@@ -1099,6 +1099,7 @@ type GetStoresSkusSaleInfoNewResult struct {
|
|||||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||||
StoreName string `json:"storeName"`
|
StoreName string `json:"storeName"`
|
||||||
SkuID int `orm:"column(sku_id)" json:"skuID"`
|
SkuID int `orm:"column(sku_id)" json:"skuID"`
|
||||||
|
SkuNameID int `orm:"column(name_id)" json:"skuNameID"`
|
||||||
SkuName string `json:"skuName"`
|
SkuName string `json:"skuName"`
|
||||||
SaleCount int `json:"saleCount"` //销量
|
SaleCount int `json:"saleCount"` //销量
|
||||||
}
|
}
|
||||||
@@ -1116,7 +1117,7 @@ func GetStoresSkusSaleInfoNew(ctx *jxcontext.Context, vendorIDs, storeIDs, skuID
|
|||||||
}
|
}
|
||||||
sql := `
|
sql := `
|
||||||
SELECT SQL_CALC_FOUND_ROWS t1.* FROM (
|
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
|
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 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
|
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 = ?)"
|
sql += " AND (e.name LIKE ? OR d.name LIKE ? OR d.id = ? OR a.vendor_order_id = ?)"
|
||||||
sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%", keyword, keyword)
|
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 {
|
if dataMap["saleCountBegin"] != nil || dataMap["saleCountEnd"] != nil {
|
||||||
sql += " HAVING"
|
sql += " HAVING"
|
||||||
if dataMap["saleCountBegin"] != nil {
|
if dataMap["saleCountBegin"] != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user