新增菜单和角色关联接口
This commit is contained in:
19
api/menu/menu.go
Normal file
19
api/menu/menu.go
Normal file
@ -0,0 +1,19 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package menu
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/menu/v1"
|
||||
)
|
||||
|
||||
type IMenuV1 interface {
|
||||
List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error)
|
||||
Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error)
|
||||
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error)
|
||||
Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error)
|
||||
BatchDelete(ctx context.Context, req *v1.BatchDeleteReq) (res *v1.BatchDeleteRes, err error)
|
||||
}
|
||||
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 数组"`
|
||||
}
|
||||
16
api/roleMenu/roleMenu.go
Normal file
16
api/roleMenu/roleMenu.go
Normal file
@ -0,0 +1,16 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package roleMenu
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/roleMenu/v1"
|
||||
)
|
||||
|
||||
type IRoleMenuV1 interface {
|
||||
List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error)
|
||||
SaveRoleMenu(ctx context.Context, req *v1.SaveRoleMenuReq) (res *v1.SaveRoleMenuRes, err error)
|
||||
}
|
||||
27
api/roleMenu/v1/roleMenu.go
Normal file
27
api/roleMenu/v1/roleMenu.go
Normal file
@ -0,0 +1,27 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ListReq 角色菜单列表请求
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/role-menu" method:"get" tags:"角色菜单" summary:"获取角色菜单列表"`
|
||||
RoleId int64 `json:"roleId" v:"required#角色ID不能为空" dc:"角色ID"`
|
||||
}
|
||||
|
||||
// ListRes 角色菜单列表响应
|
||||
type ListRes struct {
|
||||
List interface{} `json:"list" dc:"角色菜单列表"`
|
||||
Total int `json:"total" dc:"总条数"`
|
||||
}
|
||||
|
||||
type SaveRoleMenuReq struct {
|
||||
g.Meta `path:"/role-menu" method:"post" tags:"角色菜单" summary:"保存角色菜单"`
|
||||
RoleId int `json:"roleId" v:"required#角色ID不能为空" dc:"角色ID"`
|
||||
MenuIds []int `json:"menuIds" v:"required#菜单ID列表不能为空" dc:"菜单ID列表"`
|
||||
}
|
||||
|
||||
type SaveRoleMenuRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
Reference in New Issue
Block a user