#174 - Applied default sorting to controller in Querydsl web sample.

This commit is contained in:
Oliver Gierke
2016-03-23 19:13:51 +01:00
parent 84bfe86ecc
commit ad854bc19d

View File

@@ -22,6 +22,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.querydsl.binding.QuerydslPredicate;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.MultiValueMap;
@@ -46,7 +47,8 @@ class UserController {
@RequestMapping(value = "/", method = RequestMethod.GET)
String index(Model model, //
@QuerydslPredicate(root = User.class) Predicate predicate, Pageable pageable, //
@QuerydslPredicate(root = User.class) Predicate predicate, //
@PageableDefault(sort = { "lastname", "firstname" }) Pageable pageable, //
@RequestParam MultiValueMap<String, String> parameters) {
ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentRequest();