Skip to content

Commit

Permalink
fix(user): FindOneUserById with where id = id
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-X committed Oct 18, 2024
1 parent df8e025 commit e9ebb3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/uc/powerx/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (uc *OrganizationUseCase) FindOneUserByLoginOption(ctx context.Context, opt
}

func (uc *OrganizationUseCase) FindOneUserById(ctx context.Context, id int64) (user *organization.User, err error) {
if err = uc.db.WithContext(ctx).Where(id).Preload("Department").Preload("Position").First(&user).Error; err != nil {
if err = uc.db.WithContext(ctx).Where("id", id).Preload("Department").Preload("Position").First(&user).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, errorx.WithCause(errorx.ErrBadRequest, "用户不存在")
}
Expand Down

0 comments on commit e9ebb3d

Please sign in to comment.