123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- 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"`
- }
|