作者 tangxuhui

角色关联部分

version: v1
kind: HttpApi
metadata:
service: roles
path: /roles
endpoints:
- method: roleAdd
route:
post: /
- method: roleUpdate
route:
put: /{Id}
- method: roleList
route:
post: /search
- method: roleGet
route:
get: /{Id}
- method: roleUserInfo
route:
get: /role-user/{Id}
- method: roleUserAdd
route:
post: /role-user
- method: roleUserDelete
route:
delete: /role-user
- method: roleUserBeforeEdit
route:
get: /role-user/before-edit
- method: roleMenuBeforeEdit
route:
get: /role-menu/before-edit
- method: roleMenuEdit
route:
put: /role-menu/{Id}
... ...
version: v1
kind: Attribute
metadata:
name: createdAt
description: 创建时间
type:
primitive: datetime
... ...
version: v1
kind: Attribute
metadata:
name: deletedAt
description: 删除时间
type:
primitive: datetime
... ...
version: v1
kind: Attribute
metadata:
name: updatedAt
description: 更新时间
type:
primitive: datetime
... ...
... ... @@ -3,5 +3,5 @@ kind: Attribute
metadata:
name: accessMenus
description: 有权限的菜单
type:
primitive: int64
type:
array: int64
... ...
version: v1
kind: Schema
metadata:
name: roleDetail
description: 角色详细数据
attributes:
- ref: roleId
required: true
- ref: companyId
required: true
- ref: orgId
required: true
- ref: orgName
required: true
- ref: roleName
required: true
- ref: desc
required: true
- name: roleMenu
description: 角色拥有的权限菜单
type:
array: roleMenu
- name: roleUser
description: 关联的用户
type:
array: roleUser
... ...
version: v1
kind: Schema
metadata:
name: role
description: 角色 (base)
attributes:
- ref: roleId
required: true
- ref: orgId
required: true
- ref: orgName
required: true
- ref: roleName
required: true
- ref: desc
required: true
- ref: createdAt
required: true
- ref: updatedAt
required: true
... ...
version: v1
kind: Schema
metadata:
name: roleMenu
description: 角色下拥有的菜单
attributes:
- ref: menuId
required: true
- ref: parentId
required: true
- ref: menuName
required: true
... ...
version: v1
kind: Schema
metadata:
name: roleUser
description: 角色下关联的用户
attributes:
- ref: usersId
required: true
- ref: usersCode
required: true
- ref: usersName
required: true
- ref: orgId
required: true
- ref: orgName
required: true
... ...
version: v1
kind: Schema
metadata:
name: roleUserInfo
description: 角色下关联用户的详情
attributes:
- ref: roleId
required: true
- ref: roleName
required: true
- ref: desc
required: true
- name: roleUser
description: 关联的用户
type:
array: roleUser
- name: notInRoleUser
description: 未关联的用户列表
type:
array: roleUser
... ...
version: v1
kind: Method
metadata:
name: roleAdd
type: command
description: 创建role
payload:
- name: role
type:
schema: role
required: true
result:
- name: role
type:
schema: role
required: true
... ...
version: v1
kind: Method
metadata:
name: roleGet
type: query
description: 返角色详情
payload:
- ref: roleId
required: true
result:
- name: role
type:
schema: roleDetail
required: true
... ...
version: v1
kind: Method
metadata:
name: roleList
type: query
description: 返回role列表
payload:
- ref: offset
required: true
- ref: limit
required: true
result:
- ref: count
required: true
- name: roles
type:
array: role
required: true
... ...
version: v1
kind: Method
metadata:
name: roleMenuBeforeEdit
type: query
description: 编辑角色关联权限菜单的前置准备数据
payload:
- ref: roleId
required: true
result:
- name: roles
type:
array: role
required: true
- name: menus
type:
array: menu
... ...
version: v1
kind: Method
metadata:
name: roleMenuEdit
type: query
description: 角色编辑关联菜单权限
payload:
- ref: roleId
required: true
- name: menuId
description: 关联菜单的id
type:
array: int64
result:
- ref: roleId
required: true
- name: menuId
description: 关联菜单的id
type:
array: int64
... ...
version: v1
kind: Method
metadata:
name: roleRemove
type: command
description: 移除role
payload:
- ref: roleId
required: true
result:
- name: role
type:
schema: role
required: true
... ...
version: v1
kind: Method
metadata:
name: roleUpdate
type: command
description: 更新role
payload:
- name: role
type:
schema: role
required: true
result:
- name: role
type:
schema: role
required: true
... ...
version: v1
kind: Method
metadata:
name: roleUserAdd
type: query
description: 角色添加关联用户
payload:
- ref: roleId
required: true
- name: userId
description: 关联用户的id
type:
array: int64
result:
- ref: roleId
required: true
- name: userId
description: 关联用户的id
type:
array: int64
... ...
version: v1
kind: Method
metadata:
name: roleUserBeforeEdit
type: query
description: 编辑角色关联用户的前置准备数据
result:
- name: roles
type:
array: role
required: true
- name: orgs
type:
array: org
... ...
version: v1
kind: Method
metadata:
name: roleUserDelete
type: query
description: 角色添加关联用户
payload:
- ref: roleId
required: true
- name: userId
description: 关联用户的id
type:
array: int64
result:
- ref: roleId
required: true
- name: userId
description: 关联用户的id
type:
array: int64
... ...
version: v1
kind: Method
metadata:
name: roleUserInfo
type: query
description: 角色下关联用户的数据
payload:
- ref: roleId
required: true
result:
- name: roleUser
description: 关联详情
type:
schema: roleUserInfo
... ...
version: v1
kind: Service
metadata:
name: roles
description: roles
... ...