|
@@ -26,13 +26,17 @@ func QueryAllCustomers() (customers []Customer, err error) {
|
|
|
return customers, err
|
|
|
}
|
|
|
|
|
|
-func QueryCustomerList(limit, offset int, name string) (customers []Customer, total int64, err error) {
|
|
|
+func QueryCustomerList(limit, offset, genre int, name string) (customers []Customer, total int64, err error) {
|
|
|
db := global.GVA_DB.Model(&Customer{})
|
|
|
|
|
|
if name != "" {
|
|
|
db = db.Where("name LIKE ?", "%"+name+"%")
|
|
|
}
|
|
|
|
|
|
+ if genre != 0 {
|
|
|
+ db = db.Where("genre = ?", genre)
|
|
|
+ }
|
|
|
+
|
|
|
err = db.Count(&total).Error
|
|
|
if err != nil {
|
|
|
return
|