|
|
@@ -11,20 +11,19 @@ func UserList(req md.UserListReq) (resp md.UserListResp, err error) { |
|
|
|
var m []model.User |
|
|
|
userDb := db.UserDb{} |
|
|
|
userDb.Set() |
|
|
|
sess := userDb.Db.Join("LEFT", "user_identity", "user.id = user_identity.uid"). |
|
|
|
Join("LEFT", "enterprise", "user_identity.enterprise_id = enterprise.id").Limit(req.Limit, (req.Page-1)*req.Limit) |
|
|
|
sess := userDb.Db.Limit(req.Limit, (req.Page-1)*req.Limit) |
|
|
|
sess.Where("1=1") |
|
|
|
if req.Phone != "" { |
|
|
|
sess.And("user.phone like ?", "%"+req.Phone+"%") |
|
|
|
sess.And("phone like ?", "%"+req.Phone+"%") |
|
|
|
} |
|
|
|
if req.Nickname != "" { |
|
|
|
sess.And("user.nickname like ?", "%"+req.Nickname+"%") |
|
|
|
sess.And("nickname like ?", "%"+req.Nickname+"%") |
|
|
|
} |
|
|
|
if req.CreateTimeStart != "" { |
|
|
|
sess.And("user.create_at >= ?", req.CreateTimeStart) |
|
|
|
sess.And("create_at >= ?", req.CreateTimeStart) |
|
|
|
} |
|
|
|
if req.CreateTimeEnd != "" { |
|
|
|
sess.And("user.create_at <= ?", req.CreateTimeEnd) |
|
|
|
sess.And("create_at <= ?", req.CreateTimeEnd) |
|
|
|
} |
|
|
|
resp.Total, err = sess.Desc("user.id").FindAndCount(&m) |
|
|
|
if err != nil { |
|
|
|