|
|
|
@ -13,12 +13,11 @@ type UserGorm struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewUserGorm(db *gorm.DB) relation.UserModelInterface {
|
|
|
|
|
return &UserGorm{DB: db.Model(&relation.UserModel{})}
|
|
|
|
|
return &UserGorm{DB: db}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (u *UserGorm) db() *gorm.DB {
|
|
|
|
|
newDB := *u.DB
|
|
|
|
|
return &newDB
|
|
|
|
|
return u.DB.Model(&relation.UserModel{})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 插入多条
|
|
|
|
@ -38,7 +37,7 @@ func (u *UserGorm) Update(ctx context.Context, users []*relation.UserModel) (err
|
|
|
|
|
|
|
|
|
|
// 获取指定用户信息 不存在,也不返回错误
|
|
|
|
|
func (u *UserGorm) Find(ctx context.Context, userIDs []string) (users []*relation.UserModel, err error) {
|
|
|
|
|
log.ZDebug(ctx, "Find args", "userIDs", userIDs)
|
|
|
|
|
log.ZDebug(ctx, "Find args", "userIDs", userIDs, "db", u.db())
|
|
|
|
|
err = utils.Wrap(u.db().Where("user_id in (?)", userIDs).Find(&users).Error, "")
|
|
|
|
|
return users, err
|
|
|
|
|
}
|
|
|
|
|