作者 yangfu

Merge branch 'dev' into test

... ... @@ -209,6 +209,7 @@ type(
ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户)
RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户
Keywords string `json:"keywords,optional"` // 按关键字搜索(名称)
DepartmentId int64 `json:"departmentId,optional"` // 按部门过滤
}
MiniUserNewsRequest{
AuthorId int64 `json:"authorId,optional"` // 特定作者ID
... ...
... ... @@ -43,7 +43,8 @@ func (l *MiniAtUsersListLogic) MiniAtUsersList(req *types.MiniUsersListRequest)
onlyUsers = article.WhoRead
}
}
if _, users, err = l.svcCtx.UserRepository.FindDepartmentUsers(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions().WithKV("name", req.Keywords).WithFindOnly()); err != nil {
if _, users, err = l.svcCtx.UserRepository.FindDepartmentUsers(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions().
WithKV("name", req.Keywords).WithKV("departmentId", req.DepartmentId).WithFindOnly()); err != nil {
return nil, xerr.NewErrMsgErr("用户列表获取失败", err)
}
if len(onlyUsers) > 0 {
... ...
... ... @@ -559,9 +559,10 @@ type MiniUserDepartmentUsersResponse struct {
}
type MiniUsersListRequest struct {
ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户)
RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户
Keywords string `json:"keywords,optional"` // 按关键字搜索(名称)
ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户)
RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户
Keywords string `json:"keywords,optional"` // 按关键字搜索(名称)
DepartmentId int64 `json:"departmentId,optional"` // 按部门过滤
}
type MiniUserNewsRequest struct {
... ...
... ... @@ -229,6 +229,9 @@ func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn
if v, ok := queryOptions["name"]; ok {
tx.Where("name like ?", fmt.Sprintf("%%%v%%", v))
}
if v, ok := queryOptions["departmentId"]; ok {
tx.Where(fmt.Sprintf("departments::jsonb @>'[%v]'", v))
}
if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
return dms, tx.Error
}
... ...