新增菜单和角色关联接口
This commit is contained in:
78
api/menu/v1/menu.go
Normal file
78
api/menu/v1/menu.go
Normal file
@ -0,0 +1,78 @@
|
||||
package v1
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
// ListReq 获取菜单列表请求
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/menu" method:"get" tags:"Menu" summary:"(系统管理员)获取菜单列表"`
|
||||
Page int `json:"page" dc:"页数"`
|
||||
Size int `json:"size" dc:"每页数量"`
|
||||
Status int `json:"status" dc:"状态:1=启用,2=禁用"`
|
||||
}
|
||||
|
||||
// ListRes 获取菜单列表响应
|
||||
type ListRes struct {
|
||||
List interface{} `json:"list" dc:"菜单列表"`
|
||||
Total int `json:"total" dc:"总数"`
|
||||
}
|
||||
|
||||
// CreateReq 创建菜单请求
|
||||
type CreateReq struct {
|
||||
g.Meta `path:"/menu" method:"post" tags:"Menu" summary:"(系统管理员)创建菜单"`
|
||||
Name string `json:"name" v:"required" dc:"菜单名称"`
|
||||
ParentId int64 `json:"parent_id" dc:"父级菜单ID"`
|
||||
Path string `json:"path" v:"required" dc:"前端路由路径"`
|
||||
Component string `json:"component" dc:"前端组件路径"`
|
||||
Type int `json:"type" v:"required" dc:"类型:1=目录,2=菜单"`
|
||||
Icon string `json:"icon" dc:"图标"`
|
||||
Sort int `json:"sort" dc:"排序"`
|
||||
Hidden bool `json:"hidden" dc:"是否隐藏:0=显示,1=隐藏"`
|
||||
Status int `json:"status" v:"required" dc:"状态:1=启用,2=禁用"`
|
||||
}
|
||||
|
||||
// CreateRes 创建菜单响应
|
||||
type CreateRes struct {
|
||||
Id int64 `json:"id" dc:"菜单ID"`
|
||||
}
|
||||
|
||||
// UpdateReq 更新菜单请求
|
||||
type UpdateReq struct {
|
||||
g.Meta `path:"/menu" method:"put" tags:"Menu" summary:"(系统管理员)更新菜单"`
|
||||
Id int64 `json:"id" v:"required" dc:"菜单ID"`
|
||||
Name string `json:"name" v:"required" dc:"菜单名称"`
|
||||
ParentId int64 `json:"parent_id" dc:"父级菜单ID"`
|
||||
Path string `json:"path" v:"required" dc:"前端路由路径"`
|
||||
Component string `json:"component" dc:"前端组件路径"`
|
||||
Type int `json:"type" v:"required" dc:"类型:1=目录,2=菜单"`
|
||||
Icon string `json:"icon" dc:"图标"`
|
||||
Sort int `json:"sort" dc:"排序"`
|
||||
Hidden bool `json:"hidden" dc:"是否隐藏:0=显示,1=隐藏"`
|
||||
Status int `json:"status" v:"required" dc:"状态:1=启用,2=禁用"`
|
||||
}
|
||||
|
||||
// UpdateRes 更新菜单响应
|
||||
type UpdateRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
// DeleteReq 删除菜单请求
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/menu/{id}" method:"delete" tags:"Menu" summary:"(系统管理员)删除菜单"`
|
||||
Id int64 `json:"id" v:"required" dc:"菜单ID"`
|
||||
}
|
||||
|
||||
// DeleteRes 删除菜单响应
|
||||
type DeleteRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
// BatchDeleteReq 批量删除菜单请求
|
||||
type BatchDeleteReq struct {
|
||||
g.Meta `path:"/menu" method:"delete" tags:"Menu" summary:"(系统管理员)批量删除菜单"`
|
||||
Ids []int `json:"ids" v:"required" dc:"菜单ID列表"`
|
||||
}
|
||||
|
||||
// BatchDeleteRes 批量删除菜单响应
|
||||
type BatchDeleteRes struct {
|
||||
Ids []int `json:"ids" dc:"返回未删除的 id 数组"`
|
||||
}
|
||||
Reference in New Issue
Block a user