осталась небольшая часть

This commit is contained in:
maxnes3 2023-05-15 20:16:46 +04:00
parent d14bf5334f
commit 72128f189c
5 changed files with 48 additions and 6 deletions

View File

@ -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";
}
}

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{default}">
<head>
</head>
<body>
<div layout:fragment="content">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Автор</th>
<th scope="col">Название книг</th>
</tr>
</thead>
<tbody>
<tr th:each="ab, iterator: ${authorsbooks}">
<td th:text="${ab.key}" style="width: 25%"/>
<td>
<ul>
<li th:each="value : ${ab.value}">
<span th:text="${value}"></span>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<a class="btn btn-secondary" th:href="@{/author}">Закрыть</a>
</div>
</div>
</body>
</html>

View File

@ -11,6 +11,10 @@
th:href="@{/author/update/}">
<i class="fa-solid fa-plus"></i> Добавить
</a>
<a class="btn btn-primary button-fixed"
th:href="@{/author/books}">
<i class="fa-solid fa-plus"></i> Список авторов с книгами
</a>
</div>
<div class="table-responsive">
<table class="table">
@ -24,8 +28,8 @@
</thead>
<tbody>
<tr th:each="author, iterator: ${authors}">
<td th:text="${author.firstname}" style="width: 25%"/>
<td th:text="${author.lastname}" style="width: 25%"/>
<td th:text="${author.firstname}" style="width: 15%"/>
<td th:text="${author.lastname}" style="width: 15%"/>
<td><img th:src="${author.photo}" class="img-thumbnail mw-50 mh-50"/></td>
<td style="width: 10%">
<div class="btn-group" role="group" aria-label="Basic example">