aa
This commit is contained in:
@@ -3177,6 +3177,10 @@ func GetStoreCategoryMap(ctx *jxcontext.Context, parentID, level int, storeID in
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
//表示没有门店分类
|
||||
if len(storeCatMaps) == 0 {
|
||||
storeCatMaps, err = dao.GetCategoriesForStore(db, parentID, 0, nil)
|
||||
}
|
||||
return storeCatMaps, err
|
||||
}
|
||||
|
||||
|
||||
@@ -97,6 +97,31 @@ func GetCategories(db *DaoDB, parentID, level int, catIDs []int, isExd bool) (ca
|
||||
return cats, GetRows(db, &cats, sql, params)
|
||||
}
|
||||
|
||||
func GetCategoriesForStore(db *DaoDB, parentID, level int, catIDs []int) (cats []*model.StoreCategoryMap, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM sku_category t1
|
||||
WHERE t1.deleted_at = ?`
|
||||
params := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if parentID != -1 {
|
||||
sql += " AND t1.parent_id = ?"
|
||||
params = append(params, parentID)
|
||||
}
|
||||
if len(catIDs) > 0 {
|
||||
sql += " AND t1.id IN (" + GenQuestionMarks(len(catIDs)) + ")"
|
||||
params = append(params, catIDs)
|
||||
}
|
||||
if level > 0 {
|
||||
sql += " AND t1.level = ?"
|
||||
params = append(params, level)
|
||||
}
|
||||
sql += ` AND t1.is_exd_spec = 0
|
||||
ORDER BY t1.level, t1.seq`
|
||||
return cats, GetRows(db, &cats, sql, params)
|
||||
}
|
||||
|
||||
func GetSkus(db *DaoDB, skuIDs, nameIDs, statuss, catIDs []int, eclpIDs []string) (skuList []*model.SkuAndName, err error) {
|
||||
sql := `
|
||||
SELECT t1.*, t2.name, t2.unit, t2.prefix, t2.is_spu, t2.ex_prefix, t2.ex_prefix_begin, t2.ex_prefix_end, t2.upc
|
||||
|
||||
Reference in New Issue
Block a user