作者 tangxvhui

调整人员的查询逻辑

... ... @@ -42,7 +42,10 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr
var userList []*domain.User
if articleInfo.TargetUser == domain.ArticleTargetAll {
//获取所有人
queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("companyId", articleInfo.CompanyId)
queryOption := domain.NewQueryOptions().WithFindOnly().
MustWithKV("companyId", articleInfo.CompanyId).
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed})
_, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
resp = &types.MiniArticleCommentAtWhoResponse{}
... ...
... ... @@ -91,7 +91,9 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini
atWhoIds = append(atWhoIds, val.Id)
}
atWhoIds = lo.Uniq(atWhoIds)
queryOption := domain.NewQueryOptions().WithFindOnly().WithKV("ids", atWhoIds)
queryOption := domain.NewQueryOptions().WithFindOnly().
WithKV("ids", atWhoIds).
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed})
_, atWhoList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
return nil, xerr.NewErrMsgErr("检查@的人员失败", err)
... ...
... ... @@ -49,7 +49,9 @@ func (l *SystemEditAticleCommentLogic) SystemEditAticleComment(req *types.System
maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead))
} else {
//统计全员人数
queryOption := domain.NewQueryOptions().WithCountOnly().MustWithKV("companyId", req.CompanyId)
queryOption := domain.NewQueryOptions().WithCountOnly().
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}).
MustWithKV("companyId", req.CompanyId)
cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
return nil, xerr.NewErrMsgErr("获取人员数据失败", err)
... ...
... ... @@ -61,7 +61,9 @@ func (l *SystemEditAticleCommentLoveLogic) SystemEditAticleCommentLove(req *type
maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead))
} else {
//统计全员人数
queryOption := domain.NewQueryOptions().WithCountOnly().MustWithKV("companyId", req.CompanyId)
queryOption := domain.NewQueryOptions().WithCountOnly().
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}).
MustWithKV("companyId", req.CompanyId)
cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
return nil, xerr.NewErrMsgErr("获取人员数据失败", err)
... ...
... ... @@ -2,6 +2,7 @@ package department
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
... ... @@ -58,7 +59,9 @@ func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (re
// 获取公司下的所有用户
_, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().
WithFindOnly().
WithKV("companyId", one.CompanyId))
WithKV("companyId", one.CompanyId).MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}),
)
if err != nil {
return nil, err
}
... ...