品牌类别接口

This commit is contained in:
suyl
2021-09-03 09:07:55 +08:00
parent c75699bdeb
commit a29fef75e5
4 changed files with 342 additions and 0 deletions

View File

@@ -1396,3 +1396,36 @@ func GetBrandBill(db *DaoDB, brandID int, vendorOrderID string, billType, feeTyp
err = GetRows(db, &result, sql, sqlParams)
return result, err
}
func GetBrandCategoryMap(db *DaoDB, parentID, level, brandID, categoryID int) (brandCatMaps []*model.BrandCategoryMap, err error) {
sql := `
SELECT a.*
FROM brand_category_map a
WHERE a.deleted_at = ?
`
sqlParams := []interface{}{
utils.DefaultTimeValue,
}
if parentID >= 0 {
sql += " AND a.parent_id = ?"
sqlParams = append(sqlParams, parentID)
}
if level > 0 {
sql += " AND a.level = ?"
sqlParams = append(sqlParams, level)
}
if brandID > 0 {
sql += " AND a.brand_id = ?"
sqlParams = append(sqlParams, brandID)
}
if categoryID > 0 {
sql += " AND a.category_id = ?"
sqlParams = append(sqlParams, categoryID)
}
sql += " ORDER BY a.level, a.brand_category_seq"
err = GetRows(db, &brandCatMaps, sql, sqlParams)
if err != nil {
return nil, err
}
return brandCatMaps, err
}