FrontInterfaceCenter/internal/biz/bo/resp_page.go

23 lines
430 B
Go

package bo
// RespPageBo 分页响应实体
type RespPageBo struct {
Page int //页码
Limit int //每页大小
Total int //总数
}
// SetDataByReq 通过req 设置响应参数
func (r *RespPageBo) SetDataByReq(total int, reqPage *ReqPageBo) *RespPageBo {
resp := r
if r == nil {
resp = &RespPageBo{}
}
resp.Total = total
if reqPage != nil {
resp.Page = reqPage.Page
resp.Limit = reqPage.Limit
}
return resp
}