package dto import ( "Medical_OAuth/app/admin/model" "Medical_OAuth/common/dto" common "Medical_OAuth/common/model" ) // ServMenuGetPageReq 列表或者搜索使用结构体 type ServMenuGetPageReq struct { dto.Pagination `search:"-"` ServiceId int `form:"serviceId" search:"type:exact;column:service_id;table:serv_menu"` // 服务id Name string `form:"name" search:"type:contains;column:name;table:serv_menu"` // 菜单名称 Visible int `form:"visible" search:"type:exact;column:visible;table:serv_menu"` // 显示状态 ServMenuOrder } type ServMenuOrder struct { SortOrder string `search:"type:order;column:sort;table:serv_menu" form:"sort" default:"asc"` //排序 ASC 升序 DESC 降序 } func (m *ServMenuGetPageReq) GetNeedSearch() interface{} { return *m } type ServMenuInsertReq struct { Id int `uri:"id" swaggerignore:"true"` //编码 ServiceId int `form:"serviceId" example:"1" vd:"@:$>0; msg:'服务ID不能为空'"` // 服务id Name string `form:"name" example:"菜单名称"` //菜单名称 Icon string `form:"icon" example:"app-group-fill"` //图标 Path string `form:"path" example:"/admin"` //路径 MenuPath string `form:"paths" swaggerignore:"true"` //id路径 MenuType string `form:"menuType" example:"C"` //菜单类型 M-目录 C-菜单 F-按钮 Permission string `form:"permission" example:"admin:sysUser:list"` //权限编码 ParentId int `form:"parentId" example:"0"` //上级菜单 Component string `form:"component" example:"/admin/sys-user/index"` //组件名称 Sort int `form:"sort" example:"0"` //排序 Visible string `form:"visible" example:"1"` //是否显示 1-显示 2-隐藏 IsFrame string `form:"isFrame" example:"0"` //是否frame 1-是 2-否 common.ControlBy `swaggerignore:"true"` } func (s *ServMenuInsertReq) Generate(model *model.ServMenu) { if s.Id != 0 { model.Id = s.Id } model.ServiceId = s.ServiceId model.Name = s.Name model.Icon = s.Icon model.Path = s.Path model.MenuPath = s.MenuPath model.MenuType = s.MenuType model.Permission = s.Permission 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 *ServMenuInsertReq) GetId() interface{} { return s.Id } type ServMenuUpdateReq struct { Id int `uri:"id" swaggerignore:"true"` //编码 Name string `form:"name" example:"菜单名称"` //菜单名称 Icon string `form:"icon" example:"app-group-fill"` //图标 Path string `form:"path" example:"/admin"` //路径 MenuPath string `form:"paths" swaggerignore:"true"` //id路径 MenuType string `form:"menuType" example:"C"` //菜单类型 M-目录 C-菜单 F-按钮 Permission string `form:"permission" example:"admin:sysUser:list"` //权限编码 ParentId int `form:"parentId" example:"0"` //上级菜单 Component string `form:"component" example:"/admin/sys-user/index"` //组件名称 Sort int `form:"sort" example:"0"` //排序 Visible string `form:"visible" example:"1"` //是否显示 1-显示 2-隐藏 IsFrame string `form:"isFrame" example:"0"` //是否frame 1-是 2-否 common.ControlBy `swaggerignore:"true"` } func (s *ServMenuUpdateReq) Generate(model *model.ServMenu) { if s.Id != 0 { model.Id = s.Id } model.Name = s.Name model.Icon = s.Icon model.Path = s.Path model.MenuPath = s.MenuPath model.MenuType = s.MenuType model.Permission = s.Permission 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 *ServMenuUpdateReq) GetId() interface{} { return s.Id } type ServMenuGetReq struct { Id int `uri:"id"` } func (s *ServMenuGetReq) GetId() interface{} { return s.Id } type ServMenuDeleteReq struct { Ids []int `json:"ids"` common.ControlBy `swaggerignore:"true"` } func (s *ServMenuDeleteReq) GetId() interface{} { return s.Ids } type ServMenuLabel struct { Id int `json:"id,omitempty" gorm:"-"` Label string `json:"label,omitempty" gorm:"-"` Children []MenuLabel `json:"children,omitempty" gorm:"-"` } type ServMenuRole struct { model.ServMenu IsSelect bool `json:"is_select" gorm:"-"` } type AppSelectRole struct { RoleId int `uri:"roleId"` } type ServMenuExportReq struct { ServiceId int `form:"serviceId" example:"1"` Type string `form:"type" example:"json"` // json excel }