package de.thpeetz.kontor.bookshelf.data;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface BookshelfPublisherRepository extends JpaRepository<BookshelfPublisher, String> {

    @Query("select p from BookshelfPublisher p " +
            "where lower(p.name) like lower(concat('%', :searchTerm, '%')) ")
    List<BookshelfPublisher> search(@Param("searchTerm") String searchTerm);

    BookshelfPublisher findByName(String name);

    List<BookshelfPublisher> findByNameIgnoreCase(String name);
}
