feat 添加PageListQuery构造函数

This commit is contained in:
timerzz 2024-08-26 15:13:13 +08:00
parent 33ca01c975
commit 759c035eae

View File

@ -27,6 +27,25 @@ type PageListQuery struct {
PageQuery PageQuery
} }
func NewPageListQuery(scoper Scoper) *PageListQuery {
return &PageListQuery{Scoper: scoper}
}
func (p *PageListQuery) SetPage(page int) *PageListQuery {
p.Page = page
return p
}
func (p *PageListQuery) SetPageSize(pageSize int) *PageListQuery {
p.Size = pageSize
return p
}
func (p *PageListQuery) SetScoper(scoper Scoper) *PageListQuery {
p.Scoper = scoper
return p
}
func (p *PageListQuery) Scope(db *gorm.DB) *gorm.DB { func (p *PageListQuery) Scope(db *gorm.DB) *gorm.DB {
if p.Scoper != nil { if p.Scoper != nil {
db = p.Scoper.Scope(db) db = p.Scoper.Scope(db)