作者 tangxvhui

调整人员的查询逻辑

@@ -42,7 +42,10 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr @@ -42,7 +42,10 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr
42 var userList []*domain.User 42 var userList []*domain.User
43 if articleInfo.TargetUser == domain.ArticleTargetAll { 43 if articleInfo.TargetUser == domain.ArticleTargetAll {
44 //获取所有人 44 //获取所有人
45 - queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("companyId", articleInfo.CompanyId) 45 + queryOption := domain.NewQueryOptions().WithFindOnly().
  46 + MustWithKV("companyId", articleInfo.CompanyId).
  47 + MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed})
  48 +
46 _, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) 49 _, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
47 if err != nil { 50 if err != nil {
48 resp = &types.MiniArticleCommentAtWhoResponse{} 51 resp = &types.MiniArticleCommentAtWhoResponse{}
@@ -91,7 +91,9 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini @@ -91,7 +91,9 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini
91 atWhoIds = append(atWhoIds, val.Id) 91 atWhoIds = append(atWhoIds, val.Id)
92 } 92 }
93 atWhoIds = lo.Uniq(atWhoIds) 93 atWhoIds = lo.Uniq(atWhoIds)
94 - queryOption := domain.NewQueryOptions().WithFindOnly().WithKV("ids", atWhoIds) 94 + queryOption := domain.NewQueryOptions().WithFindOnly().
  95 + WithKV("ids", atWhoIds).
  96 + MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed})
95 _, atWhoList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) 97 _, atWhoList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
96 if err != nil { 98 if err != nil {
97 return nil, xerr.NewErrMsgErr("检查@的人员失败", err) 99 return nil, xerr.NewErrMsgErr("检查@的人员失败", err)
@@ -49,7 +49,9 @@ func (l *SystemEditAticleCommentLogic) SystemEditAticleComment(req *types.System @@ -49,7 +49,9 @@ func (l *SystemEditAticleCommentLogic) SystemEditAticleComment(req *types.System
49 maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead)) 49 maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead))
50 } else { 50 } else {
51 //统计全员人数 51 //统计全员人数
52 - queryOption := domain.NewQueryOptions().WithCountOnly().MustWithKV("companyId", req.CompanyId) 52 + queryOption := domain.NewQueryOptions().WithCountOnly().
  53 + MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}).
  54 + MustWithKV("companyId", req.CompanyId)
53 cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) 55 cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
54 if err != nil { 56 if err != nil {
55 return nil, xerr.NewErrMsgErr("获取人员数据失败", err) 57 return nil, xerr.NewErrMsgErr("获取人员数据失败", err)
@@ -61,7 +61,9 @@ func (l *SystemEditAticleCommentLoveLogic) SystemEditAticleCommentLove(req *type @@ -61,7 +61,9 @@ func (l *SystemEditAticleCommentLoveLogic) SystemEditAticleCommentLove(req *type
61 maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead)) 61 maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead))
62 } else { 62 } else {
63 //统计全员人数 63 //统计全员人数
64 - queryOption := domain.NewQueryOptions().WithCountOnly().MustWithKV("companyId", req.CompanyId) 64 + queryOption := domain.NewQueryOptions().WithCountOnly().
  65 + MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}).
  66 + MustWithKV("companyId", req.CompanyId)
65 cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) 67 cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
66 if err != nil { 68 if err != nil {
67 return nil, xerr.NewErrMsgErr("获取人员数据失败", err) 69 return nil, xerr.NewErrMsgErr("获取人员数据失败", err)
@@ -2,6 +2,7 @@ package department @@ -2,6 +2,7 @@ package department
2 2
3 import ( 3 import (
4 "context" 4 "context"
  5 +
5 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" 6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" 8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
@@ -58,7 +59,9 @@ func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (re @@ -58,7 +59,9 @@ func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (re
58 // 获取公司下的所有用户 59 // 获取公司下的所有用户
59 _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). 60 _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().
60 WithFindOnly(). 61 WithFindOnly().
61 - WithKV("companyId", one.CompanyId)) 62 + WithKV("companyId", one.CompanyId).MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}),
  63 + )
  64 +
62 if err != nil { 65 if err != nil {
63 return nil, err 66 return nil, err
64 } 67 }