Skip to content

Commit

Permalink
[PART AmarMicroDev#2] Ajout du traitement des requêtes permettant de …
Browse files Browse the repository at this point in the history
…récupérer les

produits par ordre alphabétique (sur leur nom)
  • Loading branch information
smarting8m committed Sep 11, 2019
1 parent 24f7546 commit 1a95b7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/ecommerce/microcommerce/dao/ProductDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ public interface ProductDao extends JpaRepository<Product, Integer> {

@Query("SELECT id, nom, prix FROM Product p WHERE p.prix > :prixLimit")
List<Product> chercherUnProduitCher(@Param("prixLimit") int prix);

List<Product> findAllByOrderByNomAsc();
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,9 @@ public Map<Product, Integer> calculerMargeProduit() {
return lMargeList;
}

@GetMapping(value = "/produits/sort")
public List<Product> trierProduitsParOrdreAlphabetique() {
return productDao.findAllByOrderByNomAsc();
}

}

0 comments on commit 1a95b7e

Please sign in to comment.