package com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository;

import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor.Sailor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface SailorRepository extends JpaRepository<Sailor, Integer> {
    List<Sailor> findByFbKey(Integer fbKey);

    @Transactional
    @Modifying
    @Query("delete from Sailor s where s.sailorKey in :idList")
    void deleteAllByIdInQuery(@Param("idList") List<Integer> sailorDeleteKeyList);

    Sailor findBySailorKey(Integer sailorKey);
}
