From 72128f189caa0c3fde83a800fcd2367285754d60 Mon Sep 17 00:00:00 2001 From: maxnes3 <112558334+maxnes3@users.noreply.github.com> Date: Mon, 15 May 2023 20:16:46 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B0=D0=BB=D0=B0=D1=81?= =?UTF-8?q?=D1=8C=20=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B0=D1=8F?= =?UTF-8?q?=20=D1=87=D0=B0=D1=81=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AuthorMvcController.java | 7 +++- .../bookshop/service/AuthorService.java | 2 -- .../bookshop/service/BookService.java | 1 - .../templates/all-authors-books.html | 36 +++++++++++++++++++ src/main/resources/templates/authors.html | 8 +++-- 5 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/templates/all-authors-books.html diff --git a/src/main/java/ru/ip/labworks/labworks/bookshop/controller/AuthorMvcController.java b/src/main/java/ru/ip/labworks/labworks/bookshop/controller/AuthorMvcController.java index 80f4a2c..110ee85 100644 --- a/src/main/java/ru/ip/labworks/labworks/bookshop/controller/AuthorMvcController.java +++ b/src/main/java/ru/ip/labworks/labworks/bookshop/controller/AuthorMvcController.java @@ -95,5 +95,10 @@ public class AuthorMvcController { return "redirect:/author/" + id.toString() + "/books"; } - private void Bt(){} + @GetMapping("/books") + private String getAllAuthorsBooks(Model model){ + model.addAttribute("authorsbooks", + authorService.AllAuthorsAndBooks()); + return "all-authors-books"; + } } diff --git a/src/main/java/ru/ip/labworks/labworks/bookshop/service/AuthorService.java b/src/main/java/ru/ip/labworks/labworks/bookshop/service/AuthorService.java index 320115b..7551009 100644 --- a/src/main/java/ru/ip/labworks/labworks/bookshop/service/AuthorService.java +++ b/src/main/java/ru/ip/labworks/labworks/bookshop/service/AuthorService.java @@ -6,9 +6,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import ru.ip.labworks.labworks.bookshop.controller.AuthorDto; import ru.ip.labworks.labworks.bookshop.model.*; -import org.hibernate.query.Query; import ru.ip.labworks.labworks.bookshop.repository.AuthorRepository; -import ru.ip.labworks.labworks.bookshop.repository.BookRepository; import ru.ip.labworks.labworks.util.validation.ValidatorUtil; import java.io.File; diff --git a/src/main/java/ru/ip/labworks/labworks/bookshop/service/BookService.java b/src/main/java/ru/ip/labworks/labworks/bookshop/service/BookService.java index fa581f0..5e40273 100644 --- a/src/main/java/ru/ip/labworks/labworks/bookshop/service/BookService.java +++ b/src/main/java/ru/ip/labworks/labworks/bookshop/service/BookService.java @@ -8,7 +8,6 @@ import ru.ip.labworks.labworks.bookshop.controller.BookDto; import ru.ip.labworks.labworks.bookshop.model.Book; import ru.ip.labworks.labworks.bookshop.model.Genre; import ru.ip.labworks.labworks.bookshop.repository.BookRepository; -import ru.ip.labworks.labworks.bookshop.repository.GenreRepository; import ru.ip.labworks.labworks.util.validation.ValidatorUtil; import java.io.File; diff --git a/src/main/resources/templates/all-authors-books.html b/src/main/resources/templates/all-authors-books.html new file mode 100644 index 0000000..52bc7e7 --- /dev/null +++ b/src/main/resources/templates/all-authors-books.html @@ -0,0 +1,36 @@ + + + + + +
+
+ + + + + + + + + + + + +
АвторНазвание книг
+ +
    +
  • + +
  • +
+
+
+
+ Закрыть +
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/authors.html b/src/main/resources/templates/authors.html index 0a3ad3f..2acd0e1 100644 --- a/src/main/resources/templates/authors.html +++ b/src/main/resources/templates/authors.html @@ -11,6 +11,10 @@ th:href="@{/author/update/}"> Добавить + + Список авторов с книгами +
@@ -24,8 +28,8 @@ -
- + +