Browse Source

Places sorted
Fixed #71

Andrew Grant 5 months ago
parent
commit
c8b5ea6c63

+ 1 - 1
src/main/java/scot/carricksoftware/grants/services/places/organisations/OrganisationServiceImpl.java

@@ -80,7 +80,7 @@ public class OrganisationServiceImpl implements OrganisationService {
     public List<Organisation> findAll() {
         logger.debug("OrganisationServiceImpl::findAll");
         List<Organisation> result = new ArrayList<>();
-        Iterable<Organisation> organisationIterable = organisationRepository.findAll();
+        Iterable<Organisation> organisationIterable = organisationRepository.findAll(getSort());
         organisationIterable.forEach(result::add);
         return result;
     }

+ 4 - 2
src/main/java/scot/carricksoftware/grants/services/places/places/PlaceServiceImpl.java

@@ -73,7 +73,9 @@ public class PlaceServiceImpl implements PlaceService {
     }
 
     private Sort getSort() {
-        return Sort.by(Sort.Direction.ASC, "name");
+        return Sort.by(Sort.Direction.DESC, "region.country.name")
+                .and(Sort.by(Sort.Direction.ASC, "region.name")
+                        .and(Sort.by(Sort.Direction.ASC, "name")));
     }
 
     @Override
@@ -96,7 +98,7 @@ public class PlaceServiceImpl implements PlaceService {
     public List<Place> findAll() {
         logger.debug("PlaceServiceImpl::findAll");
         List<Place> result = new ArrayList<>();
-        Iterable<Place> placeIterable = placeRepository.findAll();
+        Iterable<Place> placeIterable = placeRepository.findAll(getSort());
         placeIterable.forEach(result::add);
         return result;
     }

+ 1 - 1
src/main/java/scot/carricksoftware/grants/services/places/regions/RegionServiceImpl.java

@@ -98,7 +98,7 @@ public class RegionServiceImpl implements RegionService {
     public List<Region> findAll() {
         logger.debug("RegionServiceImpl::findAll");
         List<Region> result = new ArrayList<>();
-        Iterable<Region> regionIterable = regionRepository.findAll();
+        Iterable<Region> regionIterable = regionRepository.findAll(getSort());
         regionIterable.forEach(result::add);
         return result;
     }