分类与sku返回mapList信息

This commit is contained in:
gazebo
2019-12-09 17:37:56 +08:00
parent 8b33ec5f5a
commit 75a2833510
6 changed files with 125 additions and 29 deletions

View File

@@ -13,6 +13,11 @@ type tStoreSkuSyncInfo2 struct {
VendorPlaceCode string
}
type SkuCategoryWithVendor struct {
*model.SkuCategory
MapList []*model.ThingMap `json:"mapList"`
}
func GetSellCities(db *DaoDB, nameID int, vendorID int) (cities []*model.Place, err error) {
cities = []*model.Place{}
sql := `
@@ -44,6 +49,26 @@ 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) {
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 (" + GenQuestionMarks(len(catIDs)) + ")"
params = append(params, catIDs)
}
sql += " ORDER BY t1.level, t1.seq"
return cats, GetRows(db, &cats, sql, params)
}
func GetSkus(db *DaoDB, skuIDs, nameIDs, statuss, catIDs []int) (skuList []*model.SkuAndName, err error) {
sql := `
SELECT t1.*, t2.name, t2.unit, t2.prefix, t2.is_spu