sys_register_auth.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. package dto
  2. import (
  3. "Medical_OAuth/app/admin/model"
  4. "Medical_OAuth/common/dto"
  5. common "Medical_OAuth/common/model"
  6. )
  7. // SysRegisterAuthPageReq 列表或者搜索使用结构体
  8. type SysRegisterAuthPageReq struct {
  9. dto.Pagination `search:"-"`
  10. URKey string `form:"URKey" search:"type:contains;column:ur_key;table:sys_register_auth"` // 名称
  11. Status int `form:"status" search:"type:exact;column:status;table:sys_register_auth"` // 状态
  12. }
  13. func (m *SysRegisterAuthPageReq) GetNeedSearch() interface{} {
  14. return *m
  15. }
  16. // SysRegisterAuthInsertReq 增使用的结构体
  17. type SysRegisterAuthInsertReq struct {
  18. Id int `json:"id" swaggerignore:"true"`
  19. URKey string `swaggerignore:"true"`
  20. RoleId int `json:"roleId" vd:"$>0" example:"2"` //角色id
  21. DeptId int `json:"deptId" vd:"$>0" example:"2"` // 部门id
  22. Status int `json:"status" vd:"$>0" example:"2"` // 状态 1-停用 2-正常
  23. SMSVerify int `json:"SMSVerify" vd:"$>0" example:"2"` // 短信验证 1-关闭 2-开启
  24. InviteCode string `json:"inviteCode" example:"HnhsqMls"` // 邀请码,可以为空
  25. common.ControlBy `swaggerignore:"true"`
  26. }
  27. func (s *SysRegisterAuthInsertReq) Generate(model *model.SysRegisterAuth) {
  28. if s.Id != 0 {
  29. model.Id = s.Id
  30. }
  31. if len(s.URKey) > 0 {
  32. model.URKey = s.URKey
  33. }
  34. model.RoleId = s.RoleId
  35. model.DeptId = s.DeptId
  36. model.Status = s.Status
  37. model.SMSVerify = s.SMSVerify
  38. model.InviteCode = s.InviteCode
  39. if s.ControlBy.UpdateBy != 0 {
  40. model.UpdateBy = s.UpdateBy
  41. }
  42. if s.ControlBy.CreateBy != 0 {
  43. model.CreateBy = s.CreateBy
  44. }
  45. }
  46. // GetId 获取数据对应的ID
  47. func (s *SysRegisterAuthInsertReq) GetId() interface{} {
  48. return s.Id
  49. }
  50. // SysRegisterAuthUpdateReq 改使用的结构体
  51. type SysRegisterAuthUpdateReq struct {
  52. Id int `uri:"id" swaggerignore:"true"`
  53. RoleId int `json:"roleId" vd:"$>0" example:"2"` //角色id
  54. DeptId int `json:"deptId" vd:"$>0" example:"2"` // 部门id
  55. Status int `json:"status" vd:"$>0" example:"2"` // 状态 1-停用 2-正常
  56. SMSVerify int `json:"SMSVerify" vd:"$>0" example:"2"` // 短信验证 1-关闭 2-开启
  57. InviteCode string `json:"inviteCode" example:"HnhsqMls"` // 邀请码,可以为空
  58. common.ControlBy `swaggerignore:"true"`
  59. }
  60. func (s *SysRegisterAuthUpdateReq) Generate(model *model.SysRegisterAuth) {
  61. model.Id = s.Id
  62. model.RoleId = s.RoleId
  63. model.DeptId = s.DeptId
  64. model.Status = s.Status
  65. model.SMSVerify = s.SMSVerify
  66. model.InviteCode = s.InviteCode
  67. if s.ControlBy.UpdateBy != 0 {
  68. model.UpdateBy = s.UpdateBy
  69. }
  70. if s.ControlBy.CreateBy != 0 {
  71. model.CreateBy = s.CreateBy
  72. }
  73. }
  74. func (s *SysRegisterAuthUpdateReq) GetId() interface{} {
  75. return s.Id
  76. }
  77. // SysRegisterAuthGetReq 获取单个的结构体
  78. type SysRegisterAuthGetReq struct {
  79. Id int `uri:"id"`
  80. }
  81. func (s *SysRegisterAuthGetReq) GetId() interface{} {
  82. return s.Id
  83. }
  84. // SysRegisterAuthDeleteReq 删除的结构体
  85. type SysRegisterAuthDeleteReq struct {
  86. Id int `json:"id"`
  87. common.ControlBy `swaggerignore:"true"`
  88. }
  89. func (s *SysRegisterAuthDeleteReq) Generate(model *model.SysRegisterAuth) {
  90. if s.ControlBy.UpdateBy != 0 {
  91. model.UpdateBy = s.UpdateBy
  92. }
  93. if s.ControlBy.CreateBy != 0 {
  94. model.CreateBy = s.CreateBy
  95. }
  96. }
  97. func (s *SysRegisterAuthDeleteReq) GetId() interface{} {
  98. return s.Id
  99. }