Add page interfaces (#67)

This commit is contained in:
TonCherAmi 2022-02-18 19:54:07 +03:00 committed by GitHub
parent 0f83486593
commit a144f06bb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 0 deletions

View File

@ -10,6 +10,7 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation(project(":common"))
implementation(project(":common-spring"))
implementation("org.springframework.boot:spring-boot-starter-data-jpa")

View File

@ -0,0 +1,12 @@
package ru.touchin.common.spring.jpa.converters
import org.springframework.data.domain.PageRequest
import org.springframework.data.domain.Pageable
import ru.touchin.common.page.GetPage
fun GetPage.toPageable(): Pageable {
return PageRequest.of(
page - 1,
size,
)
}

View File

@ -0,0 +1,8 @@
package ru.touchin.common.page
interface GetPage {
val page: Int
val size: Int
}

View File

@ -0,0 +1,8 @@
package ru.touchin.common.page
interface PageInfo {
val pageCount: Int
val totalItemCount: Long
}