package com.alterdekim.game.repository;

import com.alterdekim.game.entity.HouseLocation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface HouseLocationRepository extends JpaRepository<HouseLocation, Long> {
    @Query(value = "SELECT h FROM HouseLocation h WHERE h.isDefault = true AND h.goodId = :good_id")
    Optional<HouseLocation> findDefaultHouseLocationByGoodId(@Param("good_id") Long goodId);
}
