26 lines
644 B
Go
26 lines
644 B
Go
package service
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"joylink.club/bj-rtsts-server/db/dbquery"
|
|
"joylink.club/bj-rtsts-server/dto"
|
|
)
|
|
|
|
// 分页查询用户列表
|
|
func PagingQueryUser(query *dto.PageUserReqDto) (*dto.PageDto, error) {
|
|
u := dbquery.User
|
|
uq := u.Where()
|
|
if query.Name != "" {
|
|
uq = uq.Where(u.Name.Like(fmt.Sprintf("%%%s%%", query.Name)))
|
|
}
|
|
if query.Mobile != "" {
|
|
uq = uq.Where(u.Mobile.Like(fmt.Sprintf("%%%s%%", query.Mobile)))
|
|
}
|
|
records, total, err := uq.Debug().FindByPage(query.Offset(), query.Size)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return &dto.PageDto{Total: int(total), PageQueryDto: query.PageQueryDto, Records: records}, err
|
|
}
|