From 30974ee5cab8b7bd5740095615934aebd78aa2c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Sun, 19 Jan 2020 16:50:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=95=86=E5=93=81=E6=95=B0?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 97ee58b11..01eaea4bc 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -527,12 +527,14 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore FROM store_price_score_snapshot a JOIN store b ON b.id = a.store_id JOIN place e ON e.code = b.city_code - LEFT JOIN (SELECT a.store_id, count(d.type = ? OR NULL) direct_down_count, count(d.type = ? OR NULL) sec_kill_count - FROM store_sku_bind a - LEFT JOIN act_store_sku b ON a.store_id = b.store_id AND b.sku_id = a.sku_id - LEFT JOIN act_map c ON c.act_id = b.act_id - LEFT JOIN act d ON d.id = c.act_id - WHERE 1=1 + LEFT JOIN (SELECT t1.store_id,count(t1.type = ? OR NULL) direct_down_count, count(t1.type = ? OR NULL) sec_kill_count + FROM( + SELECT a.store_id, a.sku_id,d.type + FROM store_sku_bind a + LEFT JOIN act_store_sku b ON a.store_id = b.store_id AND b.sku_id = a.sku_id + LEFT JOIN act_map c ON c.act_id = b.act_id + LEFT JOIN act d ON d.id = c.act_id + WHERE 1=1 ` sqlParams := []interface{}{ model.ActSkuDirectDown, model.ActSkuSecKill, @@ -549,7 +551,8 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore AND NOW() BETWEEN d.begin_at AND d.end_at AND a.status = ? AND a.deleted_at = ? - GROUP BY a.store_id)t1 ON t1.store_id = a.store_id + GROUP BY 1,2,3)t1 + GROUP BY 1)ON t1.store_id = a.store_id WHERE 1=1 ` sqlParams = append(sqlParams, model.StoreSkuBindStatusNormal, utils.DefaultTimeValue)