Polish
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,4 +27,5 @@ public interface HotelSummary {
|
||||
default Integer getAverageRatingRounded() {
|
||||
return getAverageRating() == null ? null : (int) Math.round(getAverageRating());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,4 +21,5 @@ public interface RatingCount {
|
||||
Rating getRating();
|
||||
|
||||
long getCount();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package sample.data.jpa.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import sample.data.jpa.domain.City;
|
||||
import sample.data.jpa.domain.Hotel;
|
||||
import sample.data.jpa.domain.HotelSummary;
|
||||
import sample.data.jpa.domain.RatingCount;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
@@ -39,4 +39,5 @@ interface HotelRepository extends Repository<Hotel, Long> {
|
||||
@Query("select r.rating as rating, count(r) as count "
|
||||
+ "from Review r where r.hotel = ?1 group by r.rating order by r.rating DESC")
|
||||
List<RatingCount> findRatingCounts(Hotel hotel);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user