This commit is contained in:
suyl
2021-09-02 15:31:30 +08:00
parent 670661b835
commit 74ab043dd3
3 changed files with 67 additions and 1 deletions

View File

@@ -1369,3 +1369,30 @@ func GetBrandBalance(db *DaoDB, brandID int) (result int, err error) {
err = GetRow(db, &balance, sql, sqlParams)
return balance.Balance, err
}
func GetBrandBill(db *DaoDB, brandID int, vendorOrderID string, billType, feeType int) (result []*model.BrandBill, err error) {
sql := `
SELECT *
FROM brand_bill
WHERE 1 = 1
`
sqlParams := []interface{}{}
if brandID != 0 {
sql += " AND brand_id = ?"
sqlParams = append(sqlParams, brandID)
}
if billType != 0 {
sql += " AND bill_type = ?"
sqlParams = append(sqlParams, billType)
}
if feeType != 0 {
sql += " AND fee_type = ?"
sqlParams = append(sqlParams, feeType)
}
if vendorOrderID != "" {
sql += " AND vendor_order_id = ?"
sqlParams = append(sqlParams, vendorOrderID)
}
err = GetRows(db, &result, sql, sqlParams)
return result, err
}