Skip to content

Commit

Permalink
feat: sort products by input ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Kang1221 committed Sep 13, 2024
1 parent a597225 commit 7d5c63f
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ public interface ProductRepository extends JpaRepository<Product, String> {
@Query(value = "SELECT * FROM products p WHERE p.stock > 0 AND p.name LIKE %:keyword% ", nativeQuery = true)
List<Product> findAllByName(@Param("keyword") String keyword);

@Query("SELECT p FROM Product p WHERE p.id IN :productIds ORDER BY FIELD(p.id, :productIds)")
List<Product> findByIdIn(List<String> productIds);
}

0 comments on commit 7d5c63f

Please sign in to comment.