审查视图

pkg/infrastructure/service_gateway/allied_creation_user/param_role.go 5.4 KB
tangxuhui authored
1 2
package allied_creation_user
yangfu authored
3 4 5 6 7
import (
	"fmt"
	"strconv"
)
tangxuhui authored
8
//################角色模块##################
yangfu authored
9 10 11 12 13 14
type Int64String int64

func (t Int64String) MarshalJSON() ([]byte, error) {
	stamp := fmt.Sprintf(`"%d"`, t)
	return []byte(stamp), nil
}
yangfu authored
15
func (t *Int64String) UnmarshalJSON(data []byte) error {
yangfu authored
16
	v, err := strconv.ParseInt(string(data), 10, 64)
yangfu authored
17
	*t = Int64String(v)
yangfu authored
18 19
	return err
}
tangxuhui authored
20 21 22 23 24 25 26 27

//搜索角色列表
type (
	ReqRoleSearch struct {
		// 查询偏离量
		Offset int `json:"offset"`
		// 查询限制
		Limit int `json:"limit"`
yangfu authored
28 29
		// 角色类型  1.普通角色  1024:超级管理员
		RoleType int `cname:"角色类型  1.普通角色  1024:超级管理员" json:"roleType,omitempty"`
30 31 32 33
		//组织名称
		OrgName string `json:"orgName"`
		//角色码名称
		RoleName string `json:"roleName"`
yangfu authored
34 35
		// 组织ID
		OrgId int64 `json:"orgId"`
36 37
		// 企业id
		CompanyId int64 `cname:"企业id" json:"companyId"`
yangfu authored
38 39
		// 匹配多个组织
		InOrgIds []int64 `cname:"匹配多个组织" json:"inOrgIds,omitempty"`
yangfu authored
40 41
		// 角色名称
		MatchRoleName string `cname:"匹配角色名称" json:"matchRoleName,omitempty"`
tangxuhui authored
42 43 44
	}

	DataRoleSearch struct {
tangxuhui authored
45
		Count int64 `json:"count"`
46
		Roles []struct {
yangfu authored
47 48 49 50
			AccessMenus []Int64String `json:"accessMenus"`
			CompanyID   Int64String   `json:"companyId"`
			CreatedAt   string        `json:"createdAt"`
			Desc        string        `json:"desc"`
51 52 53 54 55 56 57
			Ext         struct {
				DepName       string `json:"depName"`
				OrgName       string `json:"orgName"`
				ParentDepName string `json:"parentDepName"`
				Phone         string `json:"phone"`
				UserName      string `json:"userName"`
			} `json:"ext"`
yangfu authored
58 59 60 61 62
			OrgID     Int64String `json:"orgId"`
			RoleID    Int64String `json:"roleId"`
			RoleName  string      `json:"roleName"`
			RoleType  int         `json:"roleType"`
			UpdatedAt string      `json:"updatedAt"`
yangfu authored
63
		} `json:"roles"`
tangxuhui authored
64 65 66 67 68 69 70 71 72 73
	}
)

//获取角色
type (
	ReqRoleGet struct {
		RoleId int64 `json:"roleId"`
	}

	DataRoleGet struct {
yangfu authored
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
		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"`
tangxuhui authored
90 91 92 93 94 95
	}
)

//分配角色给多个用户
type (
	ReqRoleAssign struct {
tangxuhui authored
96 97
		RoleId  int64   `json:"roleId"`
		UserIds []int64 `json:"userIds"`
tangxuhui authored
98 99 100 101 102 103 104 105
	}

	DataRoleAssign struct {
	}
)

//创建角色
type (
106
	ReqRoleCreate struct {
yangfu authored
107 108
		// 组织ID
		OrgId int64 `cname:"组织ID" json:"orgId"`
109 110 111 112
		// 角色名称
		RoleName string `json:"roleName"`
		// 描述
		Desc string `json:"desc"`
tangxuhui authored
113 114
	}
115
	DataRoleCreate struct {
116
		RoleID int64 `json:"roleID"`
tangxuhui authored
117 118 119 120 121 122
	}
)

//取消用户分配的角色
type (
	ReqRoleUnassign struct {
123 124
		RoleId  int64   `json:"roleId"`
		UserIds []int64 `json:"userIds"`
tangxuhui authored
125 126 127 128 129 130 131 132 133
	}

	DataRoleUnassign struct {
	}
)

//更新角色
type (
	ReqRoleUpdate struct {
134 135 136 137 138
		RoleId int64 `json:"roleId"`
		// 角色名称
		RoleName string `json:"roleName"`
		// 描述
		Desc string `json:"desc"`
tangxuhui authored
139 140 141 142 143 144 145 146 147
	}

	DataRoleUpdate struct {
	}
)

//移除角色
type (
	ReqRoleRemove struct {
yangfu authored
148
		RoleIds []int64 `json:"roleIds"`
tangxuhui authored
149 150 151 152 153 154
	}

	DataRoleRemove struct {
	}
)
tangxuhui authored
155 156 157 158 159 160 161 162 163 164
//批量移除角色
type (
	ReqRoleBatchRemove struct {
		RoleIds []int64 `json:"roleIds"`
	}

	DataRoleBatchRemove struct {
	}
)
tangxuhui authored
165 166 167
//获取角色相关联的用户
type (
	ReqRoleGetRelatedUser struct {
168 169 170
		RoleId       int64 `json:"roleId"`
		OrgId        int64 `json:"orgId"`
		DepartmentId int64 `json:"departmentId"`
yangfu authored
171 172
		// 组织ID
		OrgIds []int64 `cname:"组织ID" json:"orgIds,omitempty"`
tangxuhui authored
173 174 175
	}

	DataRoleGetRelatedUser struct {
tangxuhui authored
176
		NotInRoleUser []struct {
yangfu authored
177 178 179 180 181
			DepartmentId   Int64String `json:"departmentId"`
			DepartmentName string      `json:"departmentName"`
			UserID         Int64String `json:"userId"`
			UserName       string      `json:"userName"`
			UserCode       string      `json:"userCode"`
tangxuhui authored
182 183
		} `json:"notInRoleUser"`
		RoleUser []struct {
yangfu authored
184 185 186 187 188
			DepartmentId   Int64String `json:"departmentId"`
			DepartmentName string      `json:"departmentName"`
			UserID         Int64String `json:"userId"`
			UserName       string      `json:"userName"`
			UserCode       string      `json:"userCode"`
tangxuhui authored
189
		} `json:"roleUser"`
tangxuhui authored
190 191 192 193 194 195 196 197 198 199
	}
)

//获取角色菜单
type (
	ReqRoleGetAccessMenus struct {
		RoleId int64 `json:"roleId"`
	}

	DataRoleGetAccessMenus struct {
yangfu authored
200
		Menus []struct {
yangfu authored
201 202 203 204 205 206 207 208 209 210 211 212 213 214
			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"`
yangfu authored
215
		} `json:"menus"`
tangxuhui authored
216 217 218 219 220 221
	}
)

//设置角色菜单
type (
	ReqRoleSetAccessMenus struct {
222 223
		RoleId      int64   `json:"roleId"`
		AccessMenus []int64 `json:"accessMenus"`
tangxuhui authored
224 225 226 227 228
	}

	DataRoleSetAccessMenus struct {
	}
)