|
@@ -4,6 +4,8 @@ import ( |
|
@@ -4,6 +4,8 @@ import ( |
4
|
"context"
|
4
|
"context"
|
5
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
|
5
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
|
6
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
|
6
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
|
|
|
7
|
+ "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
|
|
|
8
|
+ "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
|
7
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
|
9
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
|
8
|
|
10
|
|
9
|
"github.com/zeromicro/go-zero/core/logx"
|
11
|
"github.com/zeromicro/go-zero/core/logx"
|
|
@@ -24,17 +26,32 @@ func NewSystemGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemG |
|
@@ -24,17 +26,32 @@ func NewSystemGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemG |
24
|
}
|
26
|
}
|
25
|
|
27
|
|
26
|
func (l *SystemGetLogic) SystemGet(req *types.DepartmentGetRequest) (resp *types.DepartmentGetResponse, err error) {
|
28
|
func (l *SystemGetLogic) SystemGet(req *types.DepartmentGetRequest) (resp *types.DepartmentGetResponse, err error) {
|
|
|
29
|
+ var userToken = contextdata.GetUserTokenFromCtx(l.ctx)
|
27
|
var conn = l.svcCtx.DefaultDBConn()
|
30
|
var conn = l.svcCtx.DefaultDBConn()
|
28
|
department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, req.Id)
|
31
|
department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, req.Id)
|
29
|
if err != nil {
|
32
|
if err != nil {
|
30
|
return nil, xerr.NewErrMsg("数据不存在")
|
33
|
return nil, xerr.NewErrMsg("数据不存在")
|
31
|
}
|
34
|
}
|
|
|
35
|
+
|
|
|
36
|
+ // 部门下的用户
|
|
|
37
|
+ _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithFindOnly().
|
|
|
38
|
+ WithKV("companyId", userToken.CompanyId).
|
|
|
39
|
+ WithKV("auditStatus", domain.UserAuditStatusPassed).
|
|
|
40
|
+ WithKV("departmentId", department.Id))
|
|
|
41
|
+ if err != nil {
|
|
|
42
|
+ return nil, err
|
|
|
43
|
+ }
|
|
|
44
|
+ ids := make([]int64, 0)
|
|
|
45
|
+ for i := range users {
|
|
|
46
|
+ ids = append(ids, users[i].Id)
|
|
|
47
|
+ }
|
32
|
resp = &types.DepartmentGetResponse{
|
48
|
resp = &types.DepartmentGetResponse{
|
33
|
Department: types.Department{
|
49
|
Department: types.Department{
|
34
|
Id: department.Id,
|
50
|
Id: department.Id,
|
35
|
CompanyId: department.CompanyId,
|
51
|
CompanyId: department.CompanyId,
|
36
|
ParentId: department.ParentId,
|
52
|
ParentId: department.ParentId,
|
37
|
Name: department.Name,
|
53
|
Name: department.Name,
|
|
|
54
|
+ UserIds: ids,
|
38
|
},
|
55
|
},
|
39
|
}
|
56
|
}
|
40
|
return resp, nil
|
57
|
return resp, nil
|