作者 yangfu

角色关联用户修改

... ... @@ -68,9 +68,9 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
relatedUser, err := creationUserGateway.RoleGetRelatedUser(allied_creation_user.ReqRoleGetRelatedUser{
relatedUser, err := creationUserGateway.RoleRelatedUser(allied_creation_user.ReqRoleGetRelatedUser{
RoleId: int64(roleId),
OrgId: roleGetQuery.Operator.OrgId,
OrgIds: roleGetQuery.Operator.OrgIds,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -376,7 +376,6 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize,
Limit: cooperationUserListQuery.PageSize,
CompanyId: cooperationUserListQuery.Operator.CompanyId,
OrganizationId: cooperationUserListQuery.Operator.OrgId,
DepartmentId: 0,
UserName: cooperationUserListQuery.UserName,
CooperationCompany: cooperationUserListQuery.CooperationCompany,
... ...
... ... @@ -296,6 +296,38 @@ func (gateway HttplibAlliedCreationUser) RoleGetRelatedUser(param ReqRoleGetRela
return &data, err
}
// RoleGetRelatedUser 获取角色相关联的用户
func (gateway HttplibAlliedCreationUser) RoleRelatedUser(param ReqRoleGetRelatedUser) (*DataRoleGetRelatedUser, error) {
//v := url.Values{}
urlStr := gateway.baseUrL + "/role/" + strconv.FormatInt(param.RoleId, 10) + "/related-user"
method := "post"
req := gateway.CreateRequest(urlStr, method)
log.Logger.Debug("向用户模块请求数据:获取角色相关联的用户。", map[string]interface{}{
"api": method + ":" + urlStr,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求获取角色相关联的用户失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取获取角色相关联的用户失败:%w", err)
}
log.Logger.Debug("获取用户模块请求数据:获取角色相关联的用户。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析获取角色相关联的用户:%w", err)
}
var data DataRoleGetRelatedUser
err = gateway.GetResponseData(result, &data)
return &data, err
}
// RoleGetAccessMenus 获取角色菜单
func (gateway HttplibAlliedCreationUser) RoleGetAccessMenus(param ReqRoleGetAccessMenus) (*DataRoleGetAccessMenus, error) {
urlStr := gateway.baseUrL + "/role/" + strconv.FormatInt(param.RoleId, 10) + "/access-menus"
... ...
... ... @@ -162,6 +162,8 @@ type (
RoleId int64 `json:"roleId"`
OrgId int64 `json:"orgId"`
DepartmentId int64 `json:"departmentId"`
// 组织ID
OrgIds []int64 `cname:"组织ID" json:"orgIds,omitempty"`
}
DataRoleGetRelatedUser struct {
... ...