From 5e0f93a1c8df883fefc2300eef05e2a0ca833ece Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 30 Aug 2019 18:41:44 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=B1=95=E7=A4=BA=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E5=95=86=E5=93=81=E6=97=B6=EF=BC=8C=E5=9C=A8=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E6=8C=89Sku.Seq=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 8b0cbe12b..3503f6676 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -346,6 +346,10 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo panic(r) } }() + catOrderBy := "" + if params["categoryID"] != nil { + catOrderBy = "t2.seq, " + } skuNamesInfo = &StoreSkuNamesInfo{} if !isBySku && sqlPageSize < 1000 { @@ -372,18 +376,15 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo sql += " OR (t1.id = ? AND t3.id = ?)" sqlParams = append(sqlParams, v.NameID, v.StoreID) } - sql += `) - ORDER BY t3.id, t2.name_id, t2.id - ` + sql += fmt.Sprintf(`) + ORDER BY %s t3.id, t2.name_id, t2.id`, catOrderBy) } else { if isFocus { - sql += ` - ORDER BY t3.id, t2.name_id, t2.id - ` + sql += fmt.Sprintf(` + ORDER BY %s t3.id, t2.name_id, t2.id`, catOrderBy) } sql += ` - LIMIT ? OFFSET ? - ` + LIMIT ? OFFSET ?` sqlParams = append(sqlParams, sqlParamsPage) } sql = `