This commit is contained in:
suyl
2021-06-24 13:50:38 +08:00
parent 56fb0eb6ad
commit 998ebe942f

View File

@@ -1095,13 +1095,16 @@ func GetStoresSkusSaleInfo(ctx *jxcontext.Context, storeIDs []int, skuIDs []int,
}
type GetStoresSkusSaleInfoNewResult struct {
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
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"` //销量
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
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"` //销量
Status int `json:"status"`
SpecQuality int `json:"specQuality"`
SpecUnit string `json:"specUnit"`
}
func GetStoresSkusSaleInfoNew(ctx *jxcontext.Context, vendorIDs, storeIDs, skuIDs, skuNameIDs []int, fromTime, toTime string, dataMap map[string]interface{}, sortType int, keyword string, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
@@ -1117,7 +1120,8 @@ 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, e.id name_id, 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,
c.spec_quality, c.spec_unit, t.status
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