|
@@ -44,6 +44,8 @@ func (l *SystemListLogic) SystemList(req *types.DepartmentListRequest) (resp *ty |
|
@@ -44,6 +44,8 @@ func (l *SystemListLogic) SystemList(req *types.DepartmentListRequest) (resp *ty |
44
|
_, users, _ := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().
|
44
|
_, users, _ := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().
|
45
|
MustWithKV("companyId", userToken.CompanyId).
|
45
|
MustWithKV("companyId", userToken.CompanyId).
|
46
|
WithKV("auditStatus", []int{domain.UserAuditStatusPassed}))
|
46
|
WithKV("auditStatus", []int{domain.UserAuditStatusPassed}))
|
|
|
47
|
+
|
|
|
48
|
+ // 统计部门用户数量
|
47
|
var counterByDepartment = make(map[int64]int)
|
49
|
var counterByDepartment = make(map[int64]int)
|
48
|
lo.ForEach(users, func(item *domain.User, index int) {
|
50
|
lo.ForEach(users, func(item *domain.User, index int) {
|
49
|
if len(item.Departments) == 0 {
|
51
|
if len(item.Departments) == 0 {
|
|
@@ -73,19 +75,20 @@ func (l *SystemListLogic) SystemList(req *types.DepartmentListRequest) (resp *ty |
|
@@ -73,19 +75,20 @@ func (l *SystemListLogic) SystemList(req *types.DepartmentListRequest) (resp *ty |
73
|
TotalUser: len(users),
|
75
|
TotalUser: len(users),
|
74
|
})
|
76
|
})
|
75
|
}
|
77
|
}
|
|
|
78
|
+ }
|
|
|
79
|
+
|
76
|
if req.IncludeDefaultDepartment {
|
80
|
if req.IncludeDefaultDepartment {
|
77
|
to := types.Department{
|
81
|
to := types.Department{
|
78
|
Id: domain.DefaultDepartmentId,
|
82
|
Id: domain.DefaultDepartmentId,
|
79
|
- CompanyId: company.Id,
|
83
|
+ CompanyId: userToken.CompanyId,
|
80
|
ParentId: 0,
|
84
|
ParentId: 0,
|
81
|
- Name: "默认分组",
|
85
|
+ Name: "未分组",
|
82
|
}
|
86
|
}
|
83
|
if v, ok := counterByDepartment[domain.DefaultDepartmentId]; ok {
|
87
|
if v, ok := counterByDepartment[domain.DefaultDepartmentId]; ok {
|
84
|
to.TotalUser = v
|
88
|
to.TotalUser = v
|
85
|
}
|
89
|
}
|
86
|
resp.List = append(resp.List, to)
|
90
|
resp.List = append(resp.List, to)
|
87
|
}
|
91
|
}
|
88
|
- }
|
|
|
89
|
|
92
|
|
90
|
for _, item := range list {
|
93
|
for _, item := range list {
|
91
|
to := types.Department{
|
94
|
to := types.Department{
|