role.go 819 B

1234567891011121314151617181920
  1. package dao
  2. // Role 角色
  3. type Role struct {
  4. ID int64 `gorm:"primary_key" json:"id"` //编号
  5. TenantId string `gorm:"type:varchar(12);default '000000'" json:"tenantId"` //租户id
  6. ParentId int64 `gorm:"type:bigint" json:"parentId"` //父主键
  7. RoleName string `gorm:"type:varchar(255)" json:"roleName"` //角色别名
  8. Sort int `gorm:"type:int" json:"sort"` //排序
  9. RoleAlias string `gorm:"type:varchar(255)" json:"roleAlias"` //角色别名
  10. IsDeleted int `gorm:"type:int" json:"isDeleted"` //是否删除
  11. }
  12. func (Role) TableName() string {
  13. return "role"
  14. }
  15. func (c *Role) GetRole() error {
  16. return Db.Model(&c).Where("id = ?", c.ID).Find(&c).Error
  17. }