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 = `