正在显示
4 个修改的文件
包含
7 行增加
和
1 行删除
| @@ -209,6 +209,7 @@ type( | @@ -209,6 +209,7 @@ type( | ||
| 209 | ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户) | 209 | ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户) |
| 210 | RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户 | 210 | RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户 |
| 211 | Keywords string `json:"keywords,optional"` // 按关键字搜索(名称) | 211 | Keywords string `json:"keywords,optional"` // 按关键字搜索(名称) |
| 212 | + DepartmentId int64 `json:"departmentId,optional"` // 按部门过滤 | ||
| 212 | } | 213 | } |
| 213 | MiniUserNewsRequest{ | 214 | MiniUserNewsRequest{ |
| 214 | AuthorId int64 `json:"authorId,optional"` // 特定作者ID | 215 | AuthorId int64 `json:"authorId,optional"` // 特定作者ID |
| @@ -43,7 +43,8 @@ func (l *MiniAtUsersListLogic) MiniAtUsersList(req *types.MiniUsersListRequest) | @@ -43,7 +43,8 @@ func (l *MiniAtUsersListLogic) MiniAtUsersList(req *types.MiniUsersListRequest) | ||
| 43 | onlyUsers = article.WhoRead | 43 | onlyUsers = article.WhoRead |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | - if _, users, err = l.svcCtx.UserRepository.FindDepartmentUsers(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions().WithKV("name", req.Keywords).WithFindOnly()); err != nil { | 46 | + if _, users, err = l.svcCtx.UserRepository.FindDepartmentUsers(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions(). |
| 47 | + WithKV("name", req.Keywords).WithKV("departmentId", req.DepartmentId).WithFindOnly()); err != nil { | ||
| 47 | return nil, xerr.NewErrMsgErr("用户列表获取失败", err) | 48 | return nil, xerr.NewErrMsgErr("用户列表获取失败", err) |
| 48 | } | 49 | } |
| 49 | if len(onlyUsers) > 0 { | 50 | if len(onlyUsers) > 0 { |
| @@ -562,6 +562,7 @@ type MiniUsersListRequest struct { | @@ -562,6 +562,7 @@ type MiniUsersListRequest struct { | ||
| 562 | ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户) | 562 | ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户) |
| 563 | RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户 | 563 | RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户 |
| 564 | Keywords string `json:"keywords,optional"` // 按关键字搜索(名称) | 564 | Keywords string `json:"keywords,optional"` // 按关键字搜索(名称) |
| 565 | + DepartmentId int64 `json:"departmentId,optional"` // 按部门过滤 | ||
| 565 | } | 566 | } |
| 566 | 567 | ||
| 567 | type MiniUserNewsRequest struct { | 568 | type MiniUserNewsRequest struct { |
| @@ -229,6 +229,9 @@ func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn | @@ -229,6 +229,9 @@ func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn | ||
| 229 | if v, ok := queryOptions["name"]; ok { | 229 | if v, ok := queryOptions["name"]; ok { |
| 230 | tx.Where("name like ?", fmt.Sprintf("%%%v%%", v)) | 230 | tx.Where("name like ?", fmt.Sprintf("%%%v%%", v)) |
| 231 | } | 231 | } |
| 232 | + if v, ok := queryOptions["departmentId"]; ok { | ||
| 233 | + tx.Where(fmt.Sprintf("departments::jsonb @>'[%v]'", v)) | ||
| 234 | + } | ||
| 232 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | 235 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { |
| 233 | return dms, tx.Error | 236 | return dms, tx.Error |
| 234 | } | 237 | } |
-
请 注册 或 登录 后发表评论