权限表

This commit is contained in:
苏尹岚
2020-09-26 16:54:30 +08:00
parent f3117c6d38
commit 36c84d494d
2 changed files with 23 additions and 1 deletions

View File

@@ -226,7 +226,14 @@ func (*Role) TableUnique() [][]string {
type UserRole struct { type UserRole struct {
ModelIDCULD ModelIDCULD
Name string `json:"name"` //角色名 UserID string `orm:"column(user_id)" json:"userID"` //用户ID
RoleID int `orm:"column(role_id)" json:"roleID"` //角色ID
}
func (*UserRole) TableUnique() [][]string {
return [][]string{
[]string{"UserID", "RoleID"},
}
} }
type Function struct { type Function struct {
@@ -244,3 +251,16 @@ func (*Function) TableUnique() [][]string {
[]string{"Name"}, []string{"Name"},
} }
} }
type RoleFunction struct {
ModelIDCULD
RoleID int `orm:"column(role_id)" json:"roleID"` //角色ID
FunctionID int `orm:"column(function_id)" json:"functionID"` //功能ID
}
func (*RoleFunction) TableUnique() [][]string {
return [][]string{
[]string{"FunctionID", "RoleID"},
}
}

View File

@@ -85,6 +85,8 @@ func Init() {
orm.RegisterModel(&model.FakeJdThingMap{}) orm.RegisterModel(&model.FakeJdThingMap{})
//权限
// orm.RegisterModel(&model)
// create table // create table
orm.RunSyncdb("default", false, true) orm.RunSyncdb("default", false, true)
} }