Skip to content

Commit

Permalink
Merge branch 'master' into fix/order
Browse files Browse the repository at this point in the history
  • Loading branch information
summit45 authored Nov 19, 2023
2 parents 3f2c9aa + e1aeb82 commit c9d5b10
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 13 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified src/.DS_Store
Binary file not shown.
Binary file modified src/main/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions src/main/generated/com/kusitms/jipbap/food/QFood.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public class QFood extends EntityPathBase<Food> {

public final StringPath image = createString("image");

public final StringPath informationDescription = createString("informationDescription");

public final StringPath ingredient = createString("ingredient");

public final StringPath name = createString("name");

public final NumberPath<Long> recommendCount = createNumber("recommendCount", Long.class);
Expand Down
14 changes: 14 additions & 0 deletions src/main/generated/com/kusitms/jipbap/store/QStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,25 @@ public class QStore extends EntityPathBase<Store> {

public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this);

public final StringPath address = createString("address");

public final NumberPath<Double> avgRate = createNumber("avgRate", Double.class);

public final NumberPath<Long> bookmarkCount = createNumber("bookmarkCount", Long.class);

public final EnumPath<com.kusitms.jipbap.user.CountryPhoneCode> countryPhoneCode = createEnum("countryPhoneCode", com.kusitms.jipbap.user.CountryPhoneCode.class);

//inherited
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;

public final StringPath deliveryRegion = createString("deliveryRegion");

public final StringPath description = createString("description");

public final StringPath detailAddress = createString("detailAddress");

public final BooleanPath foodChangeYn = createBoolean("foodChangeYn");

public final com.kusitms.jipbap.user.entity.QGlobalRegion globalRegion;

public final NumberPath<Long> id = createNumber("id", Long.class);
Expand All @@ -49,8 +59,12 @@ public class QStore extends EntityPathBase<Store> {

public final StringPath name = createString("name");

public final StringPath operationTime = createString("operationTime");

public final com.kusitms.jipbap.user.QUser owner;

public final StringPath phoneNum = createString("phoneNum");

public final NumberPath<Long> rateCount = createNumber("rateCount", Long.class);

public final NumberPath<Long> reviewCount = createNumber("reviewCount", Long.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class QGlobalRegion extends EntityPathBase<GlobalRegion> {

public final StringPath countryShortName = createString("countryShortName");

public final NumberPath<Long> Id = createNumber("Id", Long.class);
public final NumberPath<Long> id = createNumber("id", Long.class);

public final StringPath regionKorean = createString("regionKorean");

Expand Down
Binary file modified src/main/java/.DS_Store
Binary file not shown.
Binary file modified src/main/java/com/.DS_Store
Binary file not shown.
Binary file modified src/main/java/com/kusitms/.DS_Store
Binary file not shown.
Binary file modified src/main/java/com/kusitms/jipbap/.DS_Store
Binary file not shown.
Binary file modified src/main/java/com/kusitms/jipbap/auth/.DS_Store
Binary file not shown.
Binary file modified src/main/java/com/kusitms/jipbap/common/.DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion src/main/java/com/kusitms/jipbap/store/StoreController.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
public class StoreController {

private final int PAGESIZE = 3;
private final int LARGE_PAGESIZE = 10000;
private final StoreService storeService;
private final OrderService orderService;

Expand Down Expand Up @@ -92,7 +93,7 @@ public CommonResponse<StoreFoodResponseDto> searchStoreAndFood(
} else {
sort = Sort.by(Sort.Direction.DESC, field);
}
Pageable pageable = PageRequest.of(0, 10000, sort);
Pageable pageable = PageRequest.of(0, LARGE_PAGESIZE, sort);
return new CommonResponse<>(storeService.searchStoresAndFoods(authInfo.getEmail(), pageable, keyword, field, direction));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.kusitms.jipbap.store;

import com.kusitms.jipbap.common.utils.QueryDslUtils;
import com.kusitms.jipbap.food.Food;
import com.kusitms.jipbap.store.dto.StoreDetailResponseDto;
import com.kusitms.jipbap.store.dto.StoreDto;
import com.kusitms.jipbap.user.User;
Expand All @@ -18,7 +17,6 @@
import java.util.ArrayList;
import java.util.List;

import static com.kusitms.jipbap.food.QFood.food;
import static com.kusitms.jipbap.store.QStore.store;
import static org.springframework.util.ObjectUtils.isEmpty;

Expand All @@ -28,6 +26,9 @@ public class StoreRepositoryExtensionImpl implements StoreRepositoryExtension{
private final JPAQueryFactory queryFactory;
private final StoreBookmarkRepository storeBookmarkRepository;

/**
* 페이지네이션 적용 키워드로 store 검색하기
*/
@Override
public Slice<StoreDetailResponseDto> searchByKeywordOrderBySort(User user, Pageable pageable, String keyword, String standard, String order, Long lastId) {

Expand Down Expand Up @@ -59,7 +60,8 @@ public Slice<StoreDetailResponseDto> searchByKeywordOrderBySort(User user, Pagea
s.getMinOrderAmount(),
strArr
),
isUserBookmarkedStore(user, s)
isUserBookmarkedStore(user, s),
s.getFoodChangeYn()
));
}

Expand All @@ -73,14 +75,19 @@ public Slice<StoreDetailResponseDto> searchByKeywordOrderBySort(User user, Pagea
return new SliceImpl<>(dtoList, pageable, hasNext);
}

/**
* 페이지네이션 미적용 가게 조회
*/
@Override
public List<Store> searchByNameOrderBySort(User user, Pageable pageable, String keyword, String standard, String order) {

List<OrderSpecifier<?>> orderSpecifiers = getAllOrderSpecifiersByPageable(pageable);
Long globalRegionId = user.getGlobalRegion().getId();

return queryFactory.selectFrom(store)
.where(
containsKeyword(keyword)
containsKeyword(keyword),
isUserStoreRegionMatches(globalRegionId)
)
.orderBy(orderSpecifiers.toArray(OrderSpecifier[]::new))
.fetch();
Expand All @@ -91,6 +98,10 @@ private Boolean isUserBookmarkedStore(User user, Store store) {
return storeBookmarkRepository.existsByUserAndStore(user, store);
}

private BooleanExpression isUserStoreRegionMatches(Long regionId) {
return store.globalRegion.id.eq(regionId);
}

// no-offset 방식 처리하는 메서드
// 정렬조건에 따라서 다음에 나와야 할 친구들을 구함
private BooleanExpression lastStore(Pageable pageable, List<OrderSpecifier<?>> specifiers, Long id) {
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/kusitms/jipbap/store/StoreService.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ public StoreFoodResponseDto searchStoresAndFoods(String email, Pageable pageable
new StoreDto(
s.getId(), s.getName(), s.getDescription(), s.getKoreanYn(), s.getAvgRate(), s.getMinOrderAmount(),
new String[]{s.getImage(), s.getImage2(), s.getImage3()}
), storeBookmarkRepository.existsByUserAndStore(user, s))
)
, storeBookmarkRepository.existsByUserAndStore(user, s)
, s.getFoodChangeYn()
)
)
.collect(Collectors.toList());

Expand All @@ -143,8 +146,9 @@ public StoreDetailResponseDto getStoreDetail(String email, Long storeId) {
store.getAvgRate(),
store.getMinOrderAmount(),
new String[]{store.getImage(), store.getImage2(), store.getImage3()}
),
isStoreBookmarked(user, store)
)
, isStoreBookmarked(user, store)
, store.getFoodChangeYn()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ public class StoreDetailResponseDto {

private StoreDto storeDto;
private Boolean isBookmarked;
private Boolean isFoodChangeable;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;
import java.util.stream.Collectors;

@Getter
@Setter
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class GlobalRegion {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long Id;
private Long id;

@Column(name = "country_long_name")
private String countryLongName;
Expand Down

0 comments on commit c9d5b10

Please sign in to comment.