diff --git a/src/main/java/com/gg/server/domain/game/service/GameService.java b/src/main/java/com/gg/server/domain/game/service/GameService.java index e5937da95..08d390b59 100644 --- a/src/main/java/com/gg/server/domain/game/service/GameService.java +++ b/src/main/java/com/gg/server/domain/game/service/GameService.java @@ -212,7 +212,7 @@ private void updatePchangeIsChecked(Game game, Long loginUserId) { } public void savePChange(Game game, List teamUsers, Long loginUserId) { - if (pChangeRepository.findPChangeByGameId(game.getId()).isPresent()){ + if (!pChangeRepository.findPChangesByGameId(game.getId()).isEmpty()){ return ; } Long team1UserId = teamUsers.get(0).getUser().getId(); diff --git a/src/main/java/com/gg/server/domain/pchange/data/PChangeRepository.java b/src/main/java/com/gg/server/domain/pchange/data/PChangeRepository.java index 34f61c78a..d3b72b09f 100644 --- a/src/main/java/com/gg/server/domain/pchange/data/PChangeRepository.java +++ b/src/main/java/com/gg/server/domain/pchange/data/PChangeRepository.java @@ -17,10 +17,10 @@ public interface PChangeRepository extends JpaRepository , PChang List findAllByUserId(@Param("userId") Long userId); @Query(value = "SELECT pc FROM PChange pc join fetch pc.user join fetch pc.game WHERE pc.user.id = :userId and pc.game.mode in :modes order by pc.id desc") - List findAllByUserIdGameModeIn(@Param("userId") Long userId, List modes); + List findAllByUserIdGameModeIn(@Param("userId") Long userId, @Param("modes") List modes); Optional findByUserIdAndGameId(Long userId, Long gameId); Optional findPChangeByUserIdAndGameId(Long userId, Long gameId); - Optional findPChangeByGameId(Long gameId); + List findPChangesByGameId(Long gameId); }