From e9ebb3d9457dd1d75c04f30d812af452a6687cf8 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Fri, 18 Oct 2024 12:06:21 +0800 Subject: [PATCH] fix(user): FindOneUserById with where id = id --- internal/uc/powerx/organization.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/uc/powerx/organization.go b/internal/uc/powerx/organization.go index 9b4bb878..42c71321 100644 --- a/internal/uc/powerx/organization.go +++ b/internal/uc/powerx/organization.go @@ -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, "用户不存在") }