sys_role.go 4.6 KB

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