...
|
...
|
@@ -145,16 +145,21 @@ func (orgService *OrgService) GetOrgSubDepartment(getOrgSubDepartmentQuery *quer |
|
|
|
|
|
orgRepository, org, err := factory.FastPgOrg(transactionContext, getOrgSubDepartmentQuery.OrgId)
|
|
|
|
|
|
_, orgs, err := orgRepository.Find(map[string]interface{}{"companyId": org.CompanyId, "parentId": getOrgSubDepartmentQuery.OrgId})
|
|
|
_, orgs, err := orgRepository.Find(map[string]interface{}{"companyId": org.CompanyId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
var treeNodes = make([]domain.TreeNode, len(orgs))
|
|
|
for i := 0; i < len(orgs); i++ {
|
|
|
treeNodes[i] = orgs[i]
|
|
|
}
|
|
|
tree := domain.NewTrees(treeNodes)
|
|
|
nodes := tree.AllChildNodes(org)
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"orgs": orgs,
|
|
|
"orgs": nodes,
|
|
|
}, nil
|
|
|
}
|
|
|
|
...
|
...
|
|