package de.avatic.taric.repository;

import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;

import de.avatic.taric.model.GeoGroupMembership;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface GeoGroupMembershipRepository extends CrudRepository<GeoGroupMembership, Integer> {

    @Query("SELECT * FROM geo_group_membership WHERE geo_id = :geoId")
    List<GeoGroupMembership> findByGeoId(@Param("geoId") Integer geoId);

    @Query("SELECT geo_group_id FROM geo_group_membership WHERE id = :membershipId")
    Integer findGeoGroupIdByMembershipId(@Param("membershipId") Integer membershipId);

}
