sys_role.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package models
  2. import "go-admin/common/models"
  3. type SysRole struct {
  4. RoleId int `json:"roleId" gorm:"primaryKey;autoIncrement"` // 角色编码
  5. RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称
  6. Status string `json:"status" gorm:"size:4;"` //
  7. RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码
  8. RoleSort int `json:"roleSort" gorm:""` //角色排序
  9. Flag string `json:"flag" gorm:"size:128;"` //
  10. Remark string `json:"remark" gorm:"size:255;"` //备注
  11. Admin bool `json:"admin" gorm:"size:4;"`
  12. DataScope string `json:"dataScope" gorm:"size:128;"`
  13. Params string `json:"params" gorm:"-"`
  14. MenuIds []int `json:"menuIds" gorm:"-"`
  15. DeptIds []int `json:"deptIds" gorm:"-"`
  16. SysDept []SysDept `json:"sysDept" gorm:"many2many:sys_role_dept;foreignKey:RoleId;joinForeignKey:role_id;references:DeptId;joinReferences:dept_id;"`
  17. SysMenu *[]SysMenu `json:"sysMenu" gorm:"many2many:sys_role_menu;foreignKey:RoleId;joinForeignKey:role_id;references:MenuId;joinReferences:menu_id;"`
  18. models.ControlBy
  19. models.ModelTime
  20. }
  21. func (SysRole) TableName() string {
  22. return "sys_role"
  23. }
  24. func (e *SysRole) Generate() models.ActiveRecord {
  25. o := *e
  26. return &o
  27. }
  28. func (e *SysRole) GetId() interface{} {
  29. return e.RoleId
  30. }