FrontInterfaceCenter/internal/biz/bo/req_page.go

36 lines
528 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package bo
// ReqPageBo 分页请求实体
type ReqPageBo struct {
Page int //页码从第1页开始
Limit int //分页大小
}
// GetOffset 获取便宜量
func (r *ReqPageBo) GetOffset() int {
if r == nil {
return 0
}
offset := (r.Page - 1) * r.Limit
if offset < 0 {
return 0
}
return offset
}
// GetSize 获取分页
func (r *ReqPageBo) GetSize() int {
if r == nil {
return 20
}
return r.Limit
}
// GetNum 获取页码
func (r *ReqPageBo) GetNum() int {
if r == nil {
return 1
}
return r.Page
}