2021-06-07 17:22:07 +08:00
|
|
|
|
package entity
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
2022-06-02 17:41:11 +08:00
|
|
|
|
"mayfly-go/pkg/model"
|
2021-06-07 17:22:07 +08:00
|
|
|
|
"time"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2021-07-28 18:03:19 +08:00
|
|
|
|
const (
|
|
|
|
|
|
RoleTypeCommon int = 1 // 公共角色类型
|
|
|
|
|
|
RoleTypeSpecial int = 2 // 特殊角色类型
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2021-06-07 17:22:07 +08:00
|
|
|
|
type Role struct {
|
|
|
|
|
|
model.Model
|
2025-02-13 21:11:23 +08:00
|
|
|
|
Status int `json:"status" gorm:"not null;"` // 1:可用;-1:不可用
|
|
|
|
|
|
Name string `json:"name" gorm:"size:32;not null;"`
|
|
|
|
|
|
Remark string `json:"remark" gorm:"size:255;not null;"`
|
|
|
|
|
|
Code string `json:"code" gorm:"size:64;not null;"`
|
|
|
|
|
|
Type int8 `json:"type" gorm:"not null;comment:类型:1:公共角色;2:特殊角色;"`
|
2021-07-28 18:03:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *Role) TableName() string {
|
|
|
|
|
|
return "t_sys_role"
|
2021-06-07 17:22:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 角色资源
|
|
|
|
|
|
type RoleResource struct {
|
2023-07-20 22:41:13 +08:00
|
|
|
|
model.DeletedModel
|
|
|
|
|
|
|
2025-02-13 21:11:23 +08:00
|
|
|
|
RoleId uint64 `json:"roleId" gorm:"not null;"`
|
|
|
|
|
|
ResourceId uint64 `json:"resourceId" gorm:"not null;"`
|
|
|
|
|
|
CreateTime *time.Time `json:"createTime" gorm:"not null;"`
|
|
|
|
|
|
CreatorId uint64 `json:"creatorId" gorm:"not null;"`
|
|
|
|
|
|
Creator string `json:"creator" gorm:"size:32;not null;"`
|
2021-06-07 17:22:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-07-28 18:03:19 +08:00
|
|
|
|
func (a *RoleResource) TableName() string {
|
|
|
|
|
|
return "t_sys_role_resource"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-06-07 17:22:07 +08:00
|
|
|
|
// 账号角色
|
|
|
|
|
|
type AccountRole struct {
|
2023-07-20 22:41:13 +08:00
|
|
|
|
model.DeletedModel
|
|
|
|
|
|
|
2025-02-13 21:11:23 +08:00
|
|
|
|
AccountId uint64 `json:"accountId" gorm:"not null;"`
|
|
|
|
|
|
RoleId uint64 `json:"roleId" gorm:"not null;"`
|
|
|
|
|
|
CreateTime *time.Time `json:"createTime" gorm:"not null;"`
|
|
|
|
|
|
CreatorId uint64 `json:"creatorId" gorm:"not null;"`
|
|
|
|
|
|
Creator string `json:"creator" gorm:"size:32;not null;"`
|
2021-06-07 17:22:07 +08:00
|
|
|
|
}
|
2021-07-28 18:03:19 +08:00
|
|
|
|
|
|
|
|
|
|
func (a *AccountRole) TableName() string {
|
|
|
|
|
|
return "t_sys_account_role"
|
|
|
|
|
|
}
|