Skip to content

Commit

Permalink
fix SelectPage() Bug (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzzsfy authored Mar 22, 2023
1 parent 1f82446 commit 9f67fd7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gplus/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func SelectPage[T any](page *Page[T], q *Query[T], dbs ...*gorm.DB) (*Page[T], *
return page, countDb
}
page.Total = total
resultDb := buildCondition(q)
resultDb := buildCondition(q, dbs...)
var results []*T
resultDb.Scopes(paginate(page)).Find(&results)
page.Records = results
Expand All @@ -188,7 +188,7 @@ func SelectPageModel[T any, R any](page *Page[R], q *Query[T], dbs ...*gorm.DB)
return page, countDb
}
page.Total = total
resultDb := buildCondition(q)
resultDb := buildCondition(q, dbs...)
var results []*R
resultDb.Scopes(paginate(page)).Scan(&results)
page.Records = results
Expand All @@ -201,7 +201,7 @@ func SelectPageMaps[T any](page *Page[map[string]any], q *Query[T], dbs ...*gorm
return page, countDb
}
page.Total = total
resultDb := buildCondition(q)
resultDb := buildCondition(q, dbs...)
var results []map[string]any
resultDb.Scopes(paginate(page)).Find(&results)
for _, m := range results {
Expand Down

0 comments on commit 9f67fd7

Please sign in to comment.