37 lines
810 B
Go
37 lines
810 B
Go
package dto
|
|
|
|
type OrderItem struct {
|
|
Column string `form:"column" json:"column"`
|
|
Asc bool `form:"asc" json:"asc"`
|
|
}
|
|
|
|
type PageQueryDto struct {
|
|
Page int `form:"page" json:"page" binding:"required"`
|
|
Size int `form:"size" json:"size" binding:"required"`
|
|
Orders []OrderItem `form:"orders" json:"orders"`
|
|
}
|
|
|
|
type PageDto struct {
|
|
Total int `form:"total" json:"total"`
|
|
PageQueryDto
|
|
Records any `form:"records" json:"records"`
|
|
}
|
|
|
|
// 数据库分页偏移
|
|
func (p *PageQueryDto) Offset() int {
|
|
if p.Page > 0 {
|
|
return (p.Page - 1) * p.Size
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (p *PageQueryDto) Default() {
|
|
p.Page = 1
|
|
p.Size = 10
|
|
}
|
|
|
|
type LoginDto struct {
|
|
Account string `form:"account" json:"account" binding:"required"`
|
|
Password string `form:"password" json:"password" binding:"required"`
|
|
}
|