Skip to content

Commit

Permalink
Merge pull request #68 from kea-dpang/develop
Browse files Browse the repository at this point in the history
Feat: FeignConfig 설정
  • Loading branch information
namsh1125 authored Feb 5, 2024
2 parents 2233b1d + 9e39210 commit 3d0f83e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
14 changes: 14 additions & 0 deletions src/main/java/kea/dpang/item/config/FeignConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package kea.dpang.item.config;

import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FeignConfig {

@Bean
public Logger.Level feignLoggerLevel() {
return Logger.Level.FULL;
}
}
21 changes: 12 additions & 9 deletions src/main/java/kea/dpang/item/repository/ItemRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@

public interface ItemRepository extends JpaRepository<Item, Long> {

@Query("SELECT i FROM Item i WHERE " +
"(:category IS NULL OR i.category = :category) AND " +
"(:subCategory IS NULL OR i.subCategory = :subCategory) AND " +
"(:sellerId IS NULL OR i.sellerId = :sellerId) AND " +
"(:minPrice = 0 OR i.price >= :minPrice) AND " +
"(:maxPrice = 2000000 OR i.price <= :maxPrice) AND " +
"(i.name LIKE %:keyword%)")
// "(i.itemName LIKE %:keyword% OR i.description LIKE %:keyword%)")
@Query("SELECT i FROM Item i " +
"WHERE (:category IS NULL OR i.category = :category) " +
"AND (:subCategory IS NULL OR i.subCategory = :subCategory) " +
"AND (:sellerId IS NULL OR i.sellerId = :sellerId) " +
"AND (:minPrice = 0 OR i.price >= :minPrice) " +
"AND (:maxPrice = 2000000 OR i.price <= :maxPrice) " +
"AND (i.name LIKE :keyword) " +
"order by i.name asc"
)
// "(i.itemName LIKE %:keyword% OR i.description LIKE %:keyword%)")
Page<Item> filterItems(
@Param("category") Category category,
@Param("subCategory") SubCategory subCategory,
@Param("sellerId") Long sellerId,
@Param("minPrice") Double minPrice,
@Param("maxPrice") Double maxPrice,
@Param("keyword") String keyword,
Pageable pageable);
Pageable pageable
);
}

5 changes: 5 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ spring:
jpa:
hibernate:
ddl-auto: update

logging:
level:
# org.springframework.security: DEBUG
kea.dpang.item.feign.*: DEBUG

0 comments on commit 3d0f83e

Please sign in to comment.