feat:完善项目
This commit is contained in:
39
app/common/model/sys_role.go
Normal file
39
app/common/model/sys_role.go
Normal file
@ -0,0 +1,39 @@
|
||||
package model
|
||||
|
||||
type SysRole struct {
|
||||
Model
|
||||
ModelTenant
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:角色名" json:"name"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:null;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{}
|
||||
}
|
Reference in New Issue
Block a user