From 6afa912e543a53a1a17a19e04ce1f2e169fe8486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 16 Dec 2019 11:03:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E8=8D=90=E5=88=86=E7=B1=BB=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/sku.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/business/model/dao/sku.go b/business/model/dao/sku.go index f49b9b3e6..11fdf4f96 100644 --- a/business/model/dao/sku.go +++ b/business/model/dao/sku.go @@ -50,7 +50,7 @@ func DeleteSkuNamePlace(db *DaoDB, nameID int, placeCodes []int) (num int64, err return ExecuteSQL(db, sql, sqlParams...) } -func GetCategories(db *DaoDB, parentID int, catIDs []int) (cats []*model.SkuCategory, err error) { +func GetCategories(db *DaoDB, parentID, level int, catIDs []int) (cats []*model.SkuCategory, err error) { sql := ` SELECT t1.* FROM sku_category t1 @@ -66,6 +66,10 @@ func GetCategories(db *DaoDB, parentID int, catIDs []int) (cats []*model.SkuCate sql += " AND t1.id (" + GenQuestionMarks(len(catIDs)) + ")" params = append(params, catIDs) } + if level > 0 { + sql += " AND t1.level = ?" + params = append(params, level) + } sql += " ORDER BY t1.level, t1.seq" return cats, GetRows(db, &cats, sql, params) }