store update
This commit is contained in:
parent
1ddcfc3ad3
commit
a84ee30c71
@ -20,7 +20,7 @@ spring:
|
|||||||
# Redis 설정
|
# Redis 설정
|
||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
host: ${REDIS_HOST:localhost}
|
host: ${REDIS_HOST:localhost} //로컬
|
||||||
port: ${REDIS_PORT:6379}
|
port: ${REDIS_PORT:6379}
|
||||||
password: ${REDIS_PASSWORD:}
|
password: ${REDIS_PASSWORD:}
|
||||||
timeout: 2000ms
|
timeout: 2000ms
|
||||||
|
|||||||
@ -14,6 +14,16 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
public interface StoreRepositoryPort {
|
public interface StoreRepositoryPort {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 태그로 매장 검색 (OR 조건)
|
||||||
|
*/
|
||||||
|
List<Store> findStoresByTagNames(List<String> tagNames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 모든 태그를 포함하는 매장 검색 (AND 조건)
|
||||||
|
*/
|
||||||
|
List<Store> findStoresByAllTagNames(List<String> tagNames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 점주 ID로 매장 목록 조회
|
* 점주 ID로 매장 목록 조회
|
||||||
*
|
*
|
||||||
|
|||||||
@ -38,6 +38,22 @@ public class StoreRepositoryAdapter implements StoreRepositoryPort {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Store> findStoresByTagNames(List<String> tagNames) {
|
||||||
|
return storeJpaRepository.findByTagNamesIn(tagNames)
|
||||||
|
.stream()
|
||||||
|
.map(this::toDomain)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Store> findStoresByAllTagNames(List<String> tagNames) {
|
||||||
|
return storeJpaRepository.findByAllTagNames(tagNames, tagNames.size())
|
||||||
|
.stream()
|
||||||
|
.map(this::toDomain)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<Store> findStoreById(Long storeId) {
|
public Optional<Store> findStoreById(Long storeId) {
|
||||||
return storeJpaRepository.findById(storeId)
|
return storeJpaRepository.findById(storeId)
|
||||||
|
|||||||
@ -21,6 +21,9 @@ import java.util.Optional;
|
|||||||
@Repository
|
@Repository
|
||||||
public interface StoreJpaRepository extends JpaRepository<StoreEntity, Long> {
|
public interface StoreJpaRepository extends JpaRepository<StoreEntity, Long> {
|
||||||
|
|
||||||
|
@Query("SELECT s FROM StoreEntity s WHERE s.status = 'ACTIVE' ORDER BY s.rating DESC")
|
||||||
|
Page<StoreEntity> findAllByOrderByRatingDesc(Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 점주 ID로 매장 목록 조회
|
* 점주 ID로 매장 목록 조회
|
||||||
*/
|
*/
|
||||||
@ -49,9 +52,18 @@ public interface StoreJpaRepository extends JpaRepository<StoreEntity, Long> {
|
|||||||
/**
|
/**
|
||||||
* 평점 기준 내림차순으로 매장 조회
|
* 평점 기준 내림차순으로 매장 조회
|
||||||
*/
|
*/
|
||||||
@Query("SELECT s FROM StoreEntity s ORDER BY s.rating DESC")
|
@Query(value = "SELECT DISTINCT s.* FROM stores s " +
|
||||||
Page<StoreEntity> findAllByOrderByRatingDesc(Pageable pageable);
|
"WHERE EXISTS (SELECT 1 FROM store_tags st " +
|
||||||
|
"WHERE st.store_id = s.id AND st.tag_name IN :tagNames) " +
|
||||||
|
"AND s.status = 'ACTIVE'", nativeQuery = true)
|
||||||
|
List<StoreEntity> findByTagNamesIn(@Param("tagNames") List<String> tagNames);
|
||||||
|
|
||||||
|
@Query(value = "SELECT s.* FROM stores s " +
|
||||||
|
"WHERE (SELECT COUNT(DISTINCT st.tag_name) FROM store_tags st " +
|
||||||
|
"WHERE st.store_id = s.id AND st.tag_name IN :tagNames) = :tagCount " +
|
||||||
|
"AND s.status = 'ACTIVE'", nativeQuery = true)
|
||||||
|
List<StoreEntity> findByAllTagNames(@Param("tagNames") List<String> tagNames,
|
||||||
|
@Param("tagCount") Integer tagCount);
|
||||||
/**
|
/**
|
||||||
* 점주별 매장 수 조회
|
* 점주별 매장 수 조회
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user