Skip to content

Commit 9f67fd7

Browse files
authored
fix SelectPage() Bug (#26)
1 parent 1f82446 commit 9f67fd7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gplus/dao.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func SelectPage[T any](page *Page[T], q *Query[T], dbs ...*gorm.DB) (*Page[T], *
175175
return page, countDb
176176
}
177177
page.Total = total
178-
resultDb := buildCondition(q)
178+
resultDb := buildCondition(q, dbs...)
179179
var results []*T
180180
resultDb.Scopes(paginate(page)).Find(&results)
181181
page.Records = results
@@ -188,7 +188,7 @@ func SelectPageModel[T any, R any](page *Page[R], q *Query[T], dbs ...*gorm.DB)
188188
return page, countDb
189189
}
190190
page.Total = total
191-
resultDb := buildCondition(q)
191+
resultDb := buildCondition(q, dbs...)
192192
var results []*R
193193
resultDb.Scopes(paginate(page)).Scan(&results)
194194
page.Records = results
@@ -201,7 +201,7 @@ func SelectPageMaps[T any](page *Page[map[string]any], q *Query[T], dbs ...*gorm
201201
return page, countDb
202202
}
203203
page.Total = total
204-
resultDb := buildCondition(q)
204+
resultDb := buildCondition(q, dbs...)
205205
var results []map[string]any
206206
resultDb.Scopes(paginate(page)).Find(&results)
207207
for _, m := range results {

0 commit comments

Comments
 (0)