40 lines
1001 B
Go
40 lines
1001 B
Go
package model
|
|
|
|
type SysRole struct {
|
|
Model
|
|
ModelTenant
|
|
Name string `gorm:"column:name;type:varchar(30);default:'';comment:角色名" json:"name"`
|
|
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:角色备注" json:"remark"`
|
|
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序" json:"-"`
|
|
Status SysRoleStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"-"`
|
|
ModelDeleted
|
|
ModelAt
|
|
}
|
|
|
|
// SysRoleStatus 角色状态
|
|
type SysRoleStatus int
|
|
|
|
const (
|
|
// SysRoleStatusForNormal 正常
|
|
SysRoleStatusForNormal SysRoleStatus = iota + 1
|
|
// SysRoleStatusForDisable 禁用
|
|
SysRoleStatusForDisable
|
|
)
|
|
|
|
func (m *SysRole) TableName() string {
|
|
return m.NewTableName("sys_role")
|
|
}
|
|
|
|
func (m *SysRole) StatusTitle() string {
|
|
if m.Status == SysRoleStatusForNormal {
|
|
return "正常"
|
|
} else if m.Status == SysRoleStatusForDisable {
|
|
return "禁用"
|
|
}
|
|
return "-"
|
|
}
|
|
|
|
func NewSysRole() *SysRole {
|
|
return &SysRole{}
|
|
}
|