瀏覽代碼

update

add_mode
DengBiao 1 年之前
父節點
當前提交
214b8698ad
共有 1 個檔案被更改,包括 5 行新增6 行删除
  1. +5
    -6
      app/admin/svc/svc_user.go

+ 5
- 6
app/admin/svc/svc_user.go 查看文件

@@ -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 {


Loading…
取消
儲存