品牌类别接口
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user