sys_api.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package dto
  2. import (
  3. "go-admin/app/admin/models"
  4. "go-admin/common/dto"
  5. common "go-admin/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. SysApiOrder
  15. }
  16. type SysApiOrder struct {
  17. TitleOrder string `search:"type:order;column:title;table:sys_api" form:"titleOrder"`
  18. PathOrder string `search:"type:order;column:path;table:sys_api" form:"pathOrder"`
  19. CreatedAtOrder string `search:"type:order;column:created_at;table:sys_api" form:"createdAtOrder"`
  20. }
  21. func (m *SysApiGetPageReq) GetNeedSearch() interface{} {
  22. return *m
  23. }
  24. // SysApiInsertReq 功能创建请求参数
  25. type SysApiInsertReq struct {
  26. Id int `json:"-" comment:"编码"` // 编码
  27. Handle string `json:"handle" comment:"handle"`
  28. Title string `json:"title" comment:"标题"`
  29. Path string `json:"path" comment:"地址"`
  30. Type string `json:"type" comment:""`
  31. Action string `json:"action" comment:"类型"`
  32. common.ControlBy
  33. }
  34. func (s *SysApiInsertReq) Generate(model *models.SysApi) {
  35. model.Handle = s.Handle
  36. model.Title = s.Title
  37. model.Path = s.Path
  38. model.Type = s.Type
  39. model.Action = s.Action
  40. }
  41. func (s *SysApiInsertReq) GetId() interface{} {
  42. return s.Id
  43. }
  44. // SysApiUpdateReq 功能更新请求参数
  45. type SysApiUpdateReq struct {
  46. Id int `uri:"id" comment:"编码"` // 编码
  47. Handle string `json:"handle" comment:"handle"`
  48. Title string `json:"title" comment:"标题"`
  49. Path string `json:"path" comment:"地址"`
  50. Type string `json:"type" comment:""`
  51. Action string `json:"action" comment:"类型"`
  52. common.ControlBy
  53. }
  54. func (s *SysApiUpdateReq) Generate(model *models.SysApi) {
  55. if s.Id != 0 {
  56. model.Id = s.Id
  57. }
  58. model.Handle = s.Handle
  59. model.Title = s.Title
  60. model.Path = s.Path
  61. model.Type = s.Type
  62. model.Action = s.Action
  63. }
  64. func (s *SysApiUpdateReq) GetId() interface{} {
  65. return s.Id
  66. }
  67. // SysApiGetReq 功能获取请求参数
  68. type SysApiGetReq struct {
  69. Id int `uri:"id"`
  70. }
  71. func (s *SysApiGetReq) GetId() interface{} {
  72. return s.Id
  73. }
  74. // SysApiDeleteReq 功能删除请求参数
  75. type SysApiDeleteReq struct {
  76. Ids []int `json:"ids"`
  77. }
  78. func (s *SysApiDeleteReq) GetId() interface{} {
  79. return s.Ids
  80. }