Add page interfaces (#67)
This commit is contained in:
parent
0f83486593
commit
a144f06bb8
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package ru.touchin.common.page
|
||||
|
||||
interface GetPage {
|
||||
|
||||
val page: Int
|
||||
val size: Int
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package ru.touchin.common.page
|
||||
|
||||
interface PageInfo {
|
||||
|
||||
val pageCount: Int
|
||||
val totalItemCount: Long
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue