后台权限组详情/授权菜单接口等等
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// ldap_casbin_rule 权限表
|
||||
type LdapCasbinRule struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
V0 *string `gorm:"default:'';" json:"v0"` //
|
||||
V1 *string `gorm:"default:'';" json:"v1"` //
|
||||
V2 *string `gorm:"default:'';" json:"v2"` //
|
||||
V3 *string `gorm:"default:'';" json:"v3"` //
|
||||
V4 *string `gorm:"default:'';" json:"v4"` //
|
||||
V5 *string `gorm:"default:'';" json:"v5"` //
|
||||
}
|
||||
type LdapCasbinRuleModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewLdapCasbinRuleModel(db *gorm.DB) *LdapCasbinRuleModel {
|
||||
return &LdapCasbinRuleModel{db: db, name: "ldap_casbin_rule"}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
@@ -7,14 +7,15 @@ import (
|
||||
|
||||
// ldap_group 权限组表
|
||||
type LdapGroup struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
Name *string `gorm:"default:'';" json:"name"` //
|
||||
Keyword *string `gorm:"default:'';" json:"keyword"` //
|
||||
Remark *string `gorm:"default:'';" json:"remark"` //
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 1正常, 2禁用
|
||||
Sort *int64 `gorm:"default:999;" json:"sort"` // 分组排序(排序越大权限越低, 不能查看比自己序号小的角色, 不能编辑同序号用户权限, 排序为1表示超级管理员)
|
||||
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
Name *string `gorm:"default:'';" json:"name"` //
|
||||
Keyword *string `gorm:"default:'';" json:"keyword"` //
|
||||
Remark *string `gorm:"default:'';" json:"remark"` //
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 1正常, 2禁用
|
||||
Sort *int64 `gorm:"default:999;" json:"sort"` // 分组排序(排序越大权限越低, 不能查看比自己序号小的角色, 不能编辑同序号用户权限, 排序为1表示超级管理员)
|
||||
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
|
||||
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||
}
|
||||
type LdapGroupModel struct {
|
||||
db *gorm.DB
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// ldap_group_menus 权限分组菜单表
|
||||
type LdapGroupMenus struct {
|
||||
MenuId *int64 `gorm:"default:0;" json:"menu_id"` //
|
||||
GroupId *int64 `gorm:"default:0;" json:"group_id"` //
|
||||
}
|
||||
type LdapGroupMenusModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewLdapGroupMenusModel(db *gorm.DB) *LdapGroupMenusModel {
|
||||
return &LdapGroupMenusModel{db: db, name: "ldap_group_menus"}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package gmodel
|
||||
|
||||
import "context"
|
||||
|
||||
func (gm *LdapGroupMenusModel) FindOne(ctx context.Context, menuId, groupId int64) (resp *LdapGroupMenus, err error) {
|
||||
err = gm.db.WithContext(ctx).Model(&LdapGroupMenus{}).Where("menu_id = ? and group_id = ?", menuId, groupId).Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (gm *LdapGroupMenusModel) Create(ctx context.Context, data *LdapGroupMenus) error {
|
||||
return gm.db.WithContext(ctx).Model(&LdapGroupMenus{}).Create(&data).Error
|
||||
}
|
||||
|
||||
func (gm *LdapGroupMenusModel) Delete(ctx context.Context, menuId, groupId int64) error {
|
||||
return gm.db.WithContext(ctx).Model(&LdapGroupMenus{}).Where("menu_id = ? and group_id", menuId, groupId).Delete(&LdapGroupMenus{}).Error
|
||||
}
|
||||
|
||||
func (gm *LdapGroupMenusModel) DeleteByMenuId(ctx context.Context, menuId int64) error {
|
||||
return gm.db.WithContext(ctx).Model(&LdapGroupMenus{}).Where("menu_id = ?", menuId).Delete(&LdapGroupMenus{}).Error
|
||||
}
|
||||
func (gm *LdapGroupMenusModel) DeleteByGroupId(ctx context.Context, groupId int64) error {
|
||||
return gm.db.WithContext(ctx).Model(&LdapGroupMenus{}).Where("group_id = ?", groupId).Delete(&LdapGroupMenus{}).Error
|
||||
}
|
||||
@@ -2,11 +2,15 @@ package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ldap_user ldap_用户id递增表
|
||||
type LdapUser struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
UserDn *string `gorm:"index;default:'';" json:"user_dn"` //
|
||||
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||
}
|
||||
type LdapUserModel struct {
|
||||
db *gorm.DB
|
||||
|
||||
@@ -110,9 +110,7 @@ type AllModelsGen struct {
|
||||
FsWebSet *FsWebSetModel // fs_web_set 网站配置表
|
||||
FsZipCode *FsZipCodeModel // fs_zip_code 邮编表
|
||||
LdapApis *LdapApisModel // ldap_apis api表
|
||||
LdapCasbinRule *LdapCasbinRuleModel // ldap_casbin_rule 权限表
|
||||
LdapGroup *LdapGroupModel // ldap_group 权限组表
|
||||
LdapGroupMenus *LdapGroupMenusModel // ldap_group_menus 权限分组菜单表
|
||||
LdapMenus *LdapMenusModel // ldap_menus 菜单表
|
||||
LdapUser *LdapUserModel // ldap_user ldap_用户id递增表
|
||||
LdapUserGroup *LdapUserGroupModel // ldap_user_group 用户权限分组表
|
||||
@@ -227,9 +225,7 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||
FsWebSet: NewFsWebSetModel(gdb),
|
||||
FsZipCode: NewFsZipCodeModel(gdb),
|
||||
LdapApis: NewLdapApisModel(gdb),
|
||||
LdapCasbinRule: NewLdapCasbinRuleModel(gdb),
|
||||
LdapGroup: NewLdapGroupModel(gdb),
|
||||
LdapGroupMenus: NewLdapGroupMenusModel(gdb),
|
||||
LdapMenus: NewLdapMenusModel(gdb),
|
||||
LdapUser: NewLdapUserModel(gdb),
|
||||
LdapUserGroup: NewLdapUserGroupModel(gdb),
|
||||
|
||||
Reference in New Issue
Block a user