...
|
...
|
@@ -43,11 +43,15 @@ 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).WithKV("departmentId", req.DepartmentId).WithFindOnly()); err != nil {
|
|
|
queryOptions := domain.NewQueryOptions().
|
|
|
WithKV("name", req.Keywords).WithFindOnly()
|
|
|
if req.DepartmentId != nil && *req.DepartmentId > 0 {
|
|
|
queryOptions.WithKV("departmentId", *req.DepartmentId)
|
|
|
}
|
|
|
if _, users, err = l.svcCtx.UserRepository.FindDepartmentUsers(l.ctx, conn, userToken.CompanyId, queryOptions); err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("用户列表获取失败", err)
|
|
|
}
|
|
|
if len(onlyUsers) > 0 {
|
|
|
if len(onlyUsers) > 0 || (req.DepartmentId != nil && *req.DepartmentId == 0) {
|
|
|
onlyUsersMap := lo.KeyBy(onlyUsers, func(item int64) int64 {
|
|
|
return item
|
|
|
})
|
...
|
...
|
@@ -55,6 +59,11 @@ func (l *MiniAtUsersListLogic) MiniAtUsersList(req *types.MiniUsersListRequest) |
|
|
if _, ok := onlyUsersMap[item.Id]; ok {
|
|
|
return false
|
|
|
}
|
|
|
if req.DepartmentId != nil && *req.DepartmentId == 0 {
|
|
|
if len(item.Departments) > 0 {
|
|
|
return false
|
|
|
}
|
|
|
}
|
|
|
return true
|
|
|
})
|
|
|
}
|
...
|
...
|
|