sys_role.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. package dto
  2. import (
  3. "gas-cylinder-api/app/admin/model"
  4. "gas-cylinder-api/common/dto"
  5. common "gas-cylinder-api/common/model"
  6. )
  7. type SysRoleGetPageReq struct {
  8. dto.Pagination `search:"-"`
  9. Name string `form:"name" search:"type:contains;column:name;table:sys_role"` // 角色名称
  10. SysRoleOrder
  11. }
  12. type SysRoleOrder struct {
  13. SortOrder string `form:"sort" search:"type:order;column:sort;table:sys_role" default:"asc"`
  14. }
  15. func (m *SysRoleGetPageReq) GetNeedSearch() interface{} {
  16. return *m
  17. }
  18. type SysRoleInsertReq struct {
  19. Id int `uri:"id" swaggerignore:"true" swaggerignore:"true"` // 角色编码
  20. Name string `form:"roleName" example:"管理员"` // 角色名称
  21. Status string `form:"status" example:"2"` // 状态 1-停用 2-正常
  22. RoleKey string `form:"roleKey" swaggerignore:"true"` // 角色代码
  23. Sort int `form:"roleSort" example:"0"` // 角色排序
  24. DataScope int `form:"dataScope" example:"1"` // 数据权限 1-全部数据权限 3-本机构数据权限 4-本机构及以下数据权限 5-仅本人数据权限
  25. Remark string `form:"remark" example:"备注"` // 备注
  26. common.ControlBy `swaggerignore:"true"`
  27. }
  28. func (s *SysRoleInsertReq) Generate(model *model.SysRole) {
  29. if s.Id != 0 {
  30. model.Id = s.Id
  31. }
  32. model.Name = s.Name
  33. model.Status = s.Status
  34. model.RoleKey = s.RoleKey
  35. model.Sort = s.Sort
  36. model.DataScope = s.DataScope
  37. model.Remark = s.Remark
  38. if s.ControlBy.UpdateBy != 0 {
  39. model.UpdateBy = s.UpdateBy
  40. }
  41. if s.ControlBy.CreateBy != 0 {
  42. model.CreateBy = s.CreateBy
  43. }
  44. }
  45. func (s *SysRoleInsertReq) GetId() interface{} {
  46. return s.Id
  47. }
  48. type SysRoleUpdateReq struct {
  49. Id int `uri:"id" comment:"角色编码" swaggerignore:"true"` // 角色编码
  50. Name string `form:"roleName" example:"管理员"` // 角色名称
  51. Status string `form:"status" example:"2"` // 状态 1-停用 2-正常
  52. Sort int `form:"roleSort" example:"0"` // 角色排序
  53. DataScope int `form:"dataScope" example:"1"` // 数据权限 1-全部数据权限 3-本机构数据权限 4-本机构及以下数据权限 5-仅本人数据权限
  54. Remark string `form:"remark" example:"备注"` // 备注
  55. common.ControlBy `swaggerignore:"true"`
  56. }
  57. func (s *SysRoleUpdateReq) Generate(model *model.SysRole) {
  58. if s.Id != 0 {
  59. model.Id = s.Id
  60. }
  61. model.Name = s.Name
  62. model.Status = s.Status
  63. model.Sort = s.Sort
  64. model.DataScope = s.DataScope
  65. model.Remark = s.Remark
  66. if s.ControlBy.UpdateBy != 0 {
  67. model.UpdateBy = s.UpdateBy
  68. }
  69. if s.ControlBy.CreateBy != 0 {
  70. model.CreateBy = s.CreateBy
  71. }
  72. }
  73. func (s *SysRoleUpdateReq) GetId() interface{} {
  74. return s.Id
  75. }
  76. type SysRoleByName struct {
  77. RoleName string `form:"role"` // 角色编码
  78. }
  79. type SysRoleGetReq struct {
  80. Id int `uri:"id"`
  81. }
  82. func (s *SysRoleGetReq) GetId() interface{} {
  83. return s.Id
  84. }
  85. type SysRoleDeleteReq struct {
  86. Id int `json:"id"`
  87. common.ControlBy `swaggerignore:"true"`
  88. }
  89. func (s *SysRoleDeleteReq) GetId() interface{} {
  90. return s.Id
  91. }
  92. type DeptIdList struct {
  93. DeptId int `json:"Id"`
  94. }
  95. type SysRoleUpdateRoleApiReq struct {
  96. Id int `uri:"id" comment:"角色编码" swaggerignore:"true"` // 角色编码
  97. ServiceId int `json:"serviceId" example:"1"` // 服务id
  98. ApiIds []int `json:"apiIds" example:"1,2,3"` // api路由 id
  99. common.ControlBy `swaggerignore:"true"`
  100. }
  101. func (s *SysRoleUpdateRoleApiReq) GetId() interface{} {
  102. return s.Id
  103. }
  104. type SysRoleGetRoleApiListReq struct {
  105. Id int `uri:"id" comment:"角色编码" swaggerignore:"true"` // 角色编码
  106. ServiceId int `form:"serviceId" example:"1"` // 服务id
  107. }
  108. func (s *SysRoleGetRoleApiListReq) GetId() interface{} {
  109. return s.Id
  110. }
  111. type SysRoleUpdateRoleMenuReq struct {
  112. Id int `uri:"id" comment:"角色编码" swaggerignore:"true"` // 角色编码
  113. MenuIds []int `json:"menuIds" example:"1,2,3"` // 系统菜单id
  114. common.ControlBy `swaggerignore:"true"`
  115. }
  116. func (s *SysRoleUpdateRoleMenuReq) GetId() interface{} {
  117. return s.Id
  118. }
  119. type SysRoleGetRoleMenuListReq struct {
  120. Id int `uri:"id" comment:"角色编码" swaggerignore:"true"` // 角色编码
  121. }
  122. func (s *SysRoleGetRoleMenuListReq) GetId() interface{} {
  123. return s.Id
  124. }
  125. type SysRoleGetRoleMenuListResp struct {
  126. MenuIds []int `json:"menuIds"`
  127. }