This commit is contained in:
laodaming
2023-11-16 16:57:29 +08:00
parent 2aae36dfca
commit f8b8d98723
18 changed files with 490 additions and 5 deletions

View File

@@ -0,0 +1,16 @@
package gmodel
import (
"gorm.io/gorm"
)
// ldap_user ldap_用户id递增表
type LdapUser struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
}
type LdapUserModel struct {
db *gorm.DB
name string
}
func NewLdapUserModel(db *gorm.DB) *LdapUserModel { return &LdapUserModel{db: db, name: "ldap_user"} }

View File

@@ -6,8 +6,8 @@ import (
// ldap_user_group 用户权限分组表
type LdapUserGroup struct {
GroupId *int64 `gorm:"default:0;" json:"group_id"` //
UserId *string `gorm:"default:'0';" json:"user_id"` //
GroupId *int64 `gorm:"default:0;" json:"group_id"` //
UserId *int64 `gorm:"default:0;" json:"user_id"` //
}
type LdapUserGroupModel struct {
db *gorm.DB

View File

@@ -0,0 +1,8 @@
package gmodel
import "context"
// TODO: 使用model的属性做你想做的
func (u *LdapUserModel) Create(ctx context.Context, data *LdapUser) error {
return u.db.WithContext(ctx).Model(&LdapUser{}).Create(&data).Error
}

View File

@@ -114,6 +114,7 @@ type AllModelsGen struct {
LdapGroup *LdapGroupModel // ldap_group 权限组表
LdapGroupMenus *LdapGroupMenusModel // ldap_group_menus 权限分组菜单表
LdapMenus *LdapMenusModel // ldap_menus 菜单表
LdapUser *LdapUserModel // ldap_user ldap_用户id递增表
LdapUserGroup *LdapUserGroupModel // ldap_user_group 用户权限分组表
}
@@ -230,6 +231,7 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
LdapGroup: NewLdapGroupModel(gdb),
LdapGroupMenus: NewLdapGroupMenusModel(gdb),
LdapMenus: NewLdapMenusModel(gdb),
LdapUser: NewLdapUserModel(gdb),
LdapUserGroup: NewLdapUserGroupModel(gdb),
}
return models