feat 添加PageListQuery构造函数
This commit is contained in:
parent
33ca01c975
commit
759c035eae
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user