sys_user.go 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. package system
  2. import (
  3. "github.com/gogf/gf/v2/frame/g"
  4. commonApi "github.com/tiger1103/gfast/v3/api/v1/common"
  5. "github.com/tiger1103/gfast/v3/internal/app/system/model"
  6. "github.com/tiger1103/gfast/v3/internal/app/system/model/entity"
  7. )
  8. type UserMenusReq struct {
  9. g.Meta `path:"/user/getUserMenus" tags:"用户管理" method:"get" summary:"获取用户菜单"`
  10. commonApi.Author
  11. }
  12. type UserMenusRes struct {
  13. g.Meta `mime:"application/json"`
  14. MenuList []*model.UserMenus `json:"menuList"`
  15. Permissions []string `json:"permissions"`
  16. }
  17. // UserSearchReq 用户搜索请求参数
  18. type UserSearchReq struct {
  19. g.Meta `path:"/user/list" tags:"用户管理" method:"get" summary:"用户列表"`
  20. DeptId string `p:"deptId"` //部门id
  21. Mobile string `p:"mobile"`
  22. Status string `p:"status"`
  23. KeyWords string `p:"keyWords"`
  24. commonApi.PageReq
  25. commonApi.Author
  26. }
  27. type UserSearchRes struct {
  28. g.Meta `mime:"application/json"`
  29. UserList []*model.SysUserRoleDeptRes `json:"userList"`
  30. commonApi.ListRes
  31. }
  32. type UserGetParamsReq struct {
  33. g.Meta `path:"/user/params" tags:"用户管理" method:"get" summary:"用户维护参数获取"`
  34. }
  35. type UserGetParamsRes struct {
  36. g.Meta `mime:"application/json"`
  37. RoleList []*entity.SysRole `json:"roleList"`
  38. Posts []*entity.SysPost `json:"posts"`
  39. }
  40. // SetUserReq 添加修改用户公用请求字段
  41. type SetUserReq struct {
  42. DeptId uint64 `p:"deptId" v:"required#用户部门不能为空"` //所属部门
  43. Email string `p:"email" v:"email#邮箱格式错误"` //邮箱
  44. NickName string `p:"nickName" v:"required#用户昵称不能为空"`
  45. Mobile string `p:"mobile" v:"required|phone#手机号不能为空|手机号格式错误"`
  46. PostIds []int64 `p:"postIds"`
  47. Remark string `p:"remark"`
  48. RoleIds []int64 `p:"roleIds"`
  49. Sex int `p:"sex"`
  50. Status uint `p:"status"`
  51. IsAdmin int `p:"isAdmin"` // 是否后台管理员 1 是 0 否
  52. }
  53. // UserAddReq 添加用户参数
  54. type UserAddReq struct {
  55. g.Meta `path:"/user/add" tags:"用户管理" method:"post" summary:"添加用户"`
  56. *SetUserReq
  57. UserName string `p:"userName" v:"required#用户账号不能为空"`
  58. Password string `p:"password" v:"required|password#密码不能为空|密码以字母开头,只能包含字母、数字和下划线,长度在6~18之间"`
  59. UserSalt string
  60. }
  61. type UserAddRes struct {
  62. }
  63. // UserEditReq 修改用户参数
  64. type UserEditReq struct {
  65. g.Meta `path:"/user/edit" tags:"用户管理" method:"put" summary:"修改用户"`
  66. *SetUserReq
  67. UserId int64 `p:"userId" v:"required#用户id不能为空"`
  68. }
  69. type UserEditRes struct {
  70. }
  71. type UserGetEditReq struct {
  72. g.Meta `path:"/user/getEdit" tags:"用户管理" method:"get" summary:"获取用户信息"`
  73. Id uint64 `p:"id"`
  74. }
  75. type UserGetEditRes struct {
  76. g.Meta `mime:"application/json"`
  77. User *entity.SysUser `json:"user"`
  78. CheckedRoleIds []uint `json:"checkedRoleIds"`
  79. CheckedPosts []int64 `json:"checkedPosts"`
  80. }
  81. // UserResetPwdReq 重置用户密码状态参数
  82. type UserResetPwdReq struct {
  83. g.Meta `path:"/user/resetPwd" tags:"用户管理" method:"put" summary:"重置用户密码"`
  84. Id uint64 `p:"userId" v:"required#用户id不能为空"`
  85. Password string `p:"password" v:"required|password#密码不能为空|密码以字母开头,只能包含字母、数字和下划线,长度在6~18之间"`
  86. }
  87. type UserResetPwdRes struct {
  88. }
  89. // UserStatusReq 设置用户状态参数
  90. type UserStatusReq struct {
  91. g.Meta `path:"/user/setStatus" tags:"用户管理" method:"put" summary:"设置用户状态"`
  92. Id uint64 `p:"userId" v:"required#用户id不能为空"`
  93. UserStatus uint `p:"status" v:"required#用户状态不能为空"`
  94. }
  95. type UserStatusRes struct {
  96. }
  97. type UserDeleteReq struct {
  98. g.Meta `path:"/user/delete" tags:"用户管理" method:"delete" summary:"删除用户"`
  99. Ids []int `p:"ids" v:"required#ids不能为空"`
  100. }
  101. type UserDeleteRes struct {
  102. }
  103. type UserGetByIdsReq struct {
  104. g.Meta `path:"/user/getUsers" tags:"用户管理" method:"get" summary:"同时获取多个用户"`
  105. commonApi.Author
  106. Ids []int `p:"ids" v:"required#ids不能为空"`
  107. }
  108. type UserGetByIdsRes struct {
  109. g.Meta `mime:"application/json"`
  110. List []*model.SysUserSimpleRes `json:"list"`
  111. }