作者 yangfu

角色服务修改

{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627631911600010400}
\ No newline at end of file
{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627694567421282600}
\ No newline at end of file
... ...
... ... @@ -121,21 +121,31 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (
// 编辑角色关联权限菜单的前置准备数据
func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *query.RoleMenuBeforeEditQuery) (interface{}, error) {
//creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
// roleMenuBeforeEditQuery.Operator.CompanyId,
// roleMenuBeforeEditQuery.Operator.OrgId,
// roleMenuBeforeEditQuery.Operator.UserId)
//roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId)
//roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
// OrgId: roleMenuBeforeEditQuery.Operator.OrgId,
// Limit: 999,
// RoleType: 1,
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleMenuBeforeEditQuery.Operator.CompanyId,
roleMenuBeforeEditQuery.Operator.OrgId,
roleMenuBeforeEditQuery.Operator.UserId)
roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId)
roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
OrgId: roleMenuBeforeEditQuery.Operator.OrgId,
Limit: 999,
RoleType: 1,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return nil, nil
menus, err := creationUserGateway.RoleGetAccessMenus(allied_creation_user.ReqRoleGetAccessMenus{
RoleId: int64(roleId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
result := map[string]interface{}{
"roles": roles.Roles,
"menus": menus.Menus,
}
return result, nil
}
// 编辑角色关联用户的前置准备数据
... ...
... ... @@ -188,20 +188,20 @@ type (
DataRoleGetAccessMenus struct {
Menus []struct {
MenuID int `json:"menuId"`
ParentID int `json:"parentId"`
MenuName string `json:"menuName"`
MenuAlias string `json:"menuAlias"`
Code string `json:"code"`
AccessCode string `json:"accessCode,omitempty"`
MenuType string `json:"menuType"`
Icon string `json:"icon"`
Sort int `json:"sort"`
Remark string `json:"remark,omitempty"`
Category string `json:"category"`
IsPublish int `json:"isPublish"`
EnableStatus int `json:"enableStatus"`
ParentPath string `json:"parentPath,omitempty"`
MenuID Int64String `json:"menuId"`
ParentID Int64String `json:"parentId"`
MenuName string `json:"menuName"`
MenuAlias string `json:"menuAlias"`
Code string `json:"code"`
AccessCode string `json:"accessCode,omitempty"`
MenuType string `json:"menuType"`
Icon string `json:"icon"`
Sort int `json:"sort"`
Remark string `json:"remark,omitempty"`
Category string `json:"category"`
IsPublish int `json:"isPublish"`
EnableStatus int `json:"enableStatus"`
ParentPath string `json:"parentPath,omitempty"`
} `json:"menus"`
}
)
... ...
... ... @@ -92,6 +92,8 @@ func (controller *RolesController) RoleMenuBeforeEdit() {
roleMenuBeforeEditQuery := &query.RoleMenuBeforeEditQuery{}
roleMenuBeforeEditQuery.Operator = controller.GetOperator()
controller.Unmarshal(roleMenuBeforeEditQuery)
roleId := controller.GetString(":roleId")
roleMenuBeforeEditQuery.RoleId = roleId
data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery)
controller.Response(data, err)
}
... ...
... ... @@ -14,7 +14,7 @@ func init() {
web.Router("/v1/web/roles/role-user/assign", &web_client.RolesController{}, "Post:RoleUserAdd")
web.Router("/v1/web/roles/role-user/unassign", &web_client.RolesController{}, "Post:RoleUserDelete")
web.Router("/v1/web/roles/role-user/before-edit", &web_client.RolesController{}, "Get:RoleUserBeforeEdit")
web.Router("/v1/web/roles/role-menu/before-edit", &web_client.RolesController{}, "Get:RoleMenuBeforeEdit")
web.Router("/v1/web/roles/role-menu/before-edit/:roleId", &web_client.RolesController{}, "Get:RoleMenuBeforeEdit")
web.Router("/v1/web/roles/role-menu/:roleId", &web_client.RolesController{}, "Put:RoleMenuEdit")
web.Router("/v1/web/roles/batch-delete", &web_client.RolesController{}, "Post:RoleDelete")
}
... ...