sys_api.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package dto
  2. import (
  3. "IotAdmin/app/system/models"
  4. "IotAdmin/common/dto"
  5. common "IotAdmin/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. }
  44. func (s *SysApiInsertReq) GetId() interface{} {
  45. return s.Id
  46. }
  47. // SysApiUpdateReq 功能更新请求参数
  48. type SysApiUpdateReq struct {
  49. Id int `uri:"id" comment:"编码"` // 编码
  50. Handle string `json:"handle" comment:"handle"`
  51. Title string `json:"title" comment:"标题"`
  52. Path string `json:"path" comment:"地址"`
  53. Type string `json:"type" comment:""`
  54. Action string `json:"action" comment:"类型"`
  55. common.ControlBy
  56. }
  57. func (s *SysApiUpdateReq) Generate(model *models.SysApi) {
  58. if s.Id != 0 {
  59. model.Id = s.Id
  60. }
  61. model.Handle = s.Handle
  62. model.Title = s.Title
  63. model.Path = s.Path
  64. model.Type = s.Type
  65. model.Action = s.Action
  66. }
  67. func (s *SysApiUpdateReq) GetId() interface{} {
  68. return s.Id
  69. }
  70. // SysApiGetReq 功能获取请求参数
  71. type SysApiGetReq struct {
  72. Id int `uri:"id"`
  73. }
  74. func (s *SysApiGetReq) GetId() interface{} {
  75. return s.Id
  76. }
  77. // SysApiDeleteReq 功能删除请求参数
  78. type SysApiDeleteReq struct {
  79. Ids []int `json:"ids"`
  80. }
  81. func (s *SysApiDeleteReq) GetId() interface{} {
  82. return s.Ids
  83. }