geoGo/tmpl/dataTemp/req_page.go

34 lines
564 B
Go
Raw 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 dataTemp
// ReqPageBo 分页请求实体
type ReqPageBo struct {
Page int //页码从第1页开始
Limit int //分页大小
}
// GetOffset 获取便宜量
// 确保 dataTemp/page.go 中有这些方法
func (p *ReqPageBo) GetSize() int {
if p == nil {
return 10 // 默认每页10条
}
if p.Limit <= 0 {
return 10
}
return p.Limit
}
func (p *ReqPageBo) GetOffset() int {
if p == nil {
return 0
}
return (p.GetPage() - 1) * p.GetSize()
}
func (p *ReqPageBo) GetPage() int {
if p == nil || p.Page <= 0 {
return 1
}
return p.Page
}