sys_auth_rule.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * @desc:菜单api
  3. * @company:云南奇讯科技有限公司
  4. * @Author: yixiaohu<yxh669@qq.com>
  5. * @Date: 2022/3/18 10:27
  6. */
  7. package system
  8. import (
  9. "github.com/gogf/gf/v2/frame/g"
  10. "github.com/tiger1103/gfast/v3/internal/app/system/model"
  11. "github.com/tiger1103/gfast/v3/internal/app/system/model/entity"
  12. )
  13. type RuleSearchReq struct {
  14. g.Meta `path:"/menu/list" tags:"菜单管理" method:"get" summary:"菜单列表"`
  15. Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
  16. Title string `p:"menuName" `
  17. Component string `p:"component"`
  18. }
  19. type RuleListRes struct {
  20. g.Meta `mime:"application/json"`
  21. Rules []*model.SysAuthRuleTreeRes `json:"rules"`
  22. }
  23. type RuleAddReq struct {
  24. g.Meta `path:"/menu/add" tags:"菜单管理" method:"post" summary:"添加菜单"`
  25. Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
  26. MenuType uint `p:"menuType" v:"min:0|max:2#菜单类型最小值为:min|菜单类型最大值为:max"`
  27. Pid uint `p:"parentId" v:"min:0"`
  28. Name string `p:"name" v:"required#请填写规则名称"`
  29. Title string `p:"menuName" v:"required|length:1,100#请填写标题|标题长度在:min到:max位"`
  30. Icon string `p:"icon"`
  31. Weigh int `p:"menuSort" `
  32. Condition string `p:"condition" `
  33. Remark string `p:"remark" `
  34. IsHide uint `p:"isHide"`
  35. Path string `p:"path"`
  36. Redirect string `p:"redirect"` // 路由重定向
  37. Roles []uint `p:"roles"` // 角色ids
  38. Component string `p:"component" v:"required-if:menuType,1#组件路径不能为空"`
  39. IsLink uint `p:"isLink"`
  40. IsIframe uint `p:"isIframe"`
  41. IsCached uint `p:"isKeepAlive"`
  42. IsAffix uint `p:"isAffix"`
  43. LinkUrl string `p:"linkUrl"`
  44. }
  45. type RuleAddRes struct {
  46. }
  47. type RuleGetParamsReq struct {
  48. g.Meta `path:"/menu/getParams" tags:"菜单管理" method:"get" summary:"获取添加、编辑菜单相关参数"`
  49. Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
  50. }
  51. type RuleGetParamsRes struct {
  52. g.Meta `mime:"application/json"`
  53. Roles []*entity.SysRole `json:"roles"`
  54. Menus []*model.SysAuthRuleInfoRes `json:"menus"`
  55. }
  56. type RuleInfoReq struct {
  57. g.Meta `path:"/menu/get" tags:"菜单管理" method:"get" summary:"获取菜单信息"`
  58. Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
  59. Id uint `p:"required#菜单id必须"`
  60. }
  61. type RuleInfoRes struct {
  62. g.Meta `mime:"application/json"`
  63. Rule *entity.SysAuthRule `json:"rule"`
  64. RoleIds []uint `json:"roleIds"`
  65. }
  66. type RuleUpdateReq struct {
  67. g.Meta `path:"/menu/update" tags:"菜单管理" method:"put" summary:"修改菜单"`
  68. Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
  69. Id uint `p:"id" v:"required#id必须"`
  70. MenuType uint `p:"menuType" v:"min:0|max:2#菜单类型最小值为:min|菜单类型最大值为:max"`
  71. Pid uint `p:"parentId" v:"min:0"`
  72. Name string `p:"name" v:"required#请填写规则名称"`
  73. Title string `p:"menuName" v:"required|length:1,100#请填写标题|标题长度在:min到:max位"`
  74. Icon string `p:"icon"`
  75. Weigh int `p:"menuSort" `
  76. Condition string `p:"condition" `
  77. Remark string `p:"remark" `
  78. IsHide uint `p:"isHide"`
  79. Path string `p:"path"`
  80. Redirect string `p:"redirect"` // 路由重定向
  81. Roles []uint `p:"roles"` // 角色ids
  82. Component string `p:"component" v:"required-if:menuType,1#组件路径不能为空"`
  83. IsLink uint `p:"isLink"`
  84. IsIframe uint `p:"isIframe"`
  85. IsCached uint `p:"isKeepAlive"`
  86. IsAffix uint `p:"isAffix"`
  87. LinkUrl string `p:"linkUrl"`
  88. }
  89. type RuleUpdateRes struct {
  90. }
  91. type RuleDeleteReq struct {
  92. g.Meta `path:"/menu/delete" tags:"菜单管理" method:"delete" summary:"删除菜单"`
  93. Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
  94. Ids []int `p:"ids" v:"required#菜单id必须"`
  95. }
  96. type RuleDeleteRes struct {
  97. }