Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.rewe.exercise.bookstore.book;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.List;
- @Service
- public class BookService {
- private final BookRepository bookRepository;
- @Autowired
- public BookService(BookRepository bookRepository) {
- this.bookRepository = bookRepository;
- }
- List<BookEntity> getAllBooks() {
- return bookRepository.findAll();
- }
- List<BookEntity> getBooksByTitle(String title) {
- return bookRepository.findBooksByTitleContainingIgnoreCase(title);
- }
- List<BookEntity> getBooksByAuthorsName(String name) {
- return bookRepository.findAllByFirstNameOrLastName(name);
- }
- }
Add Comment
Please, Sign In to add comment