- 展示门店商品时,在分类下,按Sku.Seq排序

This commit is contained in:
gazebo
2019-08-30 18:41:44 +08:00
parent 3e7b07fc9e
commit 5e0f93a1c8

View File

@@ -346,6 +346,10 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo
panic(r) panic(r)
} }
}() }()
catOrderBy := ""
if params["categoryID"] != nil {
catOrderBy = "t2.seq, "
}
skuNamesInfo = &StoreSkuNamesInfo{} skuNamesInfo = &StoreSkuNamesInfo{}
if !isBySku && sqlPageSize < 1000 { 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 = ?)" sql += " OR (t1.id = ? AND t3.id = ?)"
sqlParams = append(sqlParams, v.NameID, v.StoreID) sqlParams = append(sqlParams, v.NameID, v.StoreID)
} }
sql += `) sql += fmt.Sprintf(`)
ORDER BY t3.id, t2.name_id, t2.id ORDER BY %s t3.id, t2.name_id, t2.id`, catOrderBy)
`
} else { } else {
if isFocus { if isFocus {
sql += ` sql += fmt.Sprintf(`
ORDER BY t3.id, t2.name_id, t2.id ORDER BY %s t3.id, t2.name_id, t2.id`, catOrderBy)
`
} }
sql += ` sql += `
LIMIT ? OFFSET ? LIMIT ? OFFSET ?`
`
sqlParams = append(sqlParams, sqlParamsPage) sqlParams = append(sqlParams, sqlParamsPage)
} }
sql = ` sql = `