diff --git a/model/tenant.go b/model/tenant.go index 001ec7a..925dff9 100644 --- a/model/tenant.go +++ b/model/tenant.go @@ -49,10 +49,11 @@ func (o *Tenant) List(db *gorm.DB, where map[string]interface{}, page *Page, key if keywords != "" { db = db.Where("concat (id, title, remark) like ?", "%"+keywords+"%") } + db = db.Table(o.TableName()).Count(&total) if page != nil { db = FormatPage(db, page) } - err = db.Find(&tenants).Count(&total).Error + err = db.Find(&tenants).Error return }