Upgrade half or gorm.

This commit is contained in:
lishuang
2022-03-15 01:19:44 +08:00
parent 329751350d
commit 69412300b6
16 changed files with 154 additions and 102 deletions

View File

@ -94,7 +94,7 @@ func (this *UserDao) PlainPage(page int, pageSize int, username string, status s
wp = wp.And(&builder.WherePair{Query: "status = ?", Args: []interface{}{status}})
}
count := 0
var count int64 = 0
db := core.CONTEXT.GetDB().Model(&User{}).Where(wp.Query, wp.Args...).Count(&count)
this.PanicError(db.Error)
@ -108,7 +108,7 @@ func (this *UserDao) PlainPage(page int, pageSize int, username string, status s
this.PanicError(db.Error)
return count, users
return int(count), users
}
//handle user page by page.
@ -136,13 +136,13 @@ func (this *UserDao) PageHandle(username string, status string, fun func(user *U
}
func (this *UserDao) CountByUsername(username string) int {
var count int
var count int64
db := core.CONTEXT.GetDB().
Model(&User{}).
Where("username = ?", username).
Count(&count)
this.PanicError(db.Error)
return count
return int(count)
}
func (this *UserDao) Save(user *User) *User {