326 lines
7.7 KiB
Plaintext
326 lines
7.7 KiB
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "系统服务API"
|
|
desc: "客户端管理、角色管理、菜单管理、操作日志等HTTP接口"
|
|
author: "sundynix"
|
|
version: "v1.0.0"
|
|
)
|
|
|
|
type (
|
|
// ---------- 通用 ----------
|
|
IdReq {
|
|
Id string `json:"id"`
|
|
}
|
|
IdQueryReq {
|
|
Id string `form:"id"`
|
|
}
|
|
IdsReq {
|
|
Ids []string `json:"ids"`
|
|
}
|
|
PageReq {
|
|
Current int `json:"current,optional"`
|
|
PageSize int `json:"pageSize,optional"`
|
|
Keyword string `json:"keyword,optional"`
|
|
}
|
|
// ---------- 客户端 ----------
|
|
ClientReq {
|
|
ClientId string `json:"clientId"`
|
|
Name string `json:"name"`
|
|
GrantType string `json:"grantType,optional"`
|
|
AdditionalInfo string `json:"additionalInfo,optional"`
|
|
ActiveTimeout int64 `json:"activeTimeout,optional"`
|
|
}
|
|
ClientUpdateReq {
|
|
Id string `json:"id"`
|
|
ClientId string `json:"clientId,optional"`
|
|
Name string `json:"name,optional"`
|
|
GrantType string `json:"grantType,optional"`
|
|
AdditionalInfo string `json:"additionalInfo,optional"`
|
|
ActiveTimeout int64 `json:"activeTimeout,optional"`
|
|
}
|
|
ClientListReq {
|
|
Current int `json:"current,optional"`
|
|
PageSize int `json:"pageSize,optional"`
|
|
Name string `json:"name,optional"`
|
|
}
|
|
// ---------- 角色 ----------
|
|
RoleReq {
|
|
Name string `json:"name"`
|
|
Code string `json:"code"`
|
|
Sort int `json:"sort,optional"`
|
|
MenuIds []string `json:"menuIds,optional"`
|
|
}
|
|
RoleUpdateReq {
|
|
Id string `json:"id"`
|
|
Name string `json:"name,optional"`
|
|
Code string `json:"code,optional"`
|
|
Sort int `json:"sort,optional"`
|
|
}
|
|
RoleListReq {
|
|
Current int `json:"current,optional"`
|
|
PageSize int `json:"pageSize,optional"`
|
|
Name string `json:"name,optional"`
|
|
}
|
|
RoleDetailResp {
|
|
Id string `json:"id"`
|
|
Name string `json:"name"`
|
|
Code string `json:"code"`
|
|
Sort int `json:"sort"`
|
|
MenuIds []string `json:"menuIds"`
|
|
}
|
|
AssignRoleMenusReq {
|
|
RoleId string `json:"roleId"`
|
|
MenuIds []string `json:"menuIds"`
|
|
}
|
|
// ---------- 菜单 ----------
|
|
MenuReq {
|
|
ParentId string `json:"parentId,optional"`
|
|
Category int `json:"category,optional"`
|
|
Name string `json:"name"`
|
|
Title string `json:"title,optional"`
|
|
Code string `json:"code,optional"`
|
|
Path string `json:"path,optional"`
|
|
Permission string `json:"permission,optional"`
|
|
Locale string `json:"locale,optional"`
|
|
Icon string `json:"icon,optional"`
|
|
Sort int `json:"sort,optional"`
|
|
}
|
|
MenuUpdateReq {
|
|
Id string `json:"id"`
|
|
ParentId string `json:"parentId,optional"`
|
|
Category int `json:"category,optional"`
|
|
Name string `json:"name,optional"`
|
|
Title string `json:"title,optional"`
|
|
Code string `json:"code,optional"`
|
|
Path string `json:"path,optional"`
|
|
Permission string `json:"permission,optional"`
|
|
Locale string `json:"locale,optional"`
|
|
Icon string `json:"icon,optional"`
|
|
Sort int `json:"sort,optional"`
|
|
}
|
|
// ---------- 操作日志 ----------
|
|
OperationRecordListReq {
|
|
Current int `json:"current,optional"`
|
|
PageSize int `json:"pageSize,optional"`
|
|
Method string `json:"method,optional"`
|
|
Path string `json:"path,optional"`
|
|
Status int `json:"status,optional"`
|
|
}
|
|
// ---------- 字典 ----------
|
|
DictReq {
|
|
Type string `json:"type"`
|
|
Label string `json:"label"`
|
|
Value string `json:"value"`
|
|
Sort int `json:"sort,optional"`
|
|
Desc string `json:"desc,optional"`
|
|
}
|
|
DictUpdateReq {
|
|
Id string `json:"id"`
|
|
Type string `json:"type,optional"`
|
|
Label string `json:"label,optional"`
|
|
Value string `json:"value,optional"`
|
|
Sort int `json:"sort,optional"`
|
|
Desc string `json:"desc,optional"`
|
|
}
|
|
DictListReq {
|
|
Current int `json:"current,optional"`
|
|
PageSize int `json:"pageSize,optional"`
|
|
Type string `json:"type,optional"`
|
|
}
|
|
// ---------- 用户管理 ----------
|
|
UserCreateReq {
|
|
Name string `json:"name"`
|
|
Account string `json:"account"`
|
|
Password string `json:"password"`
|
|
Phone string `json:"phone,optional"`
|
|
NickName string `json:"nickName,optional"`
|
|
RoleIds []string `json:"roleIds,optional"`
|
|
}
|
|
UserUpdateReq {
|
|
Id string `json:"id"`
|
|
Name string `json:"name,optional"`
|
|
Account string `json:"account,optional"`
|
|
Phone string `json:"phone,optional"`
|
|
NickName string `json:"nickName,optional"`
|
|
}
|
|
UserListReq {
|
|
Current int `json:"current,optional"`
|
|
PageSize int `json:"pageSize,optional"`
|
|
Name string `json:"name,optional"`
|
|
Account string `json:"account,optional"`
|
|
}
|
|
UserDetailResp {
|
|
Id string `json:"id"`
|
|
Name string `json:"name"`
|
|
Account string `json:"account"`
|
|
NickName string `json:"nickName"`
|
|
Phone string `json:"phone"`
|
|
RoleIds []string `json:"roleIds"`
|
|
}
|
|
ResetPasswordReq {
|
|
Id string `json:"id"`
|
|
Password string `json:"password"`
|
|
}
|
|
AssignUserRolesReq {
|
|
UserId string `json:"userId"`
|
|
RoleIds []string `json:"roleIds"`
|
|
}
|
|
)
|
|
|
|
// ========== 需要鉴权的接口 ==========
|
|
@server (
|
|
prefix: /api/sys
|
|
group: client
|
|
jwt: Auth
|
|
)
|
|
service system-api {
|
|
@doc "创建客户端"
|
|
@handler CreateClient
|
|
post /client/create (ClientReq)
|
|
|
|
@doc "更新客户端"
|
|
@handler UpdateClient
|
|
post /client/update (ClientUpdateReq)
|
|
|
|
@doc "删除客户端"
|
|
@handler DeleteClient
|
|
post /client/delete (IdsReq)
|
|
|
|
@doc "客户端列表"
|
|
@handler GetClientList
|
|
post /client/list (ClientListReq)
|
|
}
|
|
|
|
@server (
|
|
prefix: /api/sys
|
|
group: role
|
|
jwt: Auth
|
|
)
|
|
service system-api {
|
|
@doc "创建角色"
|
|
@handler CreateRole
|
|
post /role/create (RoleReq)
|
|
|
|
@doc "更新角色"
|
|
@handler UpdateRole
|
|
post /role/update (RoleUpdateReq)
|
|
|
|
@doc "删除角色"
|
|
@handler DeleteRole
|
|
post /role/delete (IdsReq)
|
|
|
|
@doc "角色列表"
|
|
@handler GetRoleList
|
|
post /role/list (RoleListReq)
|
|
|
|
@doc "角色详情(含已授权菜单)"
|
|
@handler GetRoleDetail
|
|
get /role/detail (IdQueryReq) returns (RoleDetailResp)
|
|
|
|
@doc "角色授权菜单"
|
|
@handler AssignRoleMenus
|
|
post /role/assignMenus (AssignRoleMenusReq)
|
|
}
|
|
|
|
@server (
|
|
prefix: /api/sys
|
|
group: menu
|
|
jwt: Auth
|
|
)
|
|
service system-api {
|
|
@doc "创建菜单"
|
|
@handler CreateMenu
|
|
post /menu/create (MenuReq)
|
|
|
|
@doc "更新菜单"
|
|
@handler UpdateMenu
|
|
post /menu/update (MenuUpdateReq)
|
|
|
|
@doc "删除菜单"
|
|
@handler DeleteMenu
|
|
post /menu/delete (IdsReq)
|
|
|
|
@doc "菜单列表(树形)"
|
|
@handler GetMenuList
|
|
get /menu/list
|
|
|
|
@doc "根据角色获取菜单"
|
|
@handler GetMenuByRole
|
|
post /menu/byRole (IdReq)
|
|
}
|
|
|
|
@server (
|
|
prefix: /api/sys
|
|
group: operationRecord
|
|
jwt: Auth
|
|
)
|
|
service system-api {
|
|
@doc "操作日志列表"
|
|
@handler GetOperationRecordList
|
|
post /log/list (OperationRecordListReq)
|
|
|
|
@doc "删除操作日志"
|
|
@handler DeleteOperationRecord
|
|
post /log/delete (IdsReq)
|
|
}
|
|
|
|
@server (
|
|
prefix: /api/sys
|
|
group: dict
|
|
jwt: Auth
|
|
)
|
|
service system-api {
|
|
@doc "创建字典"
|
|
@handler CreateDict
|
|
post /dict/create (DictReq)
|
|
|
|
@doc "更新字典"
|
|
@handler UpdateDict
|
|
post /dict/update (DictUpdateReq)
|
|
|
|
@doc "删除字典"
|
|
@handler DeleteDict
|
|
post /dict/delete (IdsReq)
|
|
|
|
@doc "字典列表"
|
|
@handler GetDictList
|
|
post /dict/list (DictListReq)
|
|
}
|
|
|
|
@server (
|
|
prefix: /api/sys
|
|
group: user
|
|
jwt: Auth
|
|
)
|
|
service system-api {
|
|
@doc "用户列表"
|
|
@handler GetUserList
|
|
post /user/list (UserListReq)
|
|
|
|
@doc "用户详情(含角色信息)"
|
|
@handler GetUserDetail
|
|
get /user/detail (IdQueryReq) returns (UserDetailResp)
|
|
|
|
@doc "创建用户"
|
|
@handler CreateUser
|
|
post /user/create (UserCreateReq)
|
|
|
|
@doc "更新用户"
|
|
@handler UpdateUser
|
|
post /user/update (UserUpdateReq)
|
|
|
|
@doc "删除用户"
|
|
@handler DeleteUser
|
|
post /user/delete (IdsReq)
|
|
|
|
@doc "重置密码"
|
|
@handler ResetPassword
|
|
post /user/resetPassword (ResetPasswordReq)
|
|
|
|
@doc "用户授权角色"
|
|
@handler AssignUserRoles
|
|
post /user/assignRoles (AssignUserRolesReq)
|
|
}
|
|
|