Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ select avg(r.price)
where r.category.name = :categoryName
and r.location = :region
""")
Optional<Double> avgPriceByCategoryAndRegion(@Param("categoryName") String categoryName,
Double avgPriceByCategoryAndRegion(@Param("categoryName") String categoryName,
@Param("region") String region);

@Query("""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public static record IntAvgPriceResult(int avgUnitPrice, long sampleCount) {
public IntAvgPriceResult getAvgUnitPrice(String categoryName, String city, String district, String street) {
String fullRegion = buildFullRegion(city, district, street);

double avg = requestionRepository.avgPriceByCategoryAndRegion(categoryName, fullRegion)
.orElse(0.0);
Double avg = requestionRepository.avgPriceByCategoryAndRegion(categoryName, fullRegion);
long cnt = requestionRepository.countByCategoryAndRegion(categoryName, fullRegion);

// 1,000원 단위 반올림
Expand Down
Loading