Skip to content

Commit

Permalink
Merge pull request #85 from lotteon2/hotfix/admin-select-query
Browse files Browse the repository at this point in the history
feat: 상품 조회 순서 변경
  • Loading branch information
indl1670 authored Jan 12, 2024
2 parents 926a5ab + 9a8ab3b commit 2aa27eb
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,14 @@ public Page<Product> findProductsForAdmin(
if (adminSelectOption.getStatus() != null)
query.addCriteria(Criteria.where("product_sale_status").is(adminSelectOption.getStatus()));

if (adminSelectOption.getSalesAmount().equals(SortOption.HIGH))
query.with(Sort.by(Order.desc(adminSelectOption.getSalesAmount().getSortOption())));
else query.with(Sort.by(Order.asc(adminSelectOption.getSalesAmount().getSortOption())));

if (adminSelectOption.getDate().equals(SortOption.NEW))
query.with(Sort.by(Order.desc(adminSelectOption.getDate().getSortOption())));
else query.with(Sort.by(Order.asc(adminSelectOption.getDate().getSortOption())));

if (adminSelectOption.getSalesAmount().equals(SortOption.HIGH))
query.with(Sort.by(Order.desc(adminSelectOption.getSalesAmount().getSortOption())));
else query.with(Sort.by(Order.asc(adminSelectOption.getSalesAmount().getSortOption())));
query.with(pageable);

List<Product> products = mongoTemplate.find(query, Product.class);
Expand Down

0 comments on commit 2aa27eb

Please sign in to comment.