@Test public void createBook() { CreateOrUpdateBookDTO validator = new CreateOrUpdateBookDTO(); validator.setAuthor(author); validator.setImage(image); validator.setSummary(summary); validator.setTitle(title); bookService.createBook(validator); List<BookDO> books = bookMapper.selectByTitle(title); boolean anyMatch = books.stream().anyMatch(bo -> bo.getTitle().equals(title) && bo.getAuthor().equals(author)); assertTrue(anyMatch); }
@Override public boolean createBook(CreateOrUpdateBookDTO validator) { BookDO book = new BookDO(); book.setAuthor(validator.getAuthor()); book.setTitle(validator.getTitle()); book.setImage(validator.getImage()); book.setSummary(validator.getSummary()); return bookMapper.insert(book) > 0; }
BookServiceImpl implements BookService { @Override public boolean createBook(CreateOrUpdateBookDTO validator) { BookDO book = new BookDO(); book.setAuthor(validator.getAuthor()); book.setTitle(validator.getTitle()); book.setImage(validator.getImage()); book.setSummary(validator.getSummary()); return bookMapper.insert(book) > 0; } }
BookServiceImpl implements BookService { @Override public boolean createBook(CreateOrUpdateBookDTO validator) { BookDO book = new BookDO(); book.setAuthor(validator.getAuthor()); book.setTitle(validator.getTitle()); book.setImage(validator.getImage()); book.setSummary(validator.getSummary()); return bookMapper.insert(book) > 0; }  }
BookServiceImpl implements BookService { @Override public boolean createBook(CreateOrUpdateBookDTO validator) { BookDO book = new BookDO(); book.setAuthor(validator.getAuthor()); book.setTitle(validator.getTitle()); book.setImage(validator.getImage()); book.setSummary(validator.getSummary()); return bookMapper.insert(book) > 0; }  @Override boolean createBook(CreateOrUpdateBookDTO validator); @Override List<BookDO> getBookByKeyword(String q); @Override boolean updateBook(BookDO book, CreateOrUpdateBookDTO validator); @Override BookDO getById(Long id); @Override List<BookDO> findAll(); @Override boolean deleteById(Long id); }
BookServiceImpl implements BookService { @Override public boolean createBook(CreateOrUpdateBookDTO validator) { BookDO book = new BookDO(); book.setAuthor(validator.getAuthor()); book.setTitle(validator.getTitle()); book.setImage(validator.getImage()); book.setSummary(validator.getSummary()); return bookMapper.insert(book) > 0; }  @Override boolean createBook(CreateOrUpdateBookDTO validator); @Override List<BookDO> getBookByKeyword(String q); @Override boolean updateBook(BookDO book, CreateOrUpdateBookDTO validator); @Override BookDO getById(Long id); @Override List<BookDO> findAll(); @Override boolean deleteById(Long id);  }