mirror of
https://github.com/gotson/komga.git
synced 2026-05-05 19:11:44 +02:00
refactor: simplify jooq query
This commit is contained in:
parent
5aa9a95ca5
commit
2d10f70fef
1 changed files with 1 additions and 5 deletions
|
|
@ -21,8 +21,6 @@ class BookMetadataAggregationDao(
|
|||
private val a = Tables.BOOK_METADATA_AGGREGATION_AUTHOR
|
||||
private val t = Tables.BOOK_METADATA_AGGREGATION_TAG
|
||||
|
||||
private val groupFields = arrayOf(*d.fields(), *a.fields())
|
||||
|
||||
override fun findById(seriesId: String): BookMetadataAggregation =
|
||||
findOne(listOf(seriesId)).first()
|
||||
|
||||
|
|
@ -30,12 +28,10 @@ class BookMetadataAggregationDao(
|
|||
findOne(listOf(seriesId)).firstOrNull()
|
||||
|
||||
private fun findOne(seriesIds: Collection<String>) =
|
||||
dsl.select(*groupFields)
|
||||
dsl.select(*d.fields(), *a.fields())
|
||||
.from(d)
|
||||
.leftJoin(a).on(d.SERIES_ID.eq(a.SERIES_ID))
|
||||
.leftJoin(t).on(d.SERIES_ID.eq(t.SERIES_ID))
|
||||
.where(d.SERIES_ID.`in`(seriesIds))
|
||||
.groupBy(*groupFields)
|
||||
.fetchGroups(
|
||||
{ it.into(d) }, { it.into(a) }
|
||||
).map { (dr, ar) ->
|
||||
|
|
|
|||
Loading…
Reference in a new issue