zhangqian
2023-08-26 5193dcb9336e853502baf8a539d3f45efebe2f86
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package system
 
import (
    "time"
)
 
type SysAuthority struct {
    CreatedAt       time.Time       // 创建时间
    UpdatedAt       time.Time       // 更新时间
    DeletedAt       *time.Time      `sql:"index"`
    AuthorityId     uint            `json:"authorityId" gorm:"not null;unique;primary_key;comment:角色ID;size:90"` // 角色ID
    AuthorityName   string          `json:"authorityName" gorm:"comment:角色名"`                                    // 角色名
    ParentId        *uint           `json:"parentId" gorm:"comment:父角色ID"`                                       // 父角色ID
    DataAuthorityId []*SysAuthority `json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id;"`
    Children        []SysAuthority  `json:"children" gorm:"-"`
    SysBaseMenus    []SysBaseMenu   `json:"menus" gorm:"many2many:sys_authority_menus;"`
    Users           []SysUser       `json:"-" gorm:"many2many:sys_user_authority;"`
    DefaultRouter   string          `json:"defaultRouter" gorm:"comment:默认菜单;default:dashboard"` // 默认菜单(默认dashboard)
}
 
func (SysAuthority) TableName() string {
    return "sys_authorities"
}