From 092b0f37d77e980cfaa56b738cd4aeed72a4d4b0 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 5 Mar 2024 17:58:09 +0800 Subject: [PATCH] update --- app/admin/md/md_user.go | 14 ++++++++------ app/admin/svc/svc_user.go | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/app/admin/md/md_user.go b/app/admin/md/md_user.go index 458f718..b625ee4 100644 --- a/app/admin/md/md_user.go +++ b/app/admin/md/md_user.go @@ -1,12 +1,14 @@ package md type UserListReq struct { - Limit int `json:"limit" binding:"required"` - Page int `json:"page" binding:"required"` - Nickname string `json:"nickname" label:"支付宝昵称"` - Phone string `json:"phone" label:"手机号"` - CreateTimeStart string `json:"create_time_start" label:"创建时间-起始"` - CreateTimeEnd string `json:"create_time_end" label:"创建时间-截止"` + Limit int `json:"limit" binding:"required"` + Page int `json:"page" binding:"required"` + Nickname string `json:"nickname" label:"支付宝昵称"` + Phone string `json:"phone" label:"手机号"` + EnterpriseId int `json:"enterprise_id" label:"企业id"` + UserIdentityName string `json:"user_identity_name" label:"身份名称"` + CreateTimeStart string `json:"create_time_start" label:"创建时间-起始"` + CreateTimeEnd string `json:"create_time_end" label:"创建时间-截止"` } type UserListResp struct { diff --git a/app/admin/svc/svc_user.go b/app/admin/svc/svc_user.go index be98842..38d99e8 100644 --- a/app/admin/svc/svc_user.go +++ b/app/admin/svc/svc_user.go @@ -25,6 +25,25 @@ func UserList(req md.UserListReq) (resp md.UserListResp, err error) { if req.CreateTimeEnd != "" { sess.And("create_at <= ?", req.CreateTimeEnd) } + if req.UserIdentityName != "" { + var mm []model.UserIdentity + engine := db.Db.Where("name like ?", "%"+req.UserIdentityName+"%") + if req.EnterpriseId != 0 { + engine = engine.And("enterprise_id =? ", req.EnterpriseId) + } + err = engine.Find(&mm) + if err != nil { + return + } + + if len(mm) > 0 { + var userIds []int + for _, v := range mm { + userIds = append(userIds, v.Uid) + } + sess.In("id", userIds) + } + } resp.Total, err = sess.Desc("user.id").FindAndCount(&m) if err != nil { return