pagination.go 347 B

1234567891011121314151617181920
  1. package dto
  2. type Pagination struct {
  3. PageIndex int `form:"pageIndex" example:"1"`
  4. PageSize int `form:"pageSize" example:"10"`
  5. }
  6. func (m *Pagination) GetPageIndex() int {
  7. if m.PageIndex <= 0 {
  8. m.PageIndex = 1
  9. }
  10. return m.PageIndex
  11. }
  12. func (m *Pagination) GetPageSize() int {
  13. if m.PageSize <= 0 {
  14. m.PageSize = 10
  15. }
  16. return m.PageSize
  17. }