interface MyRepository : JpaRepository<T, UUID>, JpaSpecificationExecutor<T> {
...
@Service
class SomeService(
private val someJpaRepository: MyRepository
) {
fun fetch(request: ServerSideGetRowsRequest): SomeResponseDTO {
val specifications = SpecificationBuilder.build<T>(request.filterModel)
val sort = SortBuilder.build(request.sortModel)
val pageRequest = PageRequestBuilder.build(request.startRow, request.endRow, sort)
if (pageRequest == null) {
val results = someJpaRepository.findAll(specifications, sort)
return SomeResponseDTO(
rowData = results,
rowCount = results.size.toLong()
)
}
val pagedResults = someJpaRepository.findAll(specifications, pageRequest)
return SomeResponseDTO(
rowData = pagedResults.content,
rowCount = pagedResults.totalElements
)
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
plgagnon2/ag-grid-builder-for-jpa
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published