sys_menu.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package models
  2. import "go-admin/common/models"
  3. type SysMenu struct {
  4. MenuId int `json:"menuId" gorm:"primaryKey;autoIncrement"`
  5. MenuName string `json:"menuName" gorm:"size:128;"`
  6. Title string `json:"title" gorm:"size:128;"`
  7. Icon string `json:"icon" gorm:"size:128;"`
  8. Path string `json:"path" gorm:"size:128;"`
  9. Paths string `json:"paths" gorm:"size:128;"`
  10. MenuType string `json:"menuType" gorm:"size:1;"`
  11. Action string `json:"action" gorm:"size:16;"`
  12. Permission string `json:"permission" gorm:"size:255;"`
  13. ParentId int `json:"parentId" gorm:"size:11;"`
  14. NoCache bool `json:"noCache" gorm:"size:8;"`
  15. Breadcrumb string `json:"breadcrumb" gorm:"size:255;"`
  16. Component string `json:"component" gorm:"size:255;"`
  17. Sort int `json:"sort" gorm:"size:4;"`
  18. Visible string `json:"visible" gorm:"size:1;"`
  19. IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"`
  20. SysApi []SysApi `json:"sysApi" gorm:"many2many:sys_menu_api_rule"`
  21. Apis []int `json:"apis" gorm:"-"`
  22. DataScope string `json:"dataScope" gorm:"-"`
  23. Params string `json:"params" gorm:"-"`
  24. RoleId int `gorm:"-"`
  25. Children []SysMenu `json:"children,omitempty" gorm:"-"`
  26. IsSelect bool `json:"is_select" gorm:"-"`
  27. models.ControlBy
  28. models.ModelTime
  29. }
  30. type SysMenuSlice []SysMenu
  31. func (x SysMenuSlice) Len() int { return len(x) }
  32. func (x SysMenuSlice) Less(i, j int) bool { return x[i].Sort < x[j].Sort }
  33. func (x SysMenuSlice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
  34. func (SysMenu) TableName() string {
  35. return "sys_menu"
  36. }
  37. func (e *SysMenu) Generate() models.ActiveRecord {
  38. o := *e
  39. return &o
  40. }
  41. func (e *SysMenu) GetId() interface{} {
  42. return e.MenuId
  43. }