sys_auth_rule.go 3.6 KB

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