feat✨ apis路径简化

This commit is contained in:
wenjianzhang committed 2021-05-14 12:19:22 +08:00
1 parent 8adc79a5f7
commit dfd460c50b
56 files changed
+471 -665

No files matched your search

+28 -25
View File
@@ -2,12 +2,12 @@ package dto
import (
"encoding/json"
"go-admin/app/admin/models"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-admin-team/go-admin-core/sdk/api"
"go-admin/app/admin/models/system"
"go-admin/common/dto"
)
@@ -38,24 +38,26 @@ func (m *SysMenuSearch) Bind(ctx *gin.Context) error {
return err
}
// SysConfigControl 增、改使用的结构体
// SysMenuControl 增、改使用的结构体
type SysMenuControl struct {
MenuId int `uri:"id" comment:"编码"` // 编码
MenuName string `form:"menuName" comment:"菜单name"` //菜单name
Title string `form:"title" comment:"显示名称"` //显示名称
Icon string `form:"icon" comment:"图标"` //图标
Path string `form:"path" comment:"路径"` //路径
Paths string `form:"paths" comment:"id路径"` //id路径
MenuType string `form:"menuType" comment:"菜单类型"` //菜单类型
Action string `form:"action" comment:"请求方式"` //请求方式
Permission string `form:"permission" comment:"权限编码"` //权限编码
ParentId int `form:"parentId" comment:"上级菜单"` //上级菜单
NoCache bool `form:"noCache" comment:"是否缓存"` //是否缓存
Breadcrumb string `form:"breadcrumb" comment:"是否面包屑"` //是否面包屑
Component string `form:"component" comment:"组件"` //组件
Sort int `form:"sort" comment:"排序"` //排序
Visible string `form:"visible" comment:"是否显示"` //是否显示
IsFrame string `form:"isFrame" comment:"是否frame"` //是否frame
MenuId int `uri:"id" comment:"编码"` // 编码
MenuName string `form:"menuName" comment:"菜单name"` //菜单name
Title string `form:"title" comment:"显示名称"` //显示名称
Icon string `form:"icon" comment:"图标"` //图标
Path string `form:"path" comment:"路径"` //路径
Paths string `form:"paths" comment:"id路径"` //id路径
MenuType string `form:"menuType" comment:"菜单类型"` //菜单类型
SysApi []models.SysApi `form:"sysApi"`
Apis []int `form:"apis"`
Action string `form:"action" comment:"请求方式"` //请求方式
Permission string `form:"permission" comment:"权限编码"` //权限编码
ParentId int `form:"parentId" comment:"上级菜单"` //上级菜单
NoCache bool `form:"noCache" comment:"是否缓存"` //是否缓存
Breadcrumb string `form:"breadcrumb" comment:"是否面包屑"` //是否面包屑
Component string `form:"component" comment:"组件"` //组件
Sort int `form:"sort" comment:"排序"` //排序
Visible string `form:"visible" comment:"是否显示"` //是否显示
IsFrame string `form:"isFrame" comment:"是否frame"` //是否frame
}
// Bind 映射上下文中的结构体数据
@@ -79,9 +81,9 @@ func (s *SysMenuControl) Bind(ctx *gin.Context) error {
return err
}
// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型
func (s *SysMenuControl) Generate() (*system.SysMenu, error) {
return &system.SysMenu{
// Generate 结构体数据转化 从 Control 至 model 对应的模型
func (s *SysMenuControl) Generate() (*models.SysMenu, error) {
return &models.SysMenu{
MenuId: s.MenuId,
MenuName: s.MenuName,
Title: s.Title,
@@ -90,6 +92,7 @@ func (s *SysMenuControl) Generate() (*system.SysMenu, error) {
Paths: s.Paths,
MenuType: s.MenuType,
Action: s.Action,
SysApi: s.SysApi,
Permission: s.Permission,
ParentId: s.ParentId,
NoCache: s.NoCache,
@@ -135,8 +138,8 @@ func (s *SysMenuById) Bind(ctx *gin.Context) error {
return err
}
func (s *SysMenuById) GenerateM() (*system.SysMenu, error) {
return &system.SysMenu{}, nil
func (s *SysMenuById) GenerateM() (*models.SysMenu, error) {
return &models.SysMenu{}, nil
}
type MenuLabel struct {
@@ -146,10 +149,10 @@ type MenuLabel struct {
}
type MenuRole struct {
system.SysMenus
models.SysMenu
IsSelect bool `json:"is_select" gorm:"-"`
}
type SelectRole struct {
RoleId int `uri:"roleId"`
}
}