package allied_creation_user import ( "fmt" "strconv" ) //################角色模块################## type Int64String int64 func (t Int64String) MarshalJSON() ([]byte, error) { stamp := fmt.Sprintf(`"%d"`, t) return []byte(stamp), nil } func (t *Int64String) UnmarshalJSON(data []byte) error { v, err := strconv.ParseInt(string(data), 10, 64) *t = Int64String(v) return err } //搜索角色列表 type ( ReqRoleSearch struct { // 查询偏离量 Offset int `json:"offset"` // 查询限制 Limit int `json:"limit"` // 角色类型 1.普通角色 1024:超级管理员 RoleType int `cname:"角色类型 1.普通角色 1024:超级管理员" json:"roleType,omitempty"` //组织名称 OrgName string `json:"orgName"` //角色码名称 RoleName string `json:"roleName"` // 组织ID OrgId int64 `json:"orgId"` // 企业id CompanyId int64 `cname:"企业id" json:"companyId"` // 匹配多个组织 InOrgIds []int64 `cname:"匹配多个组织" json:"inOrgIds,omitempty"` // 角色名称 MatchRoleName string `cname:"匹配角色名称" json:"matchRoleName,omitempty"` } DataRoleSearch struct { Count int64 `json:"count"` Roles []struct { AccessMenus []Int64String `json:"accessMenus"` CompanyID Int64String `json:"companyId"` CreatedAt string `json:"createdAt"` Desc string `json:"desc"` Ext struct { DepName string `json:"depName"` OrgName string `json:"orgName"` ParentDepName string `json:"parentDepName"` Phone string `json:"phone"` UserName string `json:"userName"` } `json:"ext"` OrgID Int64String `json:"orgId"` RoleID Int64String `json:"roleId"` RoleName string `json:"roleName"` RoleType int `json:"roleType"` UpdatedAt string `json:"updatedAt"` } `json:"roles"` } ) //获取角色 type ( ReqRoleGet struct { RoleId int64 `json:"roleId"` } DataRoleGet struct { AccessMenus []int `json:"accessMenus"` CompanyID int `json:"companyId"` CreatedAt string `json:"createdAt"` Desc string `json:"desc"` Ext struct { DepName string `json:"depName"` OrgName string `json:"orgName"` ParentDepName string `json:"parentDepName"` Phone string `json:"phone"` UserName string `json:"userName"` } `json:"ext"` OrgID int `json:"orgId"` RoleID int `json:"roleId"` RoleName string `json:"roleName"` RoleType int `json:"roleType"` UpdatedAt string `json:"updatedAt"` } ) //分配角色给多个用户 type ( ReqRoleAssign struct { RoleId int64 `json:"roleId"` UserIds []int64 `json:"userIds"` } DataRoleAssign struct { } ) //创建角色 type ( ReqRoleCreate struct { // 组织ID OrgId int64 `cname:"组织ID" json:"orgId"` // 角色名称 RoleName string `json:"roleName"` // 描述 Desc string `json:"desc"` } DataRoleCreate struct { RoleID int64 `json:"roleID"` } ) //取消用户分配的角色 type ( ReqRoleUnassign struct { RoleId int64 `json:"roleId"` UserIds []int64 `json:"userIds"` } DataRoleUnassign struct { } ) //更新角色 type ( ReqRoleUpdate struct { RoleId int64 `json:"roleId"` // 角色名称 RoleName string `json:"roleName"` // 描述 Desc string `json:"desc"` } DataRoleUpdate struct { } ) //移除角色 type ( ReqRoleRemove struct { RoleIds []int64 `json:"roleIds"` } DataRoleRemove struct { } ) //批量移除角色 type ( ReqRoleBatchRemove struct { RoleIds []int64 `json:"roleIds"` } DataRoleBatchRemove struct { } ) //获取角色相关联的用户 type ( ReqRoleGetRelatedUser struct { RoleId int64 `json:"roleId"` OrgId int64 `json:"orgId"` DepartmentId int64 `json:"departmentId"` // 组织ID OrgIds []int64 `cname:"组织ID" json:"orgIds,omitempty"` } DataRoleGetRelatedUser struct { NotInRoleUser []struct { DepartmentId Int64String `json:"departmentId"` DepartmentName string `json:"departmentName"` UserID Int64String `json:"userId"` UserName string `json:"userName"` UserCode string `json:"userCode"` } `json:"notInRoleUser"` RoleUser []struct { DepartmentId Int64String `json:"departmentId"` DepartmentName string `json:"departmentName"` UserID Int64String `json:"userId"` UserName string `json:"userName"` UserCode string `json:"userCode"` } `json:"roleUser"` } ) //获取角色菜单 type ( ReqRoleGetAccessMenus struct { RoleId int64 `json:"roleId"` } DataRoleGetAccessMenus struct { Menus []struct { 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"` } ) //设置角色菜单 type ( ReqRoleSetAccessMenus struct { RoleId int64 `json:"roleId"` AccessMenus []int64 `json:"accessMenus"` } DataRoleSetAccessMenus struct { } )