осталась небольшая часть
This commit is contained in:
parent
d14bf5334f
commit
72128f189c
@ -95,5 +95,10 @@ public class AuthorMvcController {
|
|||||||
return "redirect:/author/" + id.toString() + "/books";
|
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";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import ru.ip.labworks.labworks.bookshop.controller.AuthorDto;
|
import ru.ip.labworks.labworks.bookshop.controller.AuthorDto;
|
||||||
import ru.ip.labworks.labworks.bookshop.model.*;
|
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.AuthorRepository;
|
||||||
import ru.ip.labworks.labworks.bookshop.repository.BookRepository;
|
|
||||||
import ru.ip.labworks.labworks.util.validation.ValidatorUtil;
|
import ru.ip.labworks.labworks.util.validation.ValidatorUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.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.Book;
|
||||||
import ru.ip.labworks.labworks.bookshop.model.Genre;
|
import ru.ip.labworks.labworks.bookshop.model.Genre;
|
||||||
import ru.ip.labworks.labworks.bookshop.repository.BookRepository;
|
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 ru.ip.labworks.labworks.util.validation.ValidatorUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
36
src/main/resources/templates/all-authors-books.html
Normal file
36
src/main/resources/templates/all-authors-books.html
Normal 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>
|
@ -11,6 +11,10 @@
|
|||||||
th:href="@{/author/update/}">
|
th:href="@{/author/update/}">
|
||||||
<i class="fa-solid fa-plus"></i> Добавить
|
<i class="fa-solid fa-plus"></i> Добавить
|
||||||
</a>
|
</a>
|
||||||
|
<a class="btn btn-primary button-fixed"
|
||||||
|
th:href="@{/author/books}">
|
||||||
|
<i class="fa-solid fa-plus"></i> Список авторов с книгами
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
@ -24,8 +28,8 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr th:each="author, iterator: ${authors}">
|
<tr th:each="author, iterator: ${authors}">
|
||||||
<td th:text="${author.firstname}" style="width: 25%"/>
|
<td th:text="${author.firstname}" style="width: 15%"/>
|
||||||
<td th:text="${author.lastname}" style="width: 25%"/>
|
<td th:text="${author.lastname}" style="width: 15%"/>
|
||||||
<td><img th:src="${author.photo}" class="img-thumbnail mw-50 mh-50"/></td>
|
<td><img th:src="${author.photo}" class="img-thumbnail mw-50 mh-50"/></td>
|
||||||
<td style="width: 10%">
|
<td style="width: 10%">
|
||||||
<div class="btn-group" role="group" aria-label="Basic example">
|
<div class="btn-group" role="group" aria-label="Basic example">
|
||||||
|
Loading…
Reference in New Issue
Block a user