正在显示
16 个修改的文件
包含
692 行增加
和
27 行删除
pkg/application/roles/command/role_add.go
0 → 100644
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type RoleAddCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 角色名称 | ||
| 14 | + RoleName string `json:"roleName"` | ||
| 15 | + // 描述 | ||
| 16 | + Desc string `json:"desc"` | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +func (roleAddCommand *RoleAddCommand) Valid(validation *validation.Validation) { | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +func (roleAddCommand *RoleAddCommand) ValidateCommand() error { | ||
| 23 | + valid := validation.Validation{} | ||
| 24 | + b, err := valid.Valid(roleAddCommand) | ||
| 25 | + if err != nil { | ||
| 26 | + return err | ||
| 27 | + } | ||
| 28 | + if !b { | ||
| 29 | + for _, validErr := range valid.Errors { | ||
| 30 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + return nil | ||
| 34 | +} |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type RoleMenuEditCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 角色ID | ||
| 14 | + RoleId string `json:"roleId" valid:"Required"` | ||
| 15 | + // 关联菜单的id | ||
| 16 | + MenuId []string `json:"menuId"` | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +func (roleMenuEditQuery *RoleMenuEditCommand) Valid(validation *validation.Validation) { | ||
| 20 | + | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func (roleMenuEditQuery *RoleMenuEditCommand) ValidateQuery() error { | ||
| 24 | + valid := validation.Validation{} | ||
| 25 | + b, err := valid.Valid(roleMenuEditQuery) | ||
| 26 | + if err != nil { | ||
| 27 | + return err | ||
| 28 | + } | ||
| 29 | + if !b { | ||
| 30 | + for _, validErr := range valid.Errors { | ||
| 31 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + return nil | ||
| 35 | +} |
pkg/application/roles/command/role_remove.go
0 → 100644
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type RoleRemoveCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + RoleId []string `json:"roleId"` | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +func (roleRemoveCommand *RoleRemoveCommand) Valid(validation *validation.Validation) { | ||
| 17 | + | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func (roleRemoveCommand *RoleRemoveCommand) ValidateCommand() error { | ||
| 21 | + valid := validation.Validation{} | ||
| 22 | + b, err := valid.Valid(roleRemoveCommand) | ||
| 23 | + if err != nil { | ||
| 24 | + return err | ||
| 25 | + } | ||
| 26 | + if !b { | ||
| 27 | + for _, validErr := range valid.Errors { | ||
| 28 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + return nil | ||
| 32 | +} |
pkg/application/roles/command/role_update.go
0 → 100644
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type RoleUpdateCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + RoleId string `json:"roleId"` | ||
| 14 | + // 角色名称 | ||
| 15 | + RoleName string `json:"roleName"` | ||
| 16 | + // 描述 | ||
| 17 | + Desc string `json:"desc"` | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func (roleUpdateCommand *RoleUpdateCommand) Valid(validation *validation.Validation) { | ||
| 21 | + | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +func (roleUpdateCommand *RoleUpdateCommand) ValidateCommand() error { | ||
| 25 | + valid := validation.Validation{} | ||
| 26 | + b, err := valid.Valid(roleUpdateCommand) | ||
| 27 | + if err != nil { | ||
| 28 | + return err | ||
| 29 | + } | ||
| 30 | + if !b { | ||
| 31 | + for _, validErr := range valid.Errors { | ||
| 32 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + return nil | ||
| 36 | +} |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type RoleUserAddCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + //角色ID | ||
| 14 | + RoleId string `json:"roleId" valid:"Required"` | ||
| 15 | + // 关联用户的id | ||
| 16 | + UserId []string `json:"userId,omitempty"` | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +func (roleUserAddQuery *RoleUserAddCommand) Valid(validation *validation.Validation) { | ||
| 20 | + | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func (roleUserAddQuery *RoleUserAddCommand) ValidateQuery() error { | ||
| 24 | + valid := validation.Validation{} | ||
| 25 | + b, err := valid.Valid(roleUserAddQuery) | ||
| 26 | + if err != nil { | ||
| 27 | + return err | ||
| 28 | + } | ||
| 29 | + if !b { | ||
| 30 | + for _, validErr := range valid.Errors { | ||
| 31 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + return nil | ||
| 35 | +} |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type RoleUserDeleteCommand struct { | ||
| 11 | + // 操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 角色ID | ||
| 14 | + RoleId string `json:"roleId" valid:"Required"` | ||
| 15 | + // 关联用户的id | ||
| 16 | + UserId []string `json:"userId"` | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +func (roleUserDeleteQuery *RoleUserDeleteCommand) Valid(validation *validation.Validation) { | ||
| 20 | + | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func (roleUserDeleteQuery *RoleUserDeleteCommand) ValidateQuery() error { | ||
| 24 | + valid := validation.Validation{} | ||
| 25 | + b, err := valid.Valid(roleUserDeleteQuery) | ||
| 26 | + if err != nil { | ||
| 27 | + return err | ||
| 28 | + } | ||
| 29 | + if !b { | ||
| 30 | + for _, validErr := range valid.Errors { | ||
| 31 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + return nil | ||
| 35 | +} |
pkg/application/roles/dto/dto.go
0 → 100644
pkg/application/roles/query/role_get.go
0 → 100644
| 1 | +package query | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type RoleGetQuery struct { | ||
| 11 | + // 操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 角色ID | ||
| 14 | + RoleId string `json:"roleId" valid:"Required"` | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +func (roleGetQuery *RoleGetQuery) Valid(validation *validation.Validation) { | ||
| 18 | + | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func (roleGetQuery *RoleGetQuery) ValidateQuery() error { | ||
| 22 | + valid := validation.Validation{} | ||
| 23 | + b, err := valid.Valid(roleGetQuery) | ||
| 24 | + if err != nil { | ||
| 25 | + return err | ||
| 26 | + } | ||
| 27 | + if !b { | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + return nil | ||
| 33 | +} |
pkg/application/roles/query/role_list.go
0 → 100644
| 1 | +package query | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type RoleListQuery struct { | ||
| 11 | + // 操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 查询偏离量 | ||
| 14 | + PageNumber int `json:"pageNumber"` | ||
| 15 | + // 查询限制 | ||
| 16 | + PageSize int `json:"pageSize" valid:"Required"` | ||
| 17 | + //角色名 | ||
| 18 | + RoleName string `json:"roleName"` | ||
| 19 | + | ||
| 20 | + OrgName string `json:"orgName"` | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func (roleListQuery *RoleListQuery) Valid(validation *validation.Validation) { | ||
| 24 | + | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +func (roleListQuery *RoleListQuery) ValidateQuery() error { | ||
| 28 | + valid := validation.Validation{} | ||
| 29 | + b, err := valid.Valid(roleListQuery) | ||
| 30 | + if err != nil { | ||
| 31 | + return err | ||
| 32 | + } | ||
| 33 | + if !b { | ||
| 34 | + for _, validErr := range valid.Errors { | ||
| 35 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + return nil | ||
| 39 | +} |
| 1 | +package query | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | +) | ||
| 8 | + | ||
| 9 | +type RoleMenuBeforeEditQuery struct { | ||
| 10 | + // 角色ID | ||
| 11 | + RoleId int64 `json:"roleId" valid:"Required"` | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +func (roleMenuBeforeEditQuery *RoleMenuBeforeEditQuery) Valid(validation *validation.Validation) { | ||
| 15 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +func (roleMenuBeforeEditQuery *RoleMenuBeforeEditQuery) ValidateQuery() error { | ||
| 19 | + valid := validation.Validation{} | ||
| 20 | + b, err := valid.Valid(roleMenuBeforeEditQuery) | ||
| 21 | + if err != nil { | ||
| 22 | + return err | ||
| 23 | + } | ||
| 24 | + if !b { | ||
| 25 | + for _, validErr := range valid.Errors { | ||
| 26 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + return nil | ||
| 30 | +} |
| 1 | +package query | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | +) | ||
| 8 | + | ||
| 9 | +type RoleUserBeforeEditQuery struct { | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +func (roleUserBeforeEditQuery *RoleUserBeforeEditQuery) Valid(validation *validation.Validation) { | ||
| 13 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +func (roleUserBeforeEditQuery *RoleUserBeforeEditQuery) ValidateQuery() error { | ||
| 17 | + valid := validation.Validation{} | ||
| 18 | + b, err := valid.Valid(roleUserBeforeEditQuery) | ||
| 19 | + if err != nil { | ||
| 20 | + return err | ||
| 21 | + } | ||
| 22 | + if !b { | ||
| 23 | + for _, validErr := range valid.Errors { | ||
| 24 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | + return nil | ||
| 28 | +} |
| 1 | +package query | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + | ||
| 6 | + "github.com/beego/beego/v2/core/validation" | ||
| 7 | +) | ||
| 8 | + | ||
| 9 | +type RoleUserInfoQuery struct { | ||
| 10 | + // 角色ID | ||
| 11 | + RoleId int64 `json:"roleId" valid:"Required"` | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +func (roleUserInfoQuery *RoleUserInfoQuery) Valid(validation *validation.Validation) { | ||
| 15 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +func (roleUserInfoQuery *RoleUserInfoQuery) ValidateQuery() error { | ||
| 19 | + valid := validation.Validation{} | ||
| 20 | + b, err := valid.Valid(roleUserInfoQuery) | ||
| 21 | + if err != nil { | ||
| 22 | + return err | ||
| 23 | + } | ||
| 24 | + if !b { | ||
| 25 | + for _, validErr := range valid.Errors { | ||
| 26 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + return nil | ||
| 30 | +} |
pkg/application/roles/service/roles.go
0 → 100644
| 1 | +package service | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "strconv" | ||
| 5 | + | ||
| 6 | + "github.com/linmadan/egglib-go/core/application" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/roles/command" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/roles/dto" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/roles/query" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +// roles | ||
| 14 | +type RolesService struct { | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +// 创建role | ||
| 18 | +func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand) (interface{}, error) { | ||
| 19 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 20 | + roleAddCommand.Operator.CompanyId, | ||
| 21 | + roleAddCommand.Operator.OrgId, | ||
| 22 | + roleAddCommand.Operator.UserId) | ||
| 23 | + _, err := creationUserGateway.RoleCreate(allied_creation_user.ReqRoleCreate{ | ||
| 24 | + RoleName: roleAddCommand.RoleName, | ||
| 25 | + Desc: roleAddCommand.Desc, | ||
| 26 | + }) | ||
| 27 | + if err != nil { | ||
| 28 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 29 | + } | ||
| 30 | + return roleAddCommand, err | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +// 编辑role | ||
| 34 | +func (rolesService *RolesService) RoleEdit(roleUpdateCommand *command.RoleUpdateCommand) (interface{}, error) { | ||
| 35 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 36 | + roleUpdateCommand.Operator.CompanyId, | ||
| 37 | + roleUpdateCommand.Operator.OrgId, | ||
| 38 | + roleUpdateCommand.Operator.UserId) | ||
| 39 | + roleId, _ := strconv.Atoi(roleUpdateCommand.RoleId) | ||
| 40 | + _, err := creationUserGateway.RoleUpdate(allied_creation_user.ReqRoleUpdate{ | ||
| 41 | + RoleId: int64(roleId), | ||
| 42 | + RoleName: roleUpdateCommand.RoleName, | ||
| 43 | + Desc: roleUpdateCommand.Desc, | ||
| 44 | + }) | ||
| 45 | + if err != nil { | ||
| 46 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 47 | + } | ||
| 48 | + return roleUpdateCommand, err | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +// 返单个角色 | ||
| 52 | +func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (interface{}, error) { | ||
| 53 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 54 | + roleGetQuery.Operator.CompanyId, | ||
| 55 | + roleGetQuery.Operator.OrgId, | ||
| 56 | + roleGetQuery.Operator.UserId) | ||
| 57 | + roleId, _ := strconv.Atoi(roleGetQuery.RoleId) | ||
| 58 | + result, err := creationUserGateway.RoleGet(allied_creation_user.ReqRoleGet{ | ||
| 59 | + RoleId: int64(roleId), | ||
| 60 | + }) | ||
| 61 | + if err != nil { | ||
| 62 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 63 | + } | ||
| 64 | + return result, nil | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +// 返角全部详情色 | ||
| 68 | +func (rolesService *RolesService) RoleAllDetail(roleGetQuery *query.RoleGetQuery) (interface{}, error) { | ||
| 69 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 70 | + roleGetQuery.Operator.CompanyId, | ||
| 71 | + roleGetQuery.Operator.OrgId, | ||
| 72 | + roleGetQuery.Operator.UserId) | ||
| 73 | + roleId, _ := strconv.Atoi(roleGetQuery.RoleId) | ||
| 74 | + roleData, err := creationUserGateway.RoleGet(allied_creation_user.ReqRoleGet{ | ||
| 75 | + RoleId: int64(roleId), | ||
| 76 | + }) | ||
| 77 | + if err != nil { | ||
| 78 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 79 | + } | ||
| 80 | + //TODO 补充字段 :权限数据,关联用户数据 | ||
| 81 | + result := map[string]interface{}{ | ||
| 82 | + "role": roleData.Role, | ||
| 83 | + } | ||
| 84 | + return result, nil | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +// 返回role列表 | ||
| 88 | +func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (int64, interface{}, error) { | ||
| 89 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 90 | + roleListQuery.Operator.CompanyId, | ||
| 91 | + roleListQuery.Operator.OrgId, | ||
| 92 | + roleListQuery.Operator.UserId) | ||
| 93 | + roleList, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{ | ||
| 94 | + Offset: (roleListQuery.PageNumber - 1) * roleListQuery.PageSize, | ||
| 95 | + Limit: roleListQuery.PageSize, | ||
| 96 | + OrgName: roleListQuery.OrgName, | ||
| 97 | + RoleName: roleListQuery.RoleName, | ||
| 98 | + }) | ||
| 99 | + if err != nil { | ||
| 100 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 101 | + } | ||
| 102 | + result := []dto.RoleItem{} | ||
| 103 | + for _, v := range roleList.Roles { | ||
| 104 | + result = append(result, dto.RoleItem{ | ||
| 105 | + RoleId: strconv.Itoa(v.RoleID), | ||
| 106 | + OrgId: strconv.Itoa(v.OrgID), | ||
| 107 | + RoleName: v.RoleName, | ||
| 108 | + Describe: v.Desc, | ||
| 109 | + OrgName: v.Ext.OrgName, | ||
| 110 | + RoleType: v.RoleType, | ||
| 111 | + }) | ||
| 112 | + } | ||
| 113 | + var cnt int64 = roleList.Count | ||
| 114 | + return cnt, result, nil | ||
| 115 | +} | ||
| 116 | + | ||
| 117 | +// 编辑角色关联权限菜单的前置准备数据 | ||
| 118 | +func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *query.RoleMenuBeforeEditQuery) (interface{}, error) { | ||
| 119 | + | ||
| 120 | + return nil, nil | ||
| 121 | +} | ||
| 122 | + | ||
| 123 | +// 编辑角色关联用户的前置准备数据 | ||
| 124 | +func (rolesService *RolesService) RoleUserBeforeEdit(roleUserBeforeEditQuery *query.RoleUserBeforeEditQuery) (interface{}, error) { | ||
| 125 | + | ||
| 126 | + return nil, nil | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | +// 角色编辑关联菜单权限 | ||
| 130 | +func (rolesService *RolesService) RoleMenuEdit(roleMenuEditCommand *command.RoleMenuEditCommand) (interface{}, error) { | ||
| 131 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 132 | + roleMenuEditCommand.Operator.CompanyId, | ||
| 133 | + roleMenuEditCommand.Operator.OrgId, | ||
| 134 | + roleMenuEditCommand.Operator.UserId) | ||
| 135 | + roleId, _ := strconv.Atoi(roleMenuEditCommand.RoleId) | ||
| 136 | + var menuIds []int64 | ||
| 137 | + for _, v := range roleMenuEditCommand.MenuId { | ||
| 138 | + id, err := strconv.Atoi(v) | ||
| 139 | + if err == nil { | ||
| 140 | + menuIds = append(menuIds, int64(id)) | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + _, err := creationUserGateway.RoleSetAccessMenus(allied_creation_user.ReqRoleSetAccessMenus{ | ||
| 144 | + RoleId: int64(roleId), | ||
| 145 | + AccessMenus: menuIds, | ||
| 146 | + }) | ||
| 147 | + if err != nil { | ||
| 148 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 149 | + } | ||
| 150 | + return roleMenuEditCommand, err | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +// 移除role | ||
| 154 | +func (rolesService *RolesService) RoleRemove(roleRemoveCommand *command.RoleRemoveCommand) (interface{}, error) { | ||
| 155 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 156 | + roleRemoveCommand.Operator.CompanyId, | ||
| 157 | + roleRemoveCommand.Operator.OrgId, | ||
| 158 | + roleRemoveCommand.Operator.UserId) | ||
| 159 | + | ||
| 160 | + var roleIds []int64 | ||
| 161 | + for _, v := range roleRemoveCommand.RoleId { | ||
| 162 | + id, err := strconv.Atoi(v) | ||
| 163 | + if err == nil { | ||
| 164 | + roleIds = append(roleIds, int64(id)) | ||
| 165 | + } | ||
| 166 | + } | ||
| 167 | + _, err := creationUserGateway.RoleRemove(allied_creation_user.ReqRoleRemove{ | ||
| 168 | + //TODO 修改 为 切片类型 | ||
| 169 | + }) | ||
| 170 | + if err != nil { | ||
| 171 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 172 | + } | ||
| 173 | + return roleRemoveCommand, err | ||
| 174 | +} | ||
| 175 | + | ||
| 176 | +// 角色添加关联用户 | ||
| 177 | +func (rolesService *RolesService) RoleUserAdd(roleUserAddCommand *command.RoleUserAddCommand) (interface{}, error) { | ||
| 178 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 179 | + roleUserAddCommand.Operator.CompanyId, | ||
| 180 | + roleUserAddCommand.Operator.OrgId, | ||
| 181 | + roleUserAddCommand.Operator.UserId) | ||
| 182 | + roleId, _ := strconv.Atoi(roleUserAddCommand.RoleId) | ||
| 183 | + var userIds []int64 | ||
| 184 | + for _, v := range roleUserAddCommand.UserId { | ||
| 185 | + id, err := strconv.Atoi(v) | ||
| 186 | + if err == nil { | ||
| 187 | + userIds = append(userIds, int64(id)) | ||
| 188 | + } | ||
| 189 | + } | ||
| 190 | + _, err := creationUserGateway.RoleAssign(allied_creation_user.ReqRoleAssign{ | ||
| 191 | + RoleId: int64(roleId), | ||
| 192 | + UserIds: userIds, | ||
| 193 | + }) | ||
| 194 | + if err != nil { | ||
| 195 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 196 | + } | ||
| 197 | + return roleUserAddCommand, err | ||
| 198 | +} | ||
| 199 | + | ||
| 200 | +// 角色添加关联用户 | ||
| 201 | +func (rolesService *RolesService) RoleUserDelete(roleUserDeleteCommand *command.RoleUserDeleteCommand) (interface{}, error) { | ||
| 202 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 203 | + roleUserDeleteCommand.Operator.CompanyId, | ||
| 204 | + roleUserDeleteCommand.Operator.OrgId, | ||
| 205 | + roleUserDeleteCommand.Operator.UserId) | ||
| 206 | + roleId, _ := strconv.Atoi(roleUserDeleteCommand.RoleId) | ||
| 207 | + var userIds []int64 | ||
| 208 | + for _, v := range roleUserDeleteCommand.UserId { | ||
| 209 | + id, err := strconv.Atoi(v) | ||
| 210 | + if err == nil { | ||
| 211 | + userIds = append(userIds, int64(id)) | ||
| 212 | + } | ||
| 213 | + } | ||
| 214 | + _, err := creationUserGateway.RoleUnassign(allied_creation_user.ReqRoleUnassign{ | ||
| 215 | + RoleId: int64(roleId), | ||
| 216 | + UserIds: userIds, | ||
| 217 | + }) | ||
| 218 | + if err != nil { | ||
| 219 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 220 | + } | ||
| 221 | + return roleUserDeleteCommand, err | ||
| 222 | +} | ||
| 223 | + | ||
| 224 | +// 角色下关联用户的数据 | ||
| 225 | +func (rolesService *RolesService) RoleUserInfo(roleUserInfoQuery *query.RoleUserInfoQuery) (interface{}, error) { | ||
| 226 | + | ||
| 227 | + return nil, nil | ||
| 228 | +} | ||
| 229 | + | ||
| 230 | +func NewRolesService(options map[string]interface{}) *RolesService { | ||
| 231 | + newRolesService := &RolesService{} | ||
| 232 | + return newRolesService | ||
| 233 | +} |
| @@ -67,7 +67,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. | @@ -67,7 +67,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. | ||
| 67 | userRole = append(userRole, int64(id)) | 67 | userRole = append(userRole, int64(id)) |
| 68 | } | 68 | } |
| 69 | } | 69 | } |
| 70 | - result, err := creationUserGateway.UserCreate(allied_creation_user.ReqCreateUser{ | 70 | + _, err := creationUserGateway.UserCreate(allied_creation_user.ReqCreateUser{ |
| 71 | CompanyId: companyUserAddCommand.Operator.CompanyId, | 71 | CompanyId: companyUserAddCommand.Operator.CompanyId, |
| 72 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) | 72 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) |
| 73 | UserType: 1, | 73 | UserType: 1, |
| @@ -84,7 +84,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. | @@ -84,7 +84,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. | ||
| 84 | Avatar: companyUserAddCommand.Avator, | 84 | Avatar: companyUserAddCommand.Avator, |
| 85 | Email: companyUserAddCommand.Avator, | 85 | Email: companyUserAddCommand.Avator, |
| 86 | }) | 86 | }) |
| 87 | - return result, err | 87 | + return companyUserAddCommand, err |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | // 启用禁用公司用户信息 | 90 | // 启用禁用公司用户信息 |
| @@ -93,11 +93,11 @@ func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *co | @@ -93,11 +93,11 @@ func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *co | ||
| 93 | companyUserEnableCommand.Operator.CompanyId, | 93 | companyUserEnableCommand.Operator.CompanyId, |
| 94 | companyUserEnableCommand.Operator.OrgId, | 94 | companyUserEnableCommand.Operator.OrgId, |
| 95 | companyUserEnableCommand.Operator.UserId) | 95 | companyUserEnableCommand.Operator.UserId) |
| 96 | - result, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{ | 96 | + _, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{ |
| 97 | UserIds: companyUserEnableCommand.UsersIds, | 97 | UserIds: companyUserEnableCommand.UsersIds, |
| 98 | EnableStatus: companyUserEnableCommand.EnableStatus, | 98 | EnableStatus: companyUserEnableCommand.EnableStatus, |
| 99 | }) | 99 | }) |
| 100 | - return result, err | 100 | + return companyUserEnableCommand, err |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | // 返回公司用户信息列表 | 103 | // 返回公司用户信息列表 |
| @@ -144,11 +144,11 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw | @@ -144,11 +144,11 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw | ||
| 144 | companyUserResetPasswordCommand.Operator.CompanyId, | 144 | companyUserResetPasswordCommand.Operator.CompanyId, |
| 145 | companyUserResetPasswordCommand.Operator.OrgId, | 145 | companyUserResetPasswordCommand.Operator.OrgId, |
| 146 | companyUserResetPasswordCommand.Operator.UserId) | 146 | companyUserResetPasswordCommand.Operator.UserId) |
| 147 | - result, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{ | 147 | + _, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{ |
| 148 | Password: "", | 148 | Password: "", |
| 149 | UserIds: companyUserResetPasswordCommand.UsersIds, | 149 | UserIds: companyUserResetPasswordCommand.UsersIds, |
| 150 | }) | 150 | }) |
| 151 | - return result, err | 151 | + return companyUserResetPasswordCommand, err |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | // 更新公司用户信息 | 154 | // 更新公司用户信息 |
| @@ -174,7 +174,7 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co | @@ -174,7 +174,7 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co | ||
| 174 | } | 174 | } |
| 175 | } | 175 | } |
| 176 | userId, _ := strconv.Atoi(companyUserUpdateCommand.UsersId) | 176 | userId, _ := strconv.Atoi(companyUserUpdateCommand.UsersId) |
| 177 | - result, err := creationUserGateway.UserUpdate(allied_creation_user.ReqUpdateUser{ | 177 | + _, err := creationUserGateway.UserUpdate(allied_creation_user.ReqUpdateUser{ |
| 178 | UserId: int64(userId), | 178 | UserId: int64(userId), |
| 179 | CompanyId: companyUserUpdateCommand.Operator.CompanyId, | 179 | CompanyId: companyUserUpdateCommand.Operator.CompanyId, |
| 180 | UserCode: companyUserUpdateCommand.UsersCode, | 180 | UserCode: companyUserUpdateCommand.UsersCode, |
| @@ -188,7 +188,7 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co | @@ -188,7 +188,7 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co | ||
| 188 | Avatar: companyUserUpdateCommand.Avator, | 188 | Avatar: companyUserUpdateCommand.Avator, |
| 189 | Email: companyUserUpdateCommand.Avator, | 189 | Email: companyUserUpdateCommand.Avator, |
| 190 | }) | 190 | }) |
| 191 | - return result, err | 191 | + return companyUserUpdateCommand, err |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | // 创建共创用户信息 | 194 | // 创建共创用户信息 |
| @@ -197,7 +197,7 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * | @@ -197,7 +197,7 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * | ||
| 197 | cooperationUserAddCommand.Operator.CompanyId, | 197 | cooperationUserAddCommand.Operator.CompanyId, |
| 198 | cooperationUserAddCommand.Operator.OrgId, | 198 | cooperationUserAddCommand.Operator.OrgId, |
| 199 | cooperationUserAddCommand.Operator.UserId) | 199 | cooperationUserAddCommand.Operator.UserId) |
| 200 | - result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{ | 200 | + _, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{ |
| 201 | CooperationCompany: cooperationUserAddCommand.CooperationCompany, | 201 | CooperationCompany: cooperationUserAddCommand.CooperationCompany, |
| 202 | CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline, 0), | 202 | CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline, 0), |
| 203 | Email: cooperationUserAddCommand.Email, | 203 | Email: cooperationUserAddCommand.Email, |
| @@ -207,9 +207,9 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * | @@ -207,9 +207,9 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * | ||
| 207 | Avatar: cooperationUserAddCommand.Avatar, | 207 | Avatar: cooperationUserAddCommand.Avatar, |
| 208 | OrgId: cooperationUserAddCommand.Operator.OrgId, | 208 | OrgId: cooperationUserAddCommand.Operator.OrgId, |
| 209 | Phone: cooperationUserAddCommand.Phone, | 209 | Phone: cooperationUserAddCommand.Phone, |
| 210 | - Password: "", | 210 | + Password: "", //TODO 填充默认密码 |
| 211 | }) | 211 | }) |
| 212 | - return result, err | 212 | + return cooperationUserAddCommand, err |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | // 启用禁用共创用户信息 | 215 | // 启用禁用共创用户信息 |
| @@ -218,11 +218,11 @@ func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCom | @@ -218,11 +218,11 @@ func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCom | ||
| 218 | cooperationUserEnableCommand.Operator.CompanyId, | 218 | cooperationUserEnableCommand.Operator.CompanyId, |
| 219 | cooperationUserEnableCommand.Operator.OrgId, | 219 | cooperationUserEnableCommand.Operator.OrgId, |
| 220 | cooperationUserEnableCommand.Operator.UserId) | 220 | cooperationUserEnableCommand.Operator.UserId) |
| 221 | - result, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{ | 221 | + _, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{ |
| 222 | UserIds: cooperationUserEnableCommand.UsersIds, | 222 | UserIds: cooperationUserEnableCommand.UsersIds, |
| 223 | EnableStatus: cooperationUserEnableCommand.EnableStatus, | 223 | EnableStatus: cooperationUserEnableCommand.EnableStatus, |
| 224 | }) | 224 | }) |
| 225 | - return result, err | 225 | + return cooperationUserEnableCommand, err |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | // 获取共创用户信息 | 228 | // 获取共创用户信息 |
| @@ -293,11 +293,11 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe | @@ -293,11 +293,11 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe | ||
| 293 | cooperationUserResetPasswordCommand.Operator.CompanyId, | 293 | cooperationUserResetPasswordCommand.Operator.CompanyId, |
| 294 | cooperationUserResetPasswordCommand.Operator.OrgId, | 294 | cooperationUserResetPasswordCommand.Operator.OrgId, |
| 295 | cooperationUserResetPasswordCommand.Operator.UserId) | 295 | cooperationUserResetPasswordCommand.Operator.UserId) |
| 296 | - result, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{ | 296 | + _, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{ |
| 297 | Password: "", | 297 | Password: "", |
| 298 | UserIds: cooperationUserResetPasswordCommand.UsersIds, | 298 | UserIds: cooperationUserResetPasswordCommand.UsersIds, |
| 299 | }) | 299 | }) |
| 300 | - return result, err | 300 | + return cooperationUserResetPasswordCommand, err |
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | // 编辑共创用户信息 | 303 | // 编辑共创用户信息 |
| @@ -306,7 +306,7 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom | @@ -306,7 +306,7 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom | ||
| 306 | cooperationUserUpdateCommand.Operator.CompanyId, | 306 | cooperationUserUpdateCommand.Operator.CompanyId, |
| 307 | cooperationUserUpdateCommand.Operator.OrgId, | 307 | cooperationUserUpdateCommand.Operator.OrgId, |
| 308 | cooperationUserUpdateCommand.Operator.UserId) | 308 | cooperationUserUpdateCommand.Operator.UserId) |
| 309 | - result, err := creationUserGateway.CooperatorUserUpdate(allied_creation_user.ReqUpdateCooperatorUser{ | 309 | + _, err := creationUserGateway.CooperatorUserUpdate(allied_creation_user.ReqUpdateCooperatorUser{ |
| 310 | UserId: cooperationUserUpdateCommand.UsersId, | 310 | UserId: cooperationUserUpdateCommand.UsersId, |
| 311 | CooperationCompany: cooperationUserUpdateCommand.CooperationCompany, | 311 | CooperationCompany: cooperationUserUpdateCommand.CooperationCompany, |
| 312 | CooperationDeadline: time.Unix(cooperationUserUpdateCommand.CooperationDeadline, 0), | 312 | CooperationDeadline: time.Unix(cooperationUserUpdateCommand.CooperationDeadline, 0), |
| @@ -318,7 +318,7 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom | @@ -318,7 +318,7 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom | ||
| 318 | OrgId: cooperationUserUpdateCommand.Operator.OrgId, | 318 | OrgId: cooperationUserUpdateCommand.Operator.OrgId, |
| 319 | Phone: cooperationUserUpdateCommand.Phone, | 319 | Phone: cooperationUserUpdateCommand.Phone, |
| 320 | }) | 320 | }) |
| 321 | - return result, err | 321 | + return cooperationUserUpdateCommand, err |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | func NewUsersService(options map[string]interface{}) *UsersService { | 324 | func NewUsersService(options map[string]interface{}) *UsersService { |
| @@ -106,7 +106,7 @@ func (gateway HttplibAlliedCreationUser) RoleAssign(param ReqRoleAssign) (*DataR | @@ -106,7 +106,7 @@ func (gateway HttplibAlliedCreationUser) RoleAssign(param ReqRoleAssign) (*DataR | ||
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | // RoleCreate 创建角色 | 108 | // RoleCreate 创建角色 |
| 109 | -func (gateway HttplibAlliedCreationUser) RoleCreate(param ReqRole) (*DataRole, error) { | 109 | +func (gateway HttplibAlliedCreationUser) RoleCreate(param ReqRoleCreate) (*DataRoleCreate, error) { |
| 110 | urlStr := gateway.baseUrL + "/role" | 110 | urlStr := gateway.baseUrL + "/role" |
| 111 | method := "post" | 111 | method := "post" |
| 112 | req := gateway.CreateRequest(urlStr, method) | 112 | req := gateway.CreateRequest(urlStr, method) |
| @@ -131,7 +131,7 @@ func (gateway HttplibAlliedCreationUser) RoleCreate(param ReqRole) (*DataRole, e | @@ -131,7 +131,7 @@ func (gateway HttplibAlliedCreationUser) RoleCreate(param ReqRole) (*DataRole, e | ||
| 131 | if err != nil { | 131 | if err != nil { |
| 132 | return nil, fmt.Errorf("解析创建角色:%w", err) | 132 | return nil, fmt.Errorf("解析创建角色:%w", err) |
| 133 | } | 133 | } |
| 134 | - var data DataRole | 134 | + var data DataRoleCreate |
| 135 | err = gateway.GetResponseData(result, &data) | 135 | err = gateway.GetResponseData(result, &data) |
| 136 | return &data, err | 136 | return &data, err |
| 137 | } | 137 | } |
| @@ -9,9 +9,32 @@ type ( | @@ -9,9 +9,32 @@ type ( | ||
| 9 | Offset int `json:"offset"` | 9 | Offset int `json:"offset"` |
| 10 | // 查询限制 | 10 | // 查询限制 |
| 11 | Limit int `json:"limit"` | 11 | Limit int `json:"limit"` |
| 12 | + //组织名称 | ||
| 13 | + OrgName string `json:"orgName"` | ||
| 14 | + //角色码名称 | ||
| 15 | + RoleName string `json:"roleName"` | ||
| 12 | } | 16 | } |
| 13 | 17 | ||
| 14 | DataRoleSearch struct { | 18 | DataRoleSearch struct { |
| 19 | + Count int64 | ||
| 20 | + Roles []struct { | ||
| 21 | + AccessMenus []int `json:"accessMenus"` | ||
| 22 | + CompanyID int `json:"companyId"` | ||
| 23 | + CreatedAt string `json:"createdAt"` | ||
| 24 | + Desc string `json:"desc"` | ||
| 25 | + Ext struct { | ||
| 26 | + DepName string `json:"depName"` | ||
| 27 | + OrgName string `json:"orgName"` | ||
| 28 | + ParentDepName string `json:"parentDepName"` | ||
| 29 | + Phone string `json:"phone"` | ||
| 30 | + UserName string `json:"userName"` | ||
| 31 | + } `json:"ext"` | ||
| 32 | + OrgID int `json:"orgId"` | ||
| 33 | + RoleID int `json:"roleId"` | ||
| 34 | + RoleName string `json:"roleName"` | ||
| 35 | + RoleType int `json:"roleType"` | ||
| 36 | + UpdatedAt string `json:"updatedAt"` | ||
| 37 | + } `json:"role"` | ||
| 15 | } | 38 | } |
| 16 | ) | 39 | ) |
| 17 | 40 | ||
| @@ -22,12 +45,32 @@ type ( | @@ -22,12 +45,32 @@ type ( | ||
| 22 | } | 45 | } |
| 23 | 46 | ||
| 24 | DataRoleGet struct { | 47 | DataRoleGet struct { |
| 48 | + Role struct { | ||
| 49 | + AccessMenus []int `json:"accessMenus"` | ||
| 50 | + CompanyID int `json:"companyId"` | ||
| 51 | + CreatedAt string `json:"createdAt"` | ||
| 52 | + Desc int `json:"desc"` | ||
| 53 | + Ext struct { | ||
| 54 | + DepName string `json:"depName"` | ||
| 55 | + OrgName string `json:"orgName"` | ||
| 56 | + ParentDepName string `json:"parentDepName"` | ||
| 57 | + Phone string `json:"phone"` | ||
| 58 | + UserName string `json:"userName"` | ||
| 59 | + } `json:"ext"` | ||
| 60 | + OrgID int `json:"orgId"` | ||
| 61 | + RoleID int `json:"roleId"` | ||
| 62 | + RoleName string `json:"roleName"` | ||
| 63 | + RoleType int `json:"roleType"` | ||
| 64 | + UpdatedAt string `json:"updatedAt"` | ||
| 65 | + } `json:"role"` | ||
| 25 | } | 66 | } |
| 26 | ) | 67 | ) |
| 27 | 68 | ||
| 28 | //分配角色给多个用户 | 69 | //分配角色给多个用户 |
| 29 | type ( | 70 | type ( |
| 30 | ReqRoleAssign struct { | 71 | ReqRoleAssign struct { |
| 72 | + RoleId int64 | ||
| 73 | + UserIds []int64 | ||
| 31 | } | 74 | } |
| 32 | 75 | ||
| 33 | DataRoleAssign struct { | 76 | DataRoleAssign struct { |
| @@ -36,16 +79,22 @@ type ( | @@ -36,16 +79,22 @@ type ( | ||
| 36 | 79 | ||
| 37 | //创建角色 | 80 | //创建角色 |
| 38 | type ( | 81 | type ( |
| 39 | - ReqRole struct { | 82 | + ReqRoleCreate struct { |
| 83 | + // 角色名称 | ||
| 84 | + RoleName string `json:"roleName"` | ||
| 85 | + // 描述 | ||
| 86 | + Desc string `json:"desc"` | ||
| 40 | } | 87 | } |
| 41 | 88 | ||
| 42 | - DataRole struct { | 89 | + DataRoleCreate struct { |
| 43 | } | 90 | } |
| 44 | ) | 91 | ) |
| 45 | 92 | ||
| 46 | //取消用户分配的角色 | 93 | //取消用户分配的角色 |
| 47 | type ( | 94 | type ( |
| 48 | ReqRoleUnassign struct { | 95 | ReqRoleUnassign struct { |
| 96 | + RoleId int64 `json:"roleId"` | ||
| 97 | + UserIds []int64 `json:"userIds"` | ||
| 49 | } | 98 | } |
| 50 | 99 | ||
| 51 | DataRoleUnassign struct { | 100 | DataRoleUnassign struct { |
| @@ -55,7 +104,11 @@ type ( | @@ -55,7 +104,11 @@ type ( | ||
| 55 | //更新角色 | 104 | //更新角色 |
| 56 | type ( | 105 | type ( |
| 57 | ReqRoleUpdate struct { | 106 | ReqRoleUpdate struct { |
| 58 | - RoleId int64 | 107 | + RoleId int64 `json:"roleId"` |
| 108 | + // 角色名称 | ||
| 109 | + RoleName string `json:"roleName"` | ||
| 110 | + // 描述 | ||
| 111 | + Desc string `json:"desc"` | ||
| 59 | } | 112 | } |
| 60 | 113 | ||
| 61 | DataRoleUpdate struct { | 114 | DataRoleUpdate struct { |
| @@ -65,7 +118,7 @@ type ( | @@ -65,7 +118,7 @@ type ( | ||
| 65 | //移除角色 | 118 | //移除角色 |
| 66 | type ( | 119 | type ( |
| 67 | ReqRoleRemove struct { | 120 | ReqRoleRemove struct { |
| 68 | - RoleId int64 | 121 | + RoleId int64 `json:"roleId"` |
| 69 | } | 122 | } |
| 70 | 123 | ||
| 71 | DataRoleRemove struct { | 124 | DataRoleRemove struct { |
| @@ -75,9 +128,9 @@ type ( | @@ -75,9 +128,9 @@ type ( | ||
| 75 | //获取角色相关联的用户 | 128 | //获取角色相关联的用户 |
| 76 | type ( | 129 | type ( |
| 77 | ReqRoleGetRelatedUser struct { | 130 | ReqRoleGetRelatedUser struct { |
| 78 | - RoleId int64 | ||
| 79 | - OrgId int64 | ||
| 80 | - DepartmentId int64 | 131 | + RoleId int64 `json:"roleId"` |
| 132 | + OrgId int64 `json:"orgId"` | ||
| 133 | + DepartmentId int64 `json:"departmentId"` | ||
| 81 | } | 134 | } |
| 82 | 135 | ||
| 83 | DataRoleGetRelatedUser struct { | 136 | DataRoleGetRelatedUser struct { |
| @@ -97,7 +150,8 @@ type ( | @@ -97,7 +150,8 @@ type ( | ||
| 97 | //设置角色菜单 | 150 | //设置角色菜单 |
| 98 | type ( | 151 | type ( |
| 99 | ReqRoleSetAccessMenus struct { | 152 | ReqRoleSetAccessMenus struct { |
| 100 | - RoleId int64 `json:"roleId"` | 153 | + RoleId int64 `json:"roleId"` |
| 154 | + AccessMenus []int64 `json:"accessMenus"` | ||
| 101 | } | 155 | } |
| 102 | 156 | ||
| 103 | DataRoleSetAccessMenus struct { | 157 | DataRoleSetAccessMenus struct { |
-
请 注册 或 登录 后发表评论