mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 10:55:51 +02:00
enhance(cosy): pagination list
This commit is contained in:
parent
79d0d37526
commit
526fedd04a
1 changed files with 40 additions and 38 deletions
|
@ -104,7 +104,7 @@ func (c *Ctx[T]) PagingListData() (*model.DataList, bool) {
|
|||
return nil, false
|
||||
}
|
||||
|
||||
scopesResult := result.Session(&gorm.Session{}).Scopes(c.OrderAndPaginate())
|
||||
scopesResult := result.Scopes(c.OrderAndPaginate())
|
||||
data := &model.DataList{}
|
||||
if c.scan == nil {
|
||||
models := make([]*T, 0)
|
||||
|
@ -124,7 +124,9 @@ func (c *Ctx[T]) PagingListData() (*model.DataList, bool) {
|
|||
}
|
||||
|
||||
var totalRecords int64
|
||||
result.Session(&gorm.Session{}).Count(&totalRecords)
|
||||
delete(result.Statement.Clauses, "ORDER BY")
|
||||
delete(result.Statement.Clauses, "LIMIT")
|
||||
result.Count(&totalRecords)
|
||||
|
||||
page := cast.ToInt(c.ctx.Query("page"))
|
||||
if page == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue