sys_post.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. package dto
  2. import (
  3. "cold-delivery/app/admin/model"
  4. "cold-delivery/common/dto"
  5. common "cold-delivery/common/model"
  6. )
  7. // SysPostGetPageReq 分页查询岗位请求
  8. type SysPostGetPageReq struct {
  9. dto.Pagination `search:"-"`
  10. PostName string `form:"postName" search:"type:contains;column:post_name;table:sys_post"` // 岗位名称
  11. PostCode string `form:"postCode" search:"type:contains;column:post_code;table:sys_post"` // 岗位编码
  12. Status string `form:"status" search:"type:exact;column:status;table:sys_post"` // 状态
  13. DeptId int `form:"deptId" search:"type:exact;column:dept_id;table:sys_post"` // 部门ID
  14. SysPostOrder
  15. }
  16. type SysPostOrder struct {
  17. SortOrder string `form:"sort" search:"type:order;column:sort;table:sys_post" default:"asc"`
  18. }
  19. func (m *SysPostGetPageReq) GetNeedSearch() interface{} {
  20. return *m
  21. }
  22. // SysPostInsertReq 新增岗位请求
  23. type SysPostInsertReq struct {
  24. Id int `json:"id" comment:"编码" swaggerignore:"true"`
  25. PostName string `json:"postName"` // 岗位名称
  26. PostCode string `json:"postCode"` // 岗位编码
  27. Sort int `json:"sort"` // 排序
  28. Status string `json:"status"` // 状态 1停用 2正常
  29. Remark string `json:"remark"` // 备注
  30. MenuIds []int `json:"menuIds"` // 菜单权限ID列表
  31. common.DeptBy
  32. common.ControlBy `swaggerignore:"true"`
  33. }
  34. func (s *SysPostInsertReq) Generate(model *model.SysPost) {
  35. if s.Id != 0 {
  36. model.Id = s.Id
  37. }
  38. model.PostName = s.PostName
  39. model.PostCode = s.PostCode
  40. model.Sort = s.Sort
  41. model.Status = s.Status
  42. model.Remark = s.Remark
  43. if model.Status == "" {
  44. model.Status = "2"
  45. }
  46. if s.ControlBy.UpdateBy != 0 {
  47. model.UpdateBy = s.UpdateBy
  48. }
  49. if s.ControlBy.CreateBy != 0 {
  50. model.CreateBy = s.CreateBy
  51. }
  52. model.DeptId = s.DeptId
  53. }
  54. func (s *SysPostInsertReq) GetId() interface{} {
  55. return s.Id
  56. }
  57. // SysPostUpdateReq 修改岗位请求
  58. type SysPostUpdateReq struct {
  59. Id int `json:"id" comment:"编码"` // 编码
  60. PostName string `json:"postName"` // 岗位名称
  61. PostCode string `json:"postCode"` // 岗位编码
  62. DeptId int `json:"deptId"` // 部门ID(支持修改部门)
  63. Sort int `json:"sort"` // 排序
  64. Status string `json:"status"` // 状态 1停用 2正常
  65. Remark string `json:"remark"` // 备注
  66. MenuIds []int `json:"menuIds"` // 菜单权限ID列表
  67. common.ControlBy `swaggerignore:"true"`
  68. }
  69. func (s *SysPostUpdateReq) Generate(model *model.SysPost) {
  70. if s.Id != 0 {
  71. model.Id = s.Id
  72. }
  73. model.PostName = s.PostName
  74. model.PostCode = s.PostCode
  75. model.Sort = s.Sort
  76. model.Status = s.Status
  77. model.Remark = s.Remark
  78. if model.Status == "" {
  79. model.Status = "2"
  80. }
  81. if s.DeptId != 0 {
  82. model.DeptId = s.DeptId
  83. }
  84. if s.ControlBy.UpdateBy != 0 {
  85. model.UpdateBy = s.UpdateBy
  86. }
  87. if s.ControlBy.CreateBy != 0 {
  88. model.CreateBy = s.CreateBy
  89. }
  90. }
  91. func (s *SysPostUpdateReq) GetId() interface{} {
  92. return s.Id
  93. }
  94. // SysPostGetReq 查询单个岗位请求
  95. type SysPostGetReq struct {
  96. Id int `uri:"id"`
  97. }
  98. func (s *SysPostGetReq) GetId() interface{} {
  99. return s.Id
  100. }
  101. // SysPostDeleteReq 删除岗位请求
  102. type SysPostDeleteReq struct {
  103. Id int `json:"id"`
  104. common.ControlBy `swaggerignore:"true"`
  105. }
  106. func (s *SysPostDeleteReq) GetId() interface{} {
  107. return s.Id
  108. }
  109. // SysPostMenuTreeResp 菜单树响应
  110. type SysPostMenuTreeResp struct {
  111. List []SysPostMenuLabel `json:"list"`
  112. }
  113. // SysPostMenuLabel 菜单树节点
  114. type SysPostMenuLabel struct {
  115. Id int `json:"id"`
  116. Label string `json:"label"`
  117. ParentId int `json:"parentId"`
  118. MenuType string `json:"menuType"`
  119. Children []SysPostMenuLabel `json:"children,omitempty"`
  120. }
  121. // SysPostMenuIdsResp 岗位已分配的菜单ID列表
  122. type SysPostMenuIdsResp struct {
  123. MenuIds []int `json:"menuIds"`
  124. }