feat: swagger
This commit is contained in:
@@ -14,6 +14,15 @@ import (
|
||||
type MenuApi struct {
|
||||
}
|
||||
|
||||
// SaveMenu
|
||||
// @Tags 菜单管理
|
||||
// @Summary 新增菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.Menu false "menu"
|
||||
// @Success 200 {object} response.Response{msg=string} "新建菜单/按钮"
|
||||
// @Router /api/menu/save [post]
|
||||
func (m *MenuApi) SaveMenu(c *gin.Context) {
|
||||
var menu system.Menu
|
||||
err := c.ShouldBindJSON(&menu)
|
||||
@@ -30,6 +39,15 @@ func (m *MenuApi) SaveMenu(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateMenu
|
||||
// @Tags 菜单管理
|
||||
// @Summary 更新菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.Menu false "menu"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新菜单"
|
||||
// @Router /menu/update [post]
|
||||
func (m *MenuApi) UpdateMenu(c *gin.Context) {
|
||||
var menu system.Menu
|
||||
err := c.ShouldBindJSON(&menu)
|
||||
@@ -46,6 +64,15 @@ func (m *MenuApi) UpdateMenu(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteMenu
|
||||
// @Tags 菜单管理
|
||||
// @Summary 删除menu
|
||||
// @Description 删除menu
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param id query string true "id"
|
||||
// @Success 200 {object} response.Response{msg=string} "详情"
|
||||
// @Router /api/menu/delete [get]
|
||||
func (m *MenuApi) DeleteMenu(c *gin.Context) {
|
||||
id := c.Query("id")
|
||||
err := menuService.DeleteMenu(id)
|
||||
@@ -57,6 +84,15 @@ func (m *MenuApi) DeleteMenu(c *gin.Context) {
|
||||
response.OkWithMsg("删除菜单成功!", c)
|
||||
}
|
||||
|
||||
// Detail
|
||||
// @Tags 菜单管理
|
||||
// @Summary 获取menu详情
|
||||
// @Description id获取详情
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param id query string true "id"
|
||||
// @Success 200 {object} response.Response{data=system.Menu,msg=string} "详情"
|
||||
// @Router /api/menu/detail [get]
|
||||
func (m *MenuApi) Detail(c *gin.Context) {
|
||||
id := c.Query("id")
|
||||
menu, err := menuService.GetMenuById(id)
|
||||
@@ -68,6 +104,15 @@ func (m *MenuApi) Detail(c *gin.Context) {
|
||||
response.OkWithData(menu, c)
|
||||
}
|
||||
|
||||
// GetAllMenuTree
|
||||
// @Tags 菜单管理
|
||||
// @Summary 获取所有菜单树
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body systemReq.GetMenuTree true "菜单信息"
|
||||
// @Success 200 {object} response.Response{data=[]system.Menu,msg=string} "获取所有菜单树"
|
||||
// @Router /api/menu/getAllMenuTree [post]
|
||||
func (m *MenuApi) GetAllMenuTree(c *gin.Context) {
|
||||
var param systemReq.GetMenuTree
|
||||
err := c.ShouldBindJSON(¶m)
|
||||
@@ -84,10 +129,24 @@ func (m *MenuApi) GetAllMenuTree(c *gin.Context) {
|
||||
response.OkWithData(menus, c)
|
||||
}
|
||||
|
||||
// GetUserMenuTree
|
||||
// @Tags 菜单管理
|
||||
// @Summary 用户菜单数据
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce json
|
||||
// @Success 200 {object} response.Response{data=[]system.Menu,msg=string} "用户菜单数据"
|
||||
// @Router /api/menu/getUserMenuTree [get]
|
||||
func (m *MenuApi) GetUserMenuTree(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
// Route
|
||||
// @Tags 菜单管理
|
||||
// @Summary 用户路由
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce json
|
||||
// @Success 200 {object} response.Response{data=[]system.Menu,msg=string} "用户route"
|
||||
// @Router /api/menu/route [get]
|
||||
func (m *MenuApi) Route(c *gin.Context) {
|
||||
userId := jwt.GetUserId(c)
|
||||
routes, err := menuService.GetUserRoutes(userId)
|
||||
|
||||
Reference in New Issue
Block a user