修复 「1.2.2 用户管理-用户列表勾选单一用户会全选 」 close #216

This commit is contained in:
dushixiang
2022-01-23 17:53:22 +08:00
parent 29c066ca3a
commit d35b348a33
130 changed files with 5467 additions and 4554 deletions

26
server/repository/base.go Normal file
View File

@ -0,0 +1,26 @@
package repository
import (
"context"
"next-terminal/server/constant"
"next-terminal/server/env"
"gorm.io/gorm"
)
type baseRepository struct {
}
func (b *baseRepository) GetDB(c context.Context) *gorm.DB {
db := c.Value(constant.DB)
if db == nil {
return env.GetDB()
}
switch val := db.(type) {
case gorm.DB:
return &val
default:
return env.GetDB()
}
}