aa
This commit is contained in:
@@ -1095,16 +1095,19 @@ 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"` //销量
|
||||
Status int `json:"status"`
|
||||
SpecQuality int `json:"specQuality"`
|
||||
SpecUnit string `json:"specUnit"`
|
||||
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"` //销量
|
||||
JdSaleCount int `json:"saleCount"` //销量
|
||||
MtSaleCount int `json:"saleCount"` //销量
|
||||
EbaiSaleCount 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) {
|
||||
@@ -1120,8 +1123,11 @@ 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,
|
||||
c.spec_quality, c.spec_unit, t.status, 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,
|
||||
c.spec_quality, c.spec_unit, t.status, SUM(IFNULL(a.count,0)) sale_count,
|
||||
SUM(IF(b.vendor_id = 0, IFNULL(a.count,0), 0)) jd_sale_count,
|
||||
SUM(IF(b.vendor_id = 1, IFNULL(a.count,0), 0)) mt_sale_count,
|
||||
SUM(IF(b.vendor_id = 3, IFNULL(a.count,0), 0)) ebai_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
|
||||
@@ -1151,7 +1157,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, 6, 7, 8, 9"
|
||||
sql += " GROUP BY 1, 2, 3, 4, 5, 6, 7, 8"
|
||||
if dataMap["saleCountBegin"] != nil || dataMap["saleCountEnd"] != nil {
|
||||
sql += " HAVING"
|
||||
if dataMap["saleCountBegin"] != nil {
|
||||
@@ -1181,6 +1187,8 @@ func GetStoresSkusSaleInfoNew(ctx *jxcontext.Context, vendorIDs, storeIDs, skuID
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer dao.Commit(db, txDB)
|
||||
fmt.Println(sql)
|
||||
fmt.Println(sqlParams)
|
||||
if err = dao.GetRowsTx(txDB, &list, sql, sqlParams...); err == nil {
|
||||
pageInfo = &model.PagedInfo{
|
||||
TotalCount: dao.GetLastTotalRowCount2(db, txDB),
|
||||
|
||||
@@ -336,7 +336,6 @@ func (c *StoreSkuController) UpdateStoresSkusSale() {
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeIDs query string false "门店ID列表"
|
||||
// @Param skuIDs query string false "Sku ID列表"
|
||||
// @Param vendorIDs query string false "平台 ID列表"
|
||||
// @Param skuNameIDs query string false "Skuname ID列表"
|
||||
// @Param fromTime query string false "开始时间"
|
||||
// @Param toTime query string false "结束时间"
|
||||
|
||||
Reference in New Issue
Block a user