Spring Data JPA - one-indexed-parameters - свойство начинается не с 1, а с 0 - PullRequest
1 голос
/ 30 июня 2019

Я работаю на примере Spring Boot JPA Pagination .Я уже пролистал множество ссылок, таких как: Как настроить разбиение на страницы при загрузке Spring, начиная со страницы 1, а не 0 , и пока не нашел многообещающего решения. Я не использую Spring HATEOAS .

Ниже приведена конечная точка отдыха, которую я разработал.

@ApiOperation(value = "Retrieve All Students", nickname = "Find Students ")
@ApiResponses(value = { @ApiResponse(code = 200, message = "200"),
        @ApiResponse(code = 500, message = "Internal Server Error") })
@GetMapping()
public ResponseEntity<Page<Student>> getAllStudents(
        @RequestParam(required = false, value="page") Integer page, 
        @RequestParam(required = false, value = "size") Integer size,
        Pageable pageable){

    Page<Student> students = studentService.findAllstudent(pageable, page, size);
    return new ResponseEntity<>(divisions, HttpStatus.OK);
}

enter image description here

application.yml file

spring:   
  datasource:
    url: jdbc:postgresql://localhost:5432/Test?currentSchema=Test_Owner
    username: postgres
    password: admin
    platform: postgres
  jpa:
    database-platform: org.hibernate.dialect.PostgreSQLDialect
    properties:
      hibernate: 
        default_schema: Test_Owner
        jdbc: 
          lob:
            non_contextual_creation: true
    show-sql: true

    hibernate:
      ddl-auto: validate
  data:
    web:
      pageable:
        page-parameter: page
        size-parameter: size
        default-page-size: 10
        one-indexed-parameters: true
      sort:
        sort-parameter: sort

Примечание: В соответствии с отображаемым на экране снимком объекта не начинается со страницы 1 вместо 1. Может кто-нибудь пожалуйстагид?

...