sys_user.go 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. package dto
  2. import (
  3. "Medical_OAuth/app/admin/model"
  4. dto2 "Medical_OAuth/common/dto"
  5. model2 "Medical_OAuth/common/model"
  6. )
  7. type SysUserGetPageReq struct {
  8. dto2.Pagination `search:"-"`
  9. Username string `form:"username" search:"type:contains;column:username;table:sys_user" comment:"用户名"`
  10. NickName string `form:"nickName" search:"type:contains;column:nick_name;table:sys_user" comment:"昵称"`
  11. RoleId int `form:"roleId" search:"type:exact;column:role_id;table:sys_user" comment:"角色ID"`
  12. DeptId int `form:"deptId" search:"type:exact;column:dept_id;table:sys_user" comment:"部门ID"`
  13. PostId int `form:"postId" search:"type:exact;column:post_id;table:sys_user" comment:"岗位ID"`
  14. Status string `form:"status" search:"type:exact;column:status;table:sys_user" comment:"状态"`
  15. SysUserOrder
  16. }
  17. type SysUserOrder struct {
  18. //UserIdOrder string `search:"type:order;column:id;table:sys_user" form:"userIdOrder"`
  19. //UsernameOrder string `search:"type:order;column:username;table:sys_user" form:"usernameOrder"`
  20. //StatusOrder string `search:"type:order;column:status;table:sys_user" form:"statusOrder"`
  21. CreatedAtOrder string `search:"type:order;column:created_at;table:sys_user" form:"createdAtOrder" default:"desc"`
  22. }
  23. func (m *SysUserGetPageReq) GetNeedSearch() interface{} {
  24. return *m
  25. }
  26. type SysUserGetCountReq struct {
  27. RoleIds []int `form:"roleId" search:"type:in;column:role_id;table:sys_user" comment:"角色ID"`
  28. DeptIds []int `form:"deptId" search:"type:in;column:dept_id;table:sys_user" comment:"部门ID"`
  29. PostIds []int `form:"postId" search:"type:in;column:post_id;table:sys_user" comment:"岗位ID"`
  30. }
  31. func (m *SysUserGetCountReq) GetNeedSearch() interface{} {
  32. return *m
  33. }
  34. type ResetSysUserPwdReq struct {
  35. Id int `json:"id" example:"1" vd:"$>0"` // 用户ID
  36. Password string `json:"password" example:"123456" vd:"len($)>0"` // 密码
  37. model2.ControlBy `swaggerignore:"true"`
  38. }
  39. func (s *ResetSysUserPwdReq) GetId() interface{} {
  40. return s.Id
  41. }
  42. func (s *ResetSysUserPwdReq) Generate(userModel *model.SysUser) {
  43. if s.Id != 0 {
  44. userModel.Id = s.Id
  45. }
  46. userModel.Password = s.Password
  47. if s.ControlBy.UpdateBy != 0 {
  48. userModel.UpdateBy = s.UpdateBy
  49. }
  50. if s.ControlBy.CreateBy != 0 {
  51. userModel.CreateBy = s.CreateBy
  52. }
  53. }
  54. type UpdateSysUserStatusReq struct {
  55. Id int `json:"id" example:"1" vd:"$>0"` // 用户ID
  56. Status string `json:"status" example:"2" vd:"len($)>0"` // 状态 1-停用 2-正常
  57. model2.ControlBy `swaggerignore:"true"`
  58. }
  59. func (s *UpdateSysUserStatusReq) GetId() interface{} {
  60. return s.Id
  61. }
  62. func (s *UpdateSysUserStatusReq) Generate(userModel *model.SysUser) {
  63. if s.Id != 0 {
  64. userModel.Id = s.Id
  65. }
  66. userModel.Status = s.Status
  67. if s.ControlBy.UpdateBy != 0 {
  68. userModel.UpdateBy = s.UpdateBy
  69. }
  70. if s.ControlBy.CreateBy != 0 {
  71. userModel.CreateBy = s.CreateBy
  72. }
  73. }
  74. type SysUserInsertReq struct {
  75. Id int `json:"id" swaggerignore:"true" comment:"用户ID"` // 用户ID
  76. Username string `json:"username" example:"username" vd:"@:len($)>0 msg:'用户名不能为空'"` //用户名
  77. Password string `json:"password" example:"123456" vd:"@:len($)>5 msg:'密码格式不正确'"` //密码
  78. NickName string `json:"nickName" example:"姓名"` //姓名
  79. Phone string `json:"phone" example:"13912345678" swaggerignore:"true"` //手机号
  80. RoleId int `json:"roleId" example:"1" swaggerignore:"true" ` //角色id
  81. DeptId int `json:"deptId" example:"1" swaggerignore:"true"` //部门id
  82. PostId int `json:"postId" example:"1" swaggerignore:"true"` //岗位id
  83. Remark string `json:"remark" example:"备注" swaggerignore:"true"` // 备注
  84. Status string `json:"status" example:"2" swaggerignore:"true"` // 状态
  85. model2.ControlBy `swaggerignore:"true"`
  86. }
  87. func (s *SysUserInsertReq) Generate(userModel *model.SysUser) {
  88. if s.Id != 0 {
  89. userModel.Id = s.Id
  90. }
  91. userModel.Username = s.Username
  92. userModel.Password = s.Password
  93. userModel.NickName = s.NickName
  94. userModel.Phone = s.Phone
  95. userModel.RoleId = s.RoleId
  96. userModel.DeptId = s.DeptId
  97. userModel.Remark = s.Remark
  98. userModel.Status = s.Status
  99. if s.ControlBy.UpdateBy != 0 {
  100. userModel.UpdateBy = s.UpdateBy
  101. }
  102. if s.ControlBy.CreateBy != 0 {
  103. userModel.CreateBy = s.CreateBy
  104. }
  105. }
  106. func (s *SysUserInsertReq) GetId() interface{} {
  107. return s.Id
  108. }
  109. type SysUserUpdateReq struct {
  110. Id int `json:"id"` // 用户id
  111. NickName string `json:"nickName" example:"昵称"` // 昵称
  112. Phone string `json:"phone" example:"13988888888" swaggerignore:"true"` // 手机号
  113. RoleId int `json:"roleId" example:"1" swaggerignore:"true"` //角色id
  114. DeptId int `json:"deptId" example:"1" swaggerignore:"true"` //部门id
  115. PostId int `json:"postId" example:"1" swaggerignore:"true"` //岗位id
  116. Remark string `json:"remark" example:"备注" swaggerignore:"true"` // 备注
  117. Status string `json:"status" example:"2" swaggerignore:"true"` // 状态
  118. model2.ControlBy `swaggerignore:"true"`
  119. }
  120. func (s *SysUserUpdateReq) Generate(userModel *model.SysUser) {
  121. if s.Id != 0 {
  122. userModel.Id = s.Id
  123. }
  124. userModel.NickName = s.NickName
  125. userModel.Phone = s.Phone
  126. userModel.RoleId = s.RoleId
  127. userModel.DeptId = s.DeptId
  128. userModel.Remark = s.Remark
  129. userModel.Status = s.Status
  130. if s.ControlBy.UpdateBy != 0 {
  131. userModel.UpdateBy = s.UpdateBy
  132. }
  133. if s.ControlBy.CreateBy != 0 {
  134. userModel.CreateBy = s.CreateBy
  135. }
  136. }
  137. func (s *SysUserUpdateReq) GetId() interface{} {
  138. return s.Id
  139. }
  140. type SysUserGetReq struct {
  141. Id int `uri:"id"`
  142. }
  143. func (s *SysUserGetReq) GetId() interface{} {
  144. return s.Id
  145. }
  146. type SysUserDeleteReq struct {
  147. Id int `json:"id"`
  148. model2.ControlBy `swaggerignore:"true"`
  149. }
  150. func (s *SysUserDeleteReq) GetId() interface{} {
  151. return s.Id
  152. }
  153. type SysUserById struct {
  154. dto2.ObjectById
  155. model2.ControlBy `swaggerignore:"true"`
  156. }
  157. func (s *SysUserById) GetIds() interface{} {
  158. return s.Ids
  159. }
  160. func (s *SysUserById) GetId() interface{} {
  161. if len(s.Ids) > 0 {
  162. s.Ids = append(s.Ids, s.Id)
  163. return s.Ids
  164. }
  165. return s.Id
  166. }
  167. func (s *SysUserById) GenerateM() (model2.ActiveRecord, error) {
  168. return &model.SysUser{}, nil
  169. }
  170. // PassWord 密码
  171. type PassWord struct {
  172. NewPassword string `json:"newPassword" example:"123456" vd:"len($)>0"` // 新密码
  173. OldPassword string `json:"oldPassword" example:"12345678" vd:"len($)>0"` // 旧密码
  174. }
  175. type SysUserRegisterReq struct {
  176. Id int `json:"id" swaggerignore:"true" comment:"用户ID"` // 用户ID
  177. URKey string `json:"URKey" example:"jKEnYWNXyrOvTofU" vd:"@:len($)>0 msg:'注册码不能为空'"` //注册码
  178. Username string `json:"username" example:"username" vd:"@:len($)>0 msg:'用户名不能为空'"` //用户名
  179. Password string `json:"password" example:"123456" vd:"@:len($)>5 msg:'密码格式不正确'"` //密码
  180. NickName string `json:"nickName" swaggerignore:"true"` //昵称
  181. Phone string `json:"phone" example:"13912345678"` //手机号
  182. Code string `json:"code" example:"125478"` //短信验证码
  183. RoleId int `json:"roleId" swaggerignore:"true"` //角色id
  184. DeptId int `json:"deptId" swaggerignore:"true"` //部门id
  185. PostId int `json:"postId" swaggerignore:"true"` //岗位id
  186. Remark string `json:"remark" swaggerignore:"true"` // 备注
  187. Status string `json:"status" swaggerignore:"true"` // 状态
  188. model2.ControlBy `swaggerignore:"true"`
  189. }
  190. func (s *SysUserRegisterReq) Generate(userModel *model.SysUser) {
  191. if s.Id != 0 {
  192. userModel.Id = s.Id
  193. }
  194. userModel.Username = s.Username
  195. userModel.Password = s.Password
  196. userModel.NickName = s.NickName
  197. userModel.Phone = s.Phone
  198. userModel.RoleId = s.RoleId
  199. userModel.DeptId = s.DeptId
  200. userModel.Remark = s.Remark
  201. userModel.Status = s.Status
  202. if s.ControlBy.UpdateBy != 0 {
  203. userModel.UpdateBy = s.UpdateBy
  204. }
  205. if s.ControlBy.CreateBy != 0 {
  206. userModel.CreateBy = s.CreateBy
  207. }
  208. }
  209. func (s *SysUserRegisterReq) GetId() interface{} {
  210. return s.Id
  211. }
  212. type SysUserGetSMSVerifyCodeReq struct {
  213. Phone string `form:"phone" example:"13912345678"` //手机号
  214. }
  215. type GetNewestTokenReq struct {
  216. UserId int64 `uri:"userId" example:"1"` //手机号
  217. }