filtres articles
This commit is contained in:
@@ -88,8 +88,9 @@ public class ArticleRepositoryImpl implements ArticleRepository {
|
||||
|
||||
@Override
|
||||
public List<Article> searchArticle(SearchArticleCritere critere) {
|
||||
StringBuilder sql = new StringBuilder("SELECT a.*, u.* FROM ARTICLES_VENDUS a ");
|
||||
StringBuilder sql = new StringBuilder("SELECT DISTINCT a.*, u.* FROM ARTICLES_VENDUS a ");
|
||||
sql.append("JOIN UTILISATEURS u ON a.no_utilisateur = u.no_utilisateur ");
|
||||
sql.append("LEFT JOIN ENCHERES e ON a.no_article = e.no_article ");
|
||||
sql.append("WHERE 1 = 1 AND a.isDelete = 0");
|
||||
List<Object> params = new ArrayList<>();
|
||||
|
||||
@@ -147,33 +148,33 @@ public class ArticleRepositoryImpl implements ArticleRepository {
|
||||
if (!isFirstCondition) {
|
||||
sql.append(" OR ");
|
||||
}
|
||||
sql.append(" /* Ajoutez votre condition ici */ ");
|
||||
sql.append(" (e.no_utilisateur = ? AND a.date_debut_encheres <= NOW() AND a.date_fin_encheres >= NOW()) ");
|
||||
isFirstCondition = false;
|
||||
params.add(critere.getNoVendeur());
|
||||
}
|
||||
if (option.equals("enchereRemportees")) {
|
||||
if (!isFirstCondition) {
|
||||
sql.append(" OR ");
|
||||
}
|
||||
sql.append(" /* Ajoutez votre condition ici */ ");
|
||||
sql.append(" (e.no_utilisateur = ? AND e.montant_enchere = (SELECT MAX(montant_enchere) FROM ENCHERES WHERE no_article = a.no_article)) ");
|
||||
isFirstCondition = false;
|
||||
params.add(critere.getNoVendeur());
|
||||
}
|
||||
}
|
||||
|
||||
sql.append(") AND a.no_utilisateur = ?");
|
||||
params.add(critere.getNoVendeur());
|
||||
sql.append(")");
|
||||
}
|
||||
|
||||
List<Article> articles = jdbcTemplate.query(sql.toString(), new HomeArticleRowMapper(), params.toArray());
|
||||
|
||||
for (Article article : articles) {
|
||||
|
||||
}
|
||||
|
||||
return articles;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Article findArticleById(int id) {
|
||||
String sql = "SELECT * FROM ARTICLES_VENDUS a WHERE a.no_article = ?";
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package fr.eni.enchere.dal;
|
||||
|
||||
import fr.eni.enchere.bo.Enchere;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class EnchereRepositoryImpl implements EnchereRepository {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user