This commit is contained in:
laodaming 2023-11-10 17:23:05 +08:00
parent 36aa17bd1a
commit b683cbea4f
9 changed files with 0 additions and 143 deletions

View File

@ -1,25 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// ldap_apis
type LdapApis struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
Method *string `gorm:"default:'';" json:"method"` //
Path *string `gorm:"default:'';" json:"path"` //
Category *string `gorm:"default:'';" json:"category"` //
Remark *string `gorm:"default:'';" json:"remark"` //
Creator *string `gorm:"default:'';" json:"creator"` //
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"` //
Dtime *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"dtime"` //
}
type LdapApisModel struct {
db *gorm.DB
name string
}
func NewLdapApisModel(db *gorm.DB) *LdapApisModel { return &LdapApisModel{db: db, name: "ldap_apis"} }

View File

@ -1,2 +0,0 @@
package gmodel
// TODO: 使用model的属性做你想做的

View File

@ -1,25 +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"` //
Ptype *string `gorm:"default:'';" json:"ptype"` //
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"}
}

View File

@ -1,2 +0,0 @@
package gmodel
// TODO: 使用model的属性做你想做的

View File

@ -1,29 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// ldap_menus
type LdapMenus struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
Name *string `gorm:"default:'';" json:"name"` //
Title *string `gorm:"default:'';" json:"title"` //
Icon *string `gorm:"default:'';" json:"icon"` //
Path *string `gorm:"default:'';" json:"path"` //
Sort *int64 `gorm:"default:999;" json:"sort"` //
Status *int64 `gorm:"default:1;" json:"status"` //
Creator *string `gorm:"default:'';" json:"creator"` //
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"` //
Dtime *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"dtime"` //
}
type LdapMenusModel struct {
db *gorm.DB
name string
}
func NewLdapMenusModel(db *gorm.DB) *LdapMenusModel {
return &LdapMenusModel{db: db, name: "ldap_menus"}
}

View File

@ -1,2 +0,0 @@
package gmodel
// TODO: 使用model的属性做你想做的

View File

@ -1,35 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// ldap_users
type LdapUsers struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
Name *string `gorm:"default:'';" json:"name"` //
Nickname *string `gorm:"default:'';" json:"nickname"` //
Email *string `gorm:"default:'';" json:"email"` //
EnterpriseEmail *string `gorm:"default:'';" json:"enterprise_email"` //
JobTitle *string `gorm:"default:'';" json:"job_title"` //
Mobile *string `gorm:"default:'';" json:"mobile"` //
Gender *int64 `gorm:"default:0;" json:"gender"` // 性别 0未知 1男 2女
Avatar *string `gorm:"default:'';" json:"avatar"` //
Status *int64 `gorm:"default:1;" json:"status"` // 状态 0禁止 1正常
Departmentids *string `gorm:"default:'';" json:"departmentIds"` //
EmployeeType *int64 `gorm:"default:0;" json:"employee_type"` // 1正式员工 2实习生 3外包4劳务 5顾问
UserDn *string `gorm:"default:'';" json:"user_dn"` //
JoinTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"join_time"` //
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"` //
Dtime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"dtime"` //
}
type LdapUsersModel struct {
db *gorm.DB
name string
}
func NewLdapUsersModel(db *gorm.DB) *LdapUsersModel {
return &LdapUsersModel{db: db, name: "ldap_users"}
}

View File

@ -1,21 +0,0 @@
package gmodel
import (
"context"
"errors"
"gorm.io/gorm"
)
// TODO: 使用model的属性做你想做的
func (u *LdapUsersModel) CreateOrUpdate(ctx context.Context, openId string, data *LdapUsers) error {
var info LdapUsers
err := u.db.WithContext(ctx).Where("open_id = ?", openId).Take(&info).Error
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return u.db.WithContext(ctx).Create(&data).Error
}
return err
}
return u.db.WithContext(ctx).Where("open_id = ?", openId).Updates(&data).Error
}

View File

@ -119,7 +119,6 @@ type AllModelsGen struct {
FsUserStock *FsUserStockModel // fs_user_stock 用户云仓库存
FsWebSet *FsWebSetModel // fs_web_set 网站配置表
FsZipCode *FsZipCodeModel // fs_zip_code 邮编表
LdapCasbinRule *LdapCasbinRuleModel // ldap_casbin_rule 规则权限表
}
@ -240,7 +239,6 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
FsUserStock: NewFsUserStockModel(gdb),
FsWebSet: NewFsWebSetModel(gdb),
FsZipCode: NewFsZipCodeModel(gdb),
LdapCasbinRule: NewLdapCasbinRuleModel(gdb),
}
return models
}