作者 yangfu

角色服务修改

1 -{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627631911600010400}  
  1 +{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627694567421282600}
@@ -121,21 +121,31 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) ( @@ -121,21 +121,31 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (
121 121
122 // 编辑角色关联权限菜单的前置准备数据 122 // 编辑角色关联权限菜单的前置准备数据
123 func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *query.RoleMenuBeforeEditQuery) (interface{}, error) { 123 func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *query.RoleMenuBeforeEditQuery) (interface{}, error) {
124 - //creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(  
125 - // roleMenuBeforeEditQuery.Operator.CompanyId,  
126 - // roleMenuBeforeEditQuery.Operator.OrgId,  
127 - // roleMenuBeforeEditQuery.Operator.UserId)  
128 - //roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId)  
129 - //roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{  
130 - // OrgId: roleMenuBeforeEditQuery.Operator.OrgId,  
131 - // Limit: 999,  
132 - // RoleType: 1,  
133 - //})  
134 - //if err != nil {  
135 - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
136 - //} 124 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  125 + roleMenuBeforeEditQuery.Operator.CompanyId,
  126 + roleMenuBeforeEditQuery.Operator.OrgId,
  127 + roleMenuBeforeEditQuery.Operator.UserId)
  128 + roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId)
  129 + roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
  130 + OrgId: roleMenuBeforeEditQuery.Operator.OrgId,
  131 + Limit: 999,
  132 + RoleType: 1,
  133 + })
  134 + if err != nil {
  135 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  136 + }
137 137
138 - return nil, nil 138 + menus, err := creationUserGateway.RoleGetAccessMenus(allied_creation_user.ReqRoleGetAccessMenus{
  139 + RoleId: int64(roleId),
  140 + })
  141 + if err != nil {
  142 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  143 + }
  144 + result := map[string]interface{}{
  145 + "roles": roles.Roles,
  146 + "menus": menus.Menus,
  147 + }
  148 + return result, nil
139 } 149 }
140 150
141 // 编辑角色关联用户的前置准备数据 151 // 编辑角色关联用户的前置准备数据
@@ -188,20 +188,20 @@ type ( @@ -188,20 +188,20 @@ type (
188 188
189 DataRoleGetAccessMenus struct { 189 DataRoleGetAccessMenus struct {
190 Menus []struct { 190 Menus []struct {
191 - MenuID int `json:"menuId"`  
192 - ParentID int `json:"parentId"`  
193 - MenuName string `json:"menuName"`  
194 - MenuAlias string `json:"menuAlias"`  
195 - Code string `json:"code"`  
196 - AccessCode string `json:"accessCode,omitempty"`  
197 - MenuType string `json:"menuType"`  
198 - Icon string `json:"icon"`  
199 - Sort int `json:"sort"`  
200 - Remark string `json:"remark,omitempty"`  
201 - Category string `json:"category"`  
202 - IsPublish int `json:"isPublish"`  
203 - EnableStatus int `json:"enableStatus"`  
204 - ParentPath string `json:"parentPath,omitempty"` 191 + MenuID Int64String `json:"menuId"`
  192 + ParentID Int64String `json:"parentId"`
  193 + MenuName string `json:"menuName"`
  194 + MenuAlias string `json:"menuAlias"`
  195 + Code string `json:"code"`
  196 + AccessCode string `json:"accessCode,omitempty"`
  197 + MenuType string `json:"menuType"`
  198 + Icon string `json:"icon"`
  199 + Sort int `json:"sort"`
  200 + Remark string `json:"remark,omitempty"`
  201 + Category string `json:"category"`
  202 + IsPublish int `json:"isPublish"`
  203 + EnableStatus int `json:"enableStatus"`
  204 + ParentPath string `json:"parentPath,omitempty"`
205 } `json:"menus"` 205 } `json:"menus"`
206 } 206 }
207 ) 207 )
@@ -92,6 +92,8 @@ func (controller *RolesController) RoleMenuBeforeEdit() { @@ -92,6 +92,8 @@ func (controller *RolesController) RoleMenuBeforeEdit() {
92 roleMenuBeforeEditQuery := &query.RoleMenuBeforeEditQuery{} 92 roleMenuBeforeEditQuery := &query.RoleMenuBeforeEditQuery{}
93 roleMenuBeforeEditQuery.Operator = controller.GetOperator() 93 roleMenuBeforeEditQuery.Operator = controller.GetOperator()
94 controller.Unmarshal(roleMenuBeforeEditQuery) 94 controller.Unmarshal(roleMenuBeforeEditQuery)
  95 + roleId := controller.GetString(":roleId")
  96 + roleMenuBeforeEditQuery.RoleId = roleId
95 data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery) 97 data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery)
96 controller.Response(data, err) 98 controller.Response(data, err)
97 } 99 }
@@ -14,7 +14,7 @@ func init() { @@ -14,7 +14,7 @@ func init() {
14 web.Router("/v1/web/roles/role-user/assign", &web_client.RolesController{}, "Post:RoleUserAdd") 14 web.Router("/v1/web/roles/role-user/assign", &web_client.RolesController{}, "Post:RoleUserAdd")
15 web.Router("/v1/web/roles/role-user/unassign", &web_client.RolesController{}, "Post:RoleUserDelete") 15 web.Router("/v1/web/roles/role-user/unassign", &web_client.RolesController{}, "Post:RoleUserDelete")
16 web.Router("/v1/web/roles/role-user/before-edit", &web_client.RolesController{}, "Get:RoleUserBeforeEdit") 16 web.Router("/v1/web/roles/role-user/before-edit", &web_client.RolesController{}, "Get:RoleUserBeforeEdit")
17 - web.Router("/v1/web/roles/role-menu/before-edit", &web_client.RolesController{}, "Get:RoleMenuBeforeEdit") 17 + web.Router("/v1/web/roles/role-menu/before-edit/:roleId", &web_client.RolesController{}, "Get:RoleMenuBeforeEdit")
18 web.Router("/v1/web/roles/role-menu/:roleId", &web_client.RolesController{}, "Put:RoleMenuEdit") 18 web.Router("/v1/web/roles/role-menu/:roleId", &web_client.RolesController{}, "Put:RoleMenuEdit")
19 web.Router("/v1/web/roles/batch-delete", &web_client.RolesController{}, "Post:RoleDelete") 19 web.Router("/v1/web/roles/batch-delete", &web_client.RolesController{}, "Post:RoleDelete")
20 } 20 }