sys_api.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package dto
  2. import (
  3. "VberAdmin/app/system/models"
  4. "VberAdmin/common/dto"
  5. common "VberAdmin/common/models"
  6. )
  7. // SysApiGetPageReq 功能列表请求参数
  8. type SysApiGetPageReq struct {
  9. dto.Pagination `search:"-"`
  10. Title string `form:"title" search:"type:contains;column:title;table:sys_api" comment:"标题"`
  11. Path string `form:"path" search:"type:contains;column:path;table:sys_api" comment:"地址"`
  12. Action string `form:"action" search:"type:exact;column:action;table:sys_api" comment:"请求方式"`
  13. ParentId string `form:"parentId" search:"type:exact;column:parent_id;table:sys_api" comment:"按钮id"`
  14. Type string `form:"type" search:"-" comment:"类型"`
  15. SysApiOrder
  16. }
  17. type SysApiOrder struct {
  18. TitleOrder string `search:"type:order;column:title;table:sys_api" form:"titleOrder"`
  19. PathOrder string `search:"type:order;column:path;table:sys_api" form:"pathOrder"`
  20. ActionOrder string `search:"type:order;column:action;table:sys_api" form:"actionOrder"`
  21. TypeOrder string `search:"type:order;column:type;table:sys_api" form:"typeOrder"`
  22. CreatedAtOrder string `search:"type:order;column:created_at;table:sys_api" form:"createdAtOrder"`
  23. }
  24. func (m *SysApiGetPageReq) GetNeedSearch() interface{} {
  25. return *m
  26. }
  27. // SysApiInsertReq 功能创建请求参数
  28. type SysApiInsertReq struct {
  29. Id int `json:"-" comment:"编码"` // 编码
  30. Handle string `json:"handle" comment:"handle"`
  31. Title string `json:"title" comment:"标题"`
  32. Path string `json:"path" comment:"地址"`
  33. Type string `json:"type" comment:""`
  34. Action string `json:"action" comment:"类型"`
  35. common.ControlBy
  36. }
  37. func (s *SysApiInsertReq) Generate(model *models.SysApi) {
  38. model.Handle = s.Handle
  39. model.Title = s.Title
  40. model.Path = s.Path
  41. model.Type = s.Type
  42. model.Action = s.Action
  43. model.CreateBy = s.CreateBy
  44. }
  45. func (s *SysApiInsertReq) GetId() interface{} {
  46. return s.Id
  47. }
  48. // SysApiUpdateReq 功能更新请求参数
  49. type SysApiUpdateReq struct {
  50. Id int `uri:"id" comment:"编码"` // 编码
  51. Handle string `json:"handle" comment:"handle"`
  52. Title string `json:"title" comment:"标题"`
  53. Path string `json:"path" comment:"地址"`
  54. Type string `json:"type" comment:""`
  55. Action string `json:"action" comment:"类型"`
  56. common.ControlBy
  57. }
  58. func (s *SysApiUpdateReq) Generate(model *models.SysApi) {
  59. if s.Id != 0 {
  60. model.Id = s.Id
  61. }
  62. model.Handle = s.Handle
  63. model.Title = s.Title
  64. model.Path = s.Path
  65. model.Type = s.Type
  66. model.Action = s.Action
  67. model.UpdateBy = s.UpdateBy
  68. }
  69. func (s *SysApiUpdateReq) GetId() interface{} {
  70. return s.Id
  71. }
  72. // SysApiGetReq 功能获取请求参数
  73. type SysApiGetReq struct {
  74. Id int `uri:"id"`
  75. }
  76. func (s *SysApiGetReq) GetId() interface{} {
  77. return s.Id
  78. }
  79. // SysApiDeleteReq 功能删除请求参数
  80. type SysApiDeleteReq struct {
  81. Ids []int `json:"ids"`
  82. }
  83. func (s *SysApiDeleteReq) GetId() interface{} {
  84. return s.Ids
  85. }