Merge branch 'Olivier'
This commit is contained in:
@@ -22,7 +22,7 @@ public class ArticleServiceImpl implements ArticleService{
|
||||
|
||||
@Override
|
||||
public Article findArticleById(int id) {
|
||||
return null;
|
||||
return articleRepository.findArticleById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,8 +48,11 @@ public class ArticleController {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (!authentication.getName().equals("anonymousUser")) {
|
||||
Article article = articleService.findArticleById(id);
|
||||
UserProfil user = userService.utilisateurById(article.getUtilisateur());
|
||||
System.out.println(article);
|
||||
System.out.println(user);
|
||||
model.addAttribute("article", article);
|
||||
model.addAttribute("user", user);
|
||||
return "article";
|
||||
} else {
|
||||
return "redirect:/accueil";
|
||||
|
||||
@@ -49,8 +49,7 @@ public class ArticleRepositoryImpl implements ArticleRepository {
|
||||
article.setDateFinEnch(rs.getDate("a.date_fin_encheres"));
|
||||
article.setPrixInitial(rs.getFloat("a.prix_initial"));
|
||||
article.setPrixVente(rs.getFloat("a.prix_vente"));
|
||||
article.setNoUtilisateur(rs.getInt("u.no_utilisateur"));
|
||||
article.setPseudoUtilisateur(rs.getString("u.pseudo"));
|
||||
article.setNoUtilisateur(rs.getInt("a.no_utilisateur"));
|
||||
article.setNumCategorie(rs.getInt("a.no_categorie"));
|
||||
return article;
|
||||
}
|
||||
@@ -177,7 +176,7 @@ public class ArticleRepositoryImpl implements ArticleRepository {
|
||||
|
||||
@Override
|
||||
public Article findArticleById(int id) {
|
||||
String sql = "SELECT * FROM ARTICLES_VENDUS a WHERE no_article = ?";
|
||||
String sql = "SELECT * FROM ARTICLES_VENDUS a WHERE a.no_article = ?";
|
||||
Article article = jdbcTemplate.queryForObject(sql, new ArticleRowMapper(), id);
|
||||
return article;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
<div class="card-body">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<strong><label class="col-form-label" th:text="${article}"></label></strong>
|
||||
<strong><label class="col-form-label" th:text="${article.nom}"></label></strong>
|
||||
</li>
|
||||
<!-- <li class="list-group-item">-->
|
||||
<!-- <strong><label class="col-form-label" th:text="${user.pseudo}"></label></strong>-->
|
||||
<!-- </li>-->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="collapse navbar-collapse " id="navbarNav">
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item active" th:if="${#authorization.expression('hasRole(''MEMBRE'')')}">
|
||||
<a class="nav-link" href="#">Encheres <span class="sr-only" >(current)</span></a>
|
||||
<a class="nav-link" href="/accueil">Encheres <span class="sr-only" >(current)</span></a>
|
||||
</li>
|
||||
<li class="nav-item" th:if="${#authorization.expression('hasRole(''MEMBRE'')')}">
|
||||
<a class="nav-link" href="#">Vendre un article</a>
|
||||
|
||||
Reference in New Issue
Block a user