-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd881b7
commit 72f0b70
Showing
18 changed files
with
1,697 additions
and
1,577 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 25 additions & 20 deletions
45
src/main/java/com/gg/server/admin/game/data/GameAdminRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,42 @@ | ||
package com.gg.server.admin.game.data; | ||
|
||
import com.gg.server.domain.game.data.Game; | ||
import com.gg.server.domain.game.dto.GameTeamUser; | ||
import com.gg.server.domain.game.type.Mode; | ||
import com.gg.server.domain.game.type.StatusType; | ||
import com.gg.server.domain.season.data.Season; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.List; | ||
import com.gg.server.domain.game.data.Game; | ||
import com.gg.server.domain.game.dto.GameTeamUser; | ||
import com.gg.server.domain.game.type.Mode; | ||
import com.gg.server.domain.game.type.StatusType; | ||
import com.gg.server.domain.season.data.Season; | ||
|
||
public interface GameAdminRepository extends JpaRepository<Game, Long> { | ||
|
||
Page<Game> findBySeason(Pageable pageable, Season season); | ||
Page<Game> findBySeason(Pageable pageable, Season season); | ||
|
||
Page<Game> findBySeasonAndModeIn(Pageable pageable, Season season, List<Mode> modes); | ||
|
||
Page<Game> findBySeasonAndModeIn(Pageable pageable, Season season, List<Mode> modes); | ||
Page<Game> findAllByModeIn(Pageable pageable, List<Mode> modes); | ||
|
||
Page<Game> findAllByModeIn(Pageable pageable, List<Mode> modes); | ||
@Query(value = "select t1.gameId, t1.startTime, t1.endTime, t1.status, t1.mode, " | ||
+ "t1.teamId t1TeamId, t1.intraId t1IntraId, t1.win t1IsWin, t1.score t1Score, " | ||
+ "t1.image t1Image, t1.total_exp t1Exp, t1.wins t1Wins, t1.losses t1Losses, " | ||
+ "t2.teamId t2TeamId, t2.win t2IsWin, t2.score t2Score, t2.intraId t2IntraId, " | ||
+ "t2.wins t2Wins, t2.losses t2Losses, t2.image t2Image, t2.total_exp t2Exp " | ||
+ "from v_rank_game_detail t1, v_rank_game_detail t2 " | ||
+ "where t1.gameId IN (:games) and t1.teamId <t2.teamId and t1.gameId=t2.gameId " | ||
+ "order by t1.startTime desc;", nativeQuery = true) | ||
List<GameTeamUser> findTeamsByGameIsIn(@Param("games") List<Long> games); | ||
|
||
@Query(value = "select t1.gameId, t1.startTime, t1.endTime, t1.status, t1.mode, " + | ||
"t1.teamId t1TeamId, t1.intraId t1IntraId, t1.win t1IsWin, t1.score t1Score, t1.image t1Image, t1.total_exp t1Exp, t1.wins t1Wins, t1.losses t1Losses, " + | ||
"t2.teamId t2TeamId, t2.win t2IsWin, t2.score t2Score, t2.intraId t2IntraId, t2.wins t2Wins, t2.losses t2Losses, t2.image t2Image, t2.total_exp t2Exp " + | ||
"from v_rank_game_detail t1, v_rank_game_detail t2 " + | ||
"where t1.gameId IN (:games) and t1.teamId <t2.teamId and t1.gameId=t2.gameId order by t1.startTime desc;", nativeQuery = true) | ||
List<GameTeamUser> findTeamsByGameIsIn(@Param("games") List<Long> games); | ||
@Query(value = "SELECT g FROM Game g, Team t, TeamUser tu WHERE g.status = :status AND g.id = t.game.id" | ||
+ " AND t.id = tu.team.id AND tu.user.id = :userId") | ||
Optional<Game> findByStatusTypeAndUserId(@Param("status") StatusType status, @Param("userId") Long userId); | ||
@Query(value = "SELECT g FROM Game g, Team t, TeamUser tu WHERE g.status = :status AND g.id = t.game.id" | ||
+ " AND t.id = tu.team.id AND tu.user.id = :userId") | ||
Optional<Game> findByStatusTypeAndUserId(@Param("status") StatusType status, @Param("userId") Long userId); | ||
|
||
@Query(value = "SELECT g FROM Game g JOIN FETCH g.season WHERE g.id = :gameId") | ||
Optional<Game> findGameWithSeasonByGameId(@Param("gameId")Long gameId); | ||
@Query(value = "SELECT g FROM Game g JOIN FETCH g.season WHERE g.id = :gameId") | ||
Optional<Game> findGameWithSeasonByGameId(@Param("gameId") Long gameId); | ||
} |
Oops, something went wrong.