package dto import ( "Medical_OAuth/app/admin/model" common "Medical_OAuth/common/model" ) // SysMenuGetPageReq 列表或者搜索使用结构体 type SysMenuGetPageReq struct { Name string `form:"name" search:"-"` // 菜单名称 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 `uri:"id" comment:"编码" swaggerignore:"true"` // 编码 ParentId int `form:"parentId" example:"0"` //上级菜单 ServiceMenuId int `uri:"id"` //编码 ServiceId int `form:"serviceId" example:"1" vd:"@:$>0; msg:'服务ID不能为空'"` // 服务id Sort int `form:"sort" example:"0"` //排序 Visible string `form:"visible" example:"1"` //是否显示 1-显示 2-隐藏 common.ControlBy `swaggerignore:"true"` } func (s *SysMenuInsertReq) Generate(model *model.SysMenu) { if s.Id != 0 { model.Id = s.Id } model.ParentId = s.ParentId model.ServiceMenuId = s.ServiceMenuId model.ServiceId = s.ServiceId model.Sort = s.Sort model.Visible = s.Visible 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 `uri:"id" comment:"编码"` // 编码 Sort int `form:"sort" comment:"排序"` //排序 Visible string `form:"visible" comment:"是否显示"` //是否显示 common.ControlBy `swaggerignore:"true"` } func (s *SysMenuUpdateReq) Generate(model *model.SysMenu) { if s.Id != 0 { model.Id = s.Id } model.Sort = s.Sort model.Visible = s.Visible 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 { Ids []int `json:"ids"` common.ControlBy `swaggerignore:"true"` } func (s *SysMenuDeleteReq) GetId() interface{} { return s.Ids } type SysMenu struct { Id int `json:"id"` //编码 ParentId int `json:"parentId"` // 父id ServiceMenuId int `json:"serviceMenuId"` //服务菜单ID ServiceId int `json:"serviceId"` // 服务ID Sort int `json:"sort"` // 排序 Visible string `json:"visible"` // 1-显示 0-隐藏 MenuPath string `json:"paths"` // Name string `json:"name"` // 菜单名称 MenuType string `json:"menuType"` // 菜单类型 Icon string `json:"icon"` // 图标 Component string `json:"component"` // 组件路径 IsFrame string `json:"isFrame"` // 是否外链 1-是 2-否 Path string `json:"path"` // 外链路由地址 Permission string `json:"permission"` // 权限标识 common.ControlBy common.ModelTime } func (s SysMenu) Generate() (model model.SysMenu) { model.Id = s.Id model.ParentId = s.ParentId model.ServiceMenuId = s.ServiceMenuId model.ServiceId = s.ServiceId model.Sort = s.Sort model.Visible = s.Visible model.MenuPath = s.MenuPath model.Name = s.Name model.MenuType = s.MenuType model.Icon = s.Icon model.Component = s.Component model.IsFrame = s.IsFrame model.Path = s.Path model.Permission = s.Permission if s.CreateBy != 0 { model.CreateBy = s.CreateBy } if s.UpdateBy != 0 { model.UpdateBy = s.UpdateBy } if !s.CreatedAt.IsZero() { model.CreatedAt = s.CreatedAt } if !s.UpdatedAt.IsZero() { model.UpdatedAt = s.UpdatedAt } return } type MenuLabel struct { Id int `json:"id,omitempty" gorm:"-"` Label string `json:"label,omitempty" gorm:"-"` Children []MenuLabel `json:"children,omitempty" gorm:"-"` } type MenuRole struct { model.SysMenu IsSelect bool `json:"is_select" gorm:"-"` } type SelectRole struct { RoleId int `uri:"roleId"` }