package app.repositories; import app.entities.db.Gametime; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import java.util.List; public interface GametimeRepository extends PagingAndSortingRepository { @Query(value = "select g from Gametime g where g.player_name like :player_name order by g.id desc limit 1") Gametime searchGameTimeByPlayerName(@Param("player_name") String player_name); @Query(value = "select g from Gametime g where g.account_id = :account_id order by g.id desc limit 1") Gametime searchGametimeByAccountId(@Param("account_id") Long account_id); @Query(value = "select g from Gametime g where g.steam_id like :steam2 order by g.id desc limit 1") Gametime searchGametimeBySteam2(@Param("steam2") String steam2); @Query(value = "select g.steam_id from Gametime g where g.connect_ip in (select gg.connect_ip from Gametime gg where gg.account_id = :account_id and gg.connect_ip not like '10.%' group by gg.connect_ip, gg.id order by gg.id) group by g.steam_id") List searchAccountsByAccountId(@Param("account_id") Long account_id); }