正在显示
6 个修改的文件
包含
25 行增加
和
13 行删除
@@ -157,6 +157,7 @@ func (companyService *CompanyService) ListCompanyCustomizeMenus(listCompanyCusto | @@ -157,6 +157,7 @@ func (companyService *CompanyService) ListCompanyCustomizeMenus(listCompanyCusto | ||
157 | menuCategory = m | 157 | menuCategory = m |
158 | } | 158 | } |
159 | queryOptions["menuTypeIn"] = []string{"catalog", "menu"} | 159 | queryOptions["menuTypeIn"] = []string{"catalog", "menu"} |
160 | + queryOptions["isPublish"] = domain.MenuPublic | ||
160 | _, menus, err := menuRepository.Find(queryOptions) | 161 | _, menus, err := menuRepository.Find(queryOptions) |
161 | if err != nil { | 162 | if err != nil { |
162 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 163 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -145,16 +145,21 @@ func (orgService *OrgService) GetOrgSubDepartment(getOrgSubDepartmentQuery *quer | @@ -145,16 +145,21 @@ func (orgService *OrgService) GetOrgSubDepartment(getOrgSubDepartmentQuery *quer | ||
145 | 145 | ||
146 | orgRepository, org, err := factory.FastPgOrg(transactionContext, getOrgSubDepartmentQuery.OrgId) | 146 | orgRepository, org, err := factory.FastPgOrg(transactionContext, getOrgSubDepartmentQuery.OrgId) |
147 | 147 | ||
148 | - _, orgs, err := orgRepository.Find(map[string]interface{}{"companyId": org.CompanyId, "parentId": getOrgSubDepartmentQuery.OrgId}) | 148 | + _, orgs, err := orgRepository.Find(map[string]interface{}{"companyId": org.CompanyId}) |
149 | if err != nil { | 149 | if err != nil { |
150 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 150 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
151 | } | 151 | } |
152 | - | 152 | + var treeNodes = make([]domain.TreeNode, len(orgs)) |
153 | + for i := 0; i < len(orgs); i++ { | ||
154 | + treeNodes[i] = orgs[i] | ||
155 | + } | ||
156 | + tree := domain.NewTrees(treeNodes) | ||
157 | + nodes := tree.AllChildNodes(org) | ||
153 | if err := transactionContext.CommitTransaction(); err != nil { | 158 | if err := transactionContext.CommitTransaction(); err != nil { |
154 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 159 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
155 | } | 160 | } |
156 | return map[string]interface{}{ | 161 | return map[string]interface{}{ |
157 | - "orgs": orgs, | 162 | + "orgs": nodes, |
158 | }, nil | 163 | }, nil |
159 | } | 164 | } |
160 | 165 |
@@ -15,9 +15,9 @@ type UpdateUserCommand struct { | @@ -15,9 +15,9 @@ type UpdateUserCommand struct { | ||
15 | // 用户Id 用户唯一标识 | 15 | // 用户Id 用户唯一标识 |
16 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` | 16 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` |
17 | // 组织机构 | 17 | // 组织机构 |
18 | - OrganizationId int64 `cname:"组织机构" json:"organizationId,omitempty"` | 18 | + OrganizationId int64 `cname:"组织机构" json:"organizationId,omitempty" valid:"Required"` |
19 | // 所属部门 | 19 | // 所属部门 |
20 | - DepartmentId int64 `cname:"所属部门" json:"departmentId,omitempty"` | 20 | + DepartmentId int64 `cname:"所属部门" json:"departmentId,omitempty" valid:"Required"` |
21 | // 用户关联的组织 | 21 | // 用户关联的组织 |
22 | UserOrg []*domain.Org `cname:"用户关联的组织" json:"userOrg,omitempty"` | 22 | UserOrg []*domain.Org `cname:"用户关联的组织" json:"userOrg,omitempty"` |
23 | // 用户关联的角色 | 23 | // 用户关联的角色 |
@@ -33,9 +33,9 @@ type UpdateUserCommand struct { | @@ -33,9 +33,9 @@ type UpdateUserCommand struct { | ||
33 | // 手机号码 | 33 | // 手机号码 |
34 | Phone string `cname:"手机号码" json:"phone" valid:"Required"` | 34 | Phone string `cname:"手机号码" json:"phone" valid:"Required"` |
35 | // 头像 | 35 | // 头像 |
36 | - Avatar string `cname:"头像" json:"avatar" valid:"Required"` | 36 | + Avatar string `cname:"头像" json:"avatar"` |
37 | // 邮箱 | 37 | // 邮箱 |
38 | - Email string `cname:"邮箱" json:"email" valid:"Required"` | 38 | + Email string `cname:"邮箱" json:"email"` |
39 | } | 39 | } |
40 | 40 | ||
41 | func (updateUserCommand *UpdateUserCommand) Valid(validation *validation.Validation) { | 41 | func (updateUserCommand *UpdateUserCommand) Valid(validation *validation.Validation) { |
@@ -14,9 +14,9 @@ type UserDto struct { | @@ -14,9 +14,9 @@ type UserDto struct { | ||
14 | // 用户编号 企业内标识 | 14 | // 用户编号 企业内标识 |
15 | UserCode string `json:"userCode,omitempty"` | 15 | UserCode string `json:"userCode,omitempty"` |
16 | // 用户关联的组织 | 16 | // 用户关联的组织 |
17 | - UserOrg []*domain.Org `json:"userOrg,omitempty"` | 17 | + UserOrg []*domain.Org `json:"userOrg"` |
18 | // 用户关联的角色 | 18 | // 用户关联的角色 |
19 | - UserRole []*domain.Role `json:"userRole,omitempty"` | 19 | + UserRole []*domain.Role `json:"userRole"` |
20 | // 收藏的菜单(工作台)(菜单编码列表) | 20 | // 收藏的菜单(工作台)(菜单编码列表) |
21 | FavoriteMenus []string `json:"favoriteMenus,omitempty"` | 21 | FavoriteMenus []string `json:"favoriteMenus,omitempty"` |
22 | // 共创信息 (共创用户有效) | 22 | // 共创信息 (共创用户有效) |
@@ -65,6 +65,12 @@ func (dto *UserDto) LoadDto(user *domain.User, company *domain.Company) error { | @@ -65,6 +65,12 @@ func (dto *UserDto) LoadDto(user *domain.User, company *domain.Company) error { | ||
65 | Phone: user.Ext.Phone, | 65 | Phone: user.Ext.Phone, |
66 | } | 66 | } |
67 | } | 67 | } |
68 | + if len(dto.UserRole) == 0 { | ||
69 | + dto.UserRole = make([]*domain.Role, 0) | ||
70 | + } | ||
71 | + if len(dto.UserOrg) == 0 { | ||
72 | + dto.UserOrg = make([]*domain.Org, 0) | ||
73 | + } | ||
68 | dto.Organization = user.Organization | 74 | dto.Organization = user.Organization |
69 | dto.Department = user.Department | 75 | dto.Department = user.Department |
70 | return nil | 76 | return nil |
@@ -41,7 +41,7 @@ func NewTree(node TreeNode) *Tree { | @@ -41,7 +41,7 @@ func NewTree(node TreeNode) *Tree { | ||
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
44 | -// AllChildNodes 返回node下所有子节点 | 44 | +// AllChildNodes 返回node下所有子节点,包含本身 |
45 | func (tree *Tree) AllChildNodes(node TreeNode) []TreeNode { | 45 | func (tree *Tree) AllChildNodes(node TreeNode) []TreeNode { |
46 | treeNode := tree.find(node) | 46 | treeNode := tree.find(node) |
47 | if treeNode == nil { | 47 | if treeNode == nil { |
@@ -163,9 +163,9 @@ func (repository *MenuRepository) Find(queryOptions map[string]interface{}) (int | @@ -163,9 +163,9 @@ func (repository *MenuRepository) Find(queryOptions map[string]interface{}) (int | ||
163 | if v, ok := queryOptions["menuName"]; ok { | 163 | if v, ok := queryOptions["menuName"]; ok { |
164 | query.Where(fmt.Sprintf("menu_name like '%%%v%%'", v)) | 164 | query.Where(fmt.Sprintf("menu_name like '%%%v%%'", v)) |
165 | } | 165 | } |
166 | - //if v, ok := queryOptions["menuTypeIn"]; ok { | ||
167 | - // query.Where("menu_type in (?)",v) | ||
168 | - //} | 166 | + if v, ok := queryOptions["menuTypeIn"]; ok { |
167 | + query.Where("menu_type in (?)", pg.In(v)) | ||
168 | + } | ||
169 | query.SetWhereByQueryOption("parent_id = ?", "parentId") | 169 | query.SetWhereByQueryOption("parent_id = ?", "parentId") |
170 | query.SetWhereByQueryOption("is_publish =?", "isPublish") | 170 | query.SetWhereByQueryOption("is_publish =?", "isPublish") |
171 | query.SetOrderDirect("parent_id", "asc") | 171 | query.SetOrderDirect("parent_id", "asc") |
-
请 注册 或 登录 后发表评论