serv_menu.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. package dto
  2. import (
  3. "Medical_OAuth/app/admin/model"
  4. "Medical_OAuth/common/dto"
  5. common "Medical_OAuth/common/model"
  6. )
  7. // ServMenuGetPageReq 列表或者搜索使用结构体
  8. type ServMenuGetPageReq struct {
  9. dto.Pagination `search:"-"`
  10. ServiceId int `form:"serviceId" search:"type:exact;column:service_id;table:serv_menu"` // 服务id
  11. Name string `form:"name" search:"type:contains;column:name;table:serv_menu"` // 菜单名称
  12. Visible int `form:"visible" search:"type:exact;column:visible;table:serv_menu"` // 显示状态
  13. ServMenuOrder
  14. }
  15. type ServMenuOrder struct {
  16. SortOrder string `search:"type:order;column:sort;table:serv_menu" form:"sort" default:"asc"` //排序 ASC 升序 DESC 降序
  17. }
  18. func (m *ServMenuGetPageReq) GetNeedSearch() interface{} {
  19. return *m
  20. }
  21. type ServMenuInsertReq struct {
  22. Id int `uri:"id" swaggerignore:"true"` //编码
  23. ServiceId int `form:"serviceId" example:"1" vd:"@:$>0; msg:'服务ID不能为空'"` // 服务id
  24. Name string `form:"name" example:"菜单名称"` //菜单名称
  25. Icon string `form:"icon" example:"app-group-fill"` //图标
  26. Path string `form:"path" example:"/admin"` //路径
  27. MenuPath string `form:"paths" swaggerignore:"true"` //id路径
  28. MenuType string `form:"menuType" example:"C"` //菜单类型 M-目录 C-菜单 F-按钮
  29. Permission string `form:"permission" example:"admin:sysUser:list"` //权限编码
  30. ParentId int `form:"parentId" example:"0"` //上级菜单
  31. Component string `form:"component" example:"/admin/sys-user/index"` //组件名称
  32. Sort int `form:"sort" example:"0"` //排序
  33. Visible string `form:"visible" example:"1"` //是否显示 1-显示 2-隐藏
  34. IsFrame string `form:"isFrame" example:"0"` //是否frame 1-是 2-否
  35. common.ControlBy `swaggerignore:"true"`
  36. }
  37. func (s *ServMenuInsertReq) Generate(model *model.ServMenu) {
  38. if s.Id != 0 {
  39. model.Id = s.Id
  40. }
  41. model.ServiceId = s.ServiceId
  42. model.Name = s.Name
  43. model.Icon = s.Icon
  44. model.Path = s.Path
  45. model.MenuPath = s.MenuPath
  46. model.MenuType = s.MenuType
  47. model.Permission = s.Permission
  48. model.ParentId = s.ParentId
  49. model.Component = s.Component
  50. model.Sort = s.Sort
  51. model.Visible = s.Visible
  52. model.IsFrame = s.IsFrame
  53. if s.CreateBy != 0 {
  54. model.CreateBy = s.CreateBy
  55. }
  56. if s.UpdateBy != 0 {
  57. model.UpdateBy = s.UpdateBy
  58. }
  59. }
  60. func (s *ServMenuInsertReq) GetId() interface{} {
  61. return s.Id
  62. }
  63. type ServMenuUpdateReq struct {
  64. Id int `uri:"id" swaggerignore:"true"` //编码
  65. Name string `form:"name" example:"菜单名称"` //菜单名称
  66. Icon string `form:"icon" example:"app-group-fill"` //图标
  67. Path string `form:"path" example:"/admin"` //路径
  68. MenuPath string `form:"paths" swaggerignore:"true"` //id路径
  69. MenuType string `form:"menuType" example:"C"` //菜单类型 M-目录 C-菜单 F-按钮
  70. Permission string `form:"permission" example:"admin:sysUser:list"` //权限编码
  71. ParentId int `form:"parentId" example:"0"` //上级菜单
  72. Component string `form:"component" example:"/admin/sys-user/index"` //组件名称
  73. Sort int `form:"sort" example:"0"` //排序
  74. Visible string `form:"visible" example:"1"` //是否显示 1-显示 2-隐藏
  75. IsFrame string `form:"isFrame" example:"0"` //是否frame 1-是 2-否
  76. common.ControlBy `swaggerignore:"true"`
  77. }
  78. func (s *ServMenuUpdateReq) Generate(model *model.ServMenu) {
  79. if s.Id != 0 {
  80. model.Id = s.Id
  81. }
  82. model.Name = s.Name
  83. model.Icon = s.Icon
  84. model.Path = s.Path
  85. model.MenuPath = s.MenuPath
  86. model.MenuType = s.MenuType
  87. model.Permission = s.Permission
  88. model.ParentId = s.ParentId
  89. model.Component = s.Component
  90. model.Sort = s.Sort
  91. model.Visible = s.Visible
  92. model.IsFrame = s.IsFrame
  93. if s.CreateBy != 0 {
  94. model.CreateBy = s.CreateBy
  95. }
  96. if s.UpdateBy != 0 {
  97. model.UpdateBy = s.UpdateBy
  98. }
  99. }
  100. func (s *ServMenuUpdateReq) GetId() interface{} {
  101. return s.Id
  102. }
  103. type ServMenuGetReq struct {
  104. Id int `uri:"id"`
  105. }
  106. func (s *ServMenuGetReq) GetId() interface{} {
  107. return s.Id
  108. }
  109. type ServMenuDeleteReq struct {
  110. Ids []int `json:"ids"`
  111. common.ControlBy `swaggerignore:"true"`
  112. }
  113. func (s *ServMenuDeleteReq) GetId() interface{} {
  114. return s.Ids
  115. }
  116. type ServMenuLabel struct {
  117. Id int `json:"id,omitempty" gorm:"-"`
  118. Label string `json:"label,omitempty" gorm:"-"`
  119. Children []MenuLabel `json:"children,omitempty" gorm:"-"`
  120. }
  121. type ServMenuRole struct {
  122. model.ServMenu
  123. IsSelect bool `json:"is_select" gorm:"-"`
  124. }
  125. type AppSelectRole struct {
  126. RoleId int `uri:"roleId"`
  127. }
  128. type ServMenuExportReq struct {
  129. ServiceId int `form:"serviceId" example:"1"`
  130. Type string `form:"type" example:"json"` // json excel
  131. }