File History: src/main/java/com/paymentlink/repository/ProductRepository.java

← View file content

File Content at Commit 4617f76

1 package com.paymentlink.repository;
2
3 import com.paymentlink.model.entity.Product;
4 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.Query;
6 import org.springframework.data.repository.query.Param;
7 import org.springframework.stereotype.Repository;
8
9 import java.util.List;
10 import java.util.Optional;
11
12 @Repository
13 public interface ProductRepository extends JpaRepository<Product, Long> {
14
15 Optional<Product> findById(Long id);
16
17 List<Product> findByCategory(String category);
18
19 @Query("SELECT DISTINCT p.category FROM Product p WHERE p.category IS NOT NULL")
20 List<String> findDistinctCategories();
21
22 @Query("SELECT p FROM Product p WHERE " +
23 "LOWER(p.name) LIKE LOWER(CONCAT('%', :query, '%')) OR " +
24 "LOWER(p.description) LIKE LOWER(CONCAT('%', :query, '%'))")
25 List<Product> searchProducts(@Param("query") String query);
26
27 @Query("SELECT p FROM Product p WHERE p.category = :category AND " +
28 "(LOWER(p.name) LIKE LOWER(CONCAT('%', :query, '%')) OR " +
29 "LOWER(p.description) LIKE LOWER(CONCAT('%', :query, '%')))")
30 List<Product> searchProductsByCategory(@Param("query") String query, @Param("category") String category);
31 }
32
33

Commits

Commit Author Date Message File SHA Actions
f0438c2 <f69e50@finnacloud.com> 1766443042 +0300 12/22/2025, 10:37:22 PM increment once more 4eb1318 View
188fc92 <f69e50@finnacloud.com> 1766442998 +0300 12/22/2025, 10:36:38 PM increment 4eb1318 View
4617f76 <f69e50@finnacloud.com> 1766442953 +0300 12/22/2025, 10:35:53 PM rename branch from main to master oops 4eb1318 Hide
e6d1548 <f69e50@finnacloud.com> 1766442769 +0300 12/22/2025, 10:32:49 PM add initial test workflow file 4eb1318 View
9c24ca4 <f69e50@finnacloud.com> 1766442705 +0300 12/22/2025, 10:31:45 PM add CI configuration and test script for Jenkins build 4eb1318 View
690c1f6 <f69e50@finnacloud.com> 1766368110 +0300 12/22/2025, 1:48:30 AM initialize backend structure with controllers, DTOs, and configuration files 4eb1318 View