feat: update page list show

This commit is contained in:
yanghao05
2025-04-08 15:35:58 +08:00
parent 7d28dff65b
commit cf8bb5f192
13 changed files with 280 additions and 102 deletions

View File

@@ -13,10 +13,17 @@ type Pagination struct {
Limit int64 `json:"limit" form:"limit" query:"limit"`
}
func (filter *Pagination) Offset() int64 {
func (filter *Pagination) GetOffset() int64 {
return (filter.Page - 1) * filter.Limit
}
func (filter *Pagination) GetLimit() int64 {
if filter.Limit <= 0 {
return 10
}
return filter.Limit
}
func (filter *Pagination) Format() *Pagination {
if filter.Page <= 0 {
filter.Page = 1