正在显示
1 个修改的文件
包含
20 行增加
和
16 行删除
@@ -499,7 +499,6 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval | @@ -499,7 +499,6 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval | ||
499 | } | 499 | } |
500 | 500 | ||
501 | userIds := make([]int, 0) | 501 | userIds := make([]int, 0) |
502 | - positionIds := make([]int, 0) | ||
503 | projectIds := make([]int, 0) | 502 | projectIds := make([]int, 0) |
504 | projectCountMap := map[string]int{} // 自评逾期数量 | 503 | projectCountMap := map[string]int{} // 自评逾期数量 |
505 | userMap := map[int64]*domain.User{} // 用户 | 504 | userMap := map[int64]*domain.User{} // 用户 |
@@ -510,22 +509,27 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval | @@ -510,22 +509,27 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval | ||
510 | userIds = append(userIds, it.TargetUser.UserId) | 509 | userIds = append(userIds, it.TargetUser.UserId) |
511 | projectIds = append(projectIds, list[i].EvaluationProjectId) | 510 | projectIds = append(projectIds, list[i].EvaluationProjectId) |
512 | } | 511 | } |
513 | - _, users, err := userRepo.Find(map[string]interface{}{"ids": userIds, "companyId": param.CompanyId}) | ||
514 | - if err != nil { | ||
515 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
516 | - } | ||
517 | - for i := range users { | ||
518 | - userMap[users[i].Id] = users[i] | ||
519 | - for _, pid := range users[i].PositionId { | ||
520 | - positionIds = append(positionIds, pid) | 512 | + if len(userIds) > 0 { |
513 | + _, users, err := userRepo.Find(map[string]interface{}{"ids": userIds, "companyId": param.CompanyId}) | ||
514 | + if err != nil { | ||
515 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
516 | + } | ||
517 | + positionIds := make([]int, 0) | ||
518 | + for i := range users { | ||
519 | + userMap[users[i].Id] = users[i] | ||
520 | + for _, pid := range users[i].PositionId { | ||
521 | + positionIds = append(positionIds, pid) | ||
522 | + } | ||
523 | + } | ||
524 | + if len(positionIds) > 0 { | ||
525 | + _, positions, err := positionRepo.Find(map[string]interface{}{"ids": positionIds, "companyId": param.CompanyId}) | ||
526 | + if err != nil { | ||
527 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
528 | + } | ||
529 | + for i := range positions { | ||
530 | + positionMap[positions[i].Id] = positions[i] | ||
531 | + } | ||
521 | } | 532 | } |
522 | - } | ||
523 | - _, positions, err := positionRepo.Find(map[string]interface{}{"ids": positionIds, "companyId": param.CompanyId}) | ||
524 | - if err != nil { | ||
525 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
526 | - } | ||
527 | - for i := range positions { | ||
528 | - positionMap[positions[i].Id] = positions[i] | ||
529 | } | 533 | } |
530 | 534 | ||
531 | if len(projectIds) > 0 { | 535 | if len(projectIds) > 0 { |
-
请 注册 或 登录 后发表评论