package dto import ( "cold-delivery/app/admin/model" "cold-delivery/common/dto" common "cold-delivery/common/model" ) // SysMenuGetPageReq 列表或者搜索使用结构体 type SysMenuGetPageReq struct { dto.Pagination `search:"-"` Name string `form:"name" search:"type:contains;column:name;table:sys_menu"` // 菜单名称 Visible int `form:"visible" search:"type:exact;column:visible;table:sys_menu"` // 显示状态 SysMenuOrder } type SysMenuOrder struct { SortOrder string `search:"type:order;column:sort;table:sys_menu" form:"sort" default:"ASC"` //排序 ASC 升序 DESC 降序 } func (m *SysMenuGetPageReq) GetNeedSearch() interface{} { return *m } type SysMenuInsertReq struct { Id int `json:"id" swaggerignore:"true"` //编码 Title string `json:"title" example:"菜单名称"` //菜单名称 Name string `json:"name" example:"admin"` //路由名称 Icon string `json:"icon" example:"app-group-fill"` //图标 Path string `json:"path" example:"/admin" swaggerignore:"true"` //后端路由地址 MenuPath string `json:"paths" swaggerignore:"true"` //id路径 MenuType string `json:"menuType" example:"C"` //菜单类型 M-目录 C-菜单 F-按钮 Permission string `json:"permission" example:"admin:sysUser:list" swaggerignore:"true"` //权限编码 ParentId int `json:"parentId" example:"0"` //上级菜单 Component string `json:"component" example:"/admin/sys-user/index"` //组件名称 Sort int `json:"sort" example:"0"` //排序 Visible string `json:"visible" example:"1"` //是否显示 1-显示 2-隐藏 IsFrame string `json:"isFrame" example:"0" swaggerignore:"true"` //是否frame 1-是 2-否 common.ControlBy `swaggerignore:"true"` } func (s *SysMenuInsertReq) Generate(model *model.SysMenu) { if s.Id != 0 { model.Id = s.Id } model.Title = s.Title model.Icon = s.Icon model.Path = s.Path model.MenuPath = s.MenuPath model.MenuType = s.MenuType model.Name = s.Name model.ParentId = s.ParentId model.Component = s.Component model.Sort = s.Sort model.Visible = s.Visible model.IsFrame = s.IsFrame if s.CreateBy != 0 { model.CreateBy = s.CreateBy } if s.UpdateBy != 0 { model.UpdateBy = s.UpdateBy } } func (s *SysMenuInsertReq) GetId() interface{} { return s.Id } type SysMenuUpdateReq struct { Id int `json:"id" comment:"编码"` // 编码 Title string `json:"title" example:"菜单名称"` //菜单名称 Name string `json:"name" example:"admin"` // 路由名称 Icon string `json:"icon" example:"app-group-fill"` //图标 Path string `json:"path" example:"/admin" swaggerignore:"true"` //后端路由地址 MenuPath string `json:"paths" swaggerignore:"true"` //id路径 MenuType string `json:"menuType" example:"C"` //菜单类型 M-目录 C-菜单 F-按钮 Permission string `json:"permission" example:"admin:sysUser:list"` //权限编码 ParentId int `json:"parentId" example:"0"` //上级菜单 Component string `json:"component" example:"admin"` //组件名称 Sort int `json:"sort" example:"0"` //排序 Visible string `json:"visible" example:"1"` //是否显示 1-显示 2-隐藏 IsFrame string `json:"isFrame" example:"0" swaggerignore:"true"` //是否frame 1-是 2-否 common.ControlBy `swaggerignore:"true"` } func (s *SysMenuUpdateReq) Generate(model *model.SysMenu) { if s.Id != 0 { model.Id = s.Id } model.Title = s.Title model.Icon = s.Icon model.Path = s.Path model.MenuPath = s.MenuPath model.MenuType = s.MenuType model.Name = s.Name model.ParentId = s.ParentId model.Component = s.Component model.Sort = s.Sort model.Visible = s.Visible model.IsFrame = s.IsFrame if s.CreateBy != 0 { model.CreateBy = s.CreateBy } if s.UpdateBy != 0 { model.UpdateBy = s.UpdateBy } } func (s *SysMenuUpdateReq) GetId() interface{} { return s.Id } type SysMenuGetReq struct { Id int `uri:"id"` } func (s *SysMenuGetReq) GetId() interface{} { return s.Id } type SysMenuDeleteReq struct { Id int `json:"id"` common.ControlBy `swaggerignore:"true"` } func (s *SysMenuDeleteReq) GetId() interface{} { return s.Id } type MenuLabel struct { Id int `json:"id,omitempty" gorm:"-"` Label string `json:"label,omitempty" gorm:"-"` Children []MenuLabel `json:"children,omitempty" gorm:"-"` }