mirror of
https://github.com/gotson/komga.git
synced 2026-05-09 05:10:19 +02:00
parent
66dd1c2676
commit
7a21fe073e
3 changed files with 15 additions and 4 deletions
|
|
@ -31,6 +31,7 @@ class SeriesSearchWithReadProgress(
|
|||
val releaseYears: Collection<String>? = null,
|
||||
val readStatus: Collection<ReadStatus>? = null,
|
||||
val authors: Collection<Author>? = null,
|
||||
val sharingLabels: Collection<String>? = null,
|
||||
) : SeriesSearch(
|
||||
libraryIds = libraryIds,
|
||||
collectionIds = collectionIds,
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ class SeriesDtoDao(
|
|||
}
|
||||
.apply { if (joinConditions.collection) leftJoin(cs).on(s.ID.eq(cs.SERIES_ID)) }
|
||||
.apply { if (joinConditions.aggregationAuthor) leftJoin(bmaa).on(s.ID.eq(bmaa.SERIES_ID)) }
|
||||
.apply { if (joinConditions.sharingLabel) leftJoin(sl).on(s.ID.eq(sl.SERIES_ID)) }
|
||||
.where(conditions)
|
||||
.and(searchCondition)
|
||||
.groupBy(firstChar)
|
||||
|
|
@ -172,6 +173,7 @@ class SeriesDtoDao(
|
|||
}
|
||||
.apply { if (joinConditions.collection) leftJoin(cs).on(s.ID.eq(cs.SERIES_ID)) }
|
||||
.apply { if (joinConditions.aggregationAuthor) leftJoin(bmaa).on(s.ID.eq(bmaa.SERIES_ID)) }
|
||||
.apply { if (joinConditions.sharingLabel) leftJoin(sl).on(s.ID.eq(sl.SERIES_ID)) }
|
||||
|
||||
private fun findAll(
|
||||
conditions: Condition,
|
||||
|
|
@ -196,6 +198,7 @@ class SeriesDtoDao(
|
|||
}
|
||||
.apply { if (joinConditions.collection) leftJoin(cs).on(s.ID.eq(cs.SERIES_ID)) }
|
||||
.apply { if (joinConditions.aggregationAuthor) leftJoin(bmaa).on(s.ID.eq(bmaa.SERIES_ID)) }
|
||||
.apply { if (joinConditions.sharingLabel) leftJoin(sl).on(s.ID.eq(sl.SERIES_ID)) }
|
||||
.where(conditions)
|
||||
.and(searchCondition)
|
||||
.fetchOne(countDistinct(s.ID)) ?: 0
|
||||
|
|
@ -317,6 +320,7 @@ class SeriesDtoDao(
|
|||
}
|
||||
c = c.and(ca)
|
||||
}
|
||||
if (!sharingLabels.isNullOrEmpty()) c = c.and(sl.LABEL.collate(SqliteUdfDataSource.collationUnicode3).`in`(sharingLabels))
|
||||
if (!readStatus.isNullOrEmpty()) {
|
||||
val cr = readStatus.map {
|
||||
when (it) {
|
||||
|
|
@ -344,6 +348,7 @@ class SeriesDtoDao(
|
|||
tag = !tags.isNullOrEmpty(),
|
||||
collection = !collectionIds.isNullOrEmpty(),
|
||||
aggregationAuthor = !authors.isNullOrEmpty(),
|
||||
sharingLabel = !sharingLabels.isNullOrEmpty(),
|
||||
)
|
||||
|
||||
private data class JoinConditions(
|
||||
|
|
@ -352,6 +357,7 @@ class SeriesDtoDao(
|
|||
val tag: Boolean = false,
|
||||
val collection: Boolean = false,
|
||||
val aggregationAuthor: Boolean = false,
|
||||
val sharingLabel: Boolean = false,
|
||||
)
|
||||
|
||||
private fun SeriesRecord.toDto(
|
||||
|
|
|
|||
|
|
@ -139,7 +139,8 @@ class SeriesController(
|
|||
@RequestParam(name = "genre", required = false) genres: List<String>? = null,
|
||||
@RequestParam(name = "tag", required = false) tags: List<String>? = null,
|
||||
@RequestParam(name = "age_rating", required = false) ageRatings: List<String>? = null,
|
||||
@RequestParam(name = "release_year", required = false) release_years: List<String>? = null,
|
||||
@RequestParam(name = "release_year", required = false) releaseYears: List<String>? = null,
|
||||
@RequestParam(name = "sharing_label", required = false) sharingLabels: List<String>? = null,
|
||||
@RequestParam(name = "deleted", required = false) deleted: Boolean? = null,
|
||||
@RequestParam(name = "complete", required = false) complete: Boolean? = null,
|
||||
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
|
||||
|
|
@ -181,8 +182,9 @@ class SeriesController(
|
|||
genres = genres,
|
||||
tags = tags,
|
||||
ageRatings = ageRatings?.map { it.toIntOrNull() },
|
||||
releaseYears = release_years,
|
||||
releaseYears = releaseYears,
|
||||
authors = authors,
|
||||
sharingLabels = sharingLabels,
|
||||
)
|
||||
|
||||
return seriesDtoRepository.findAll(seriesSearch, principal.user.id, pageRequest, principal.user.restrictions)
|
||||
|
|
@ -214,7 +216,8 @@ class SeriesController(
|
|||
@RequestParam(name = "genre", required = false) genres: List<String>?,
|
||||
@RequestParam(name = "tag", required = false) tags: List<String>?,
|
||||
@RequestParam(name = "age_rating", required = false) ageRatings: List<String>?,
|
||||
@RequestParam(name = "release_year", required = false) release_years: List<String>?,
|
||||
@RequestParam(name = "release_year", required = false) releaseYears: List<String>?,
|
||||
@RequestParam(name = "sharing_label", required = false) sharingLabels: List<String>? = null,
|
||||
@RequestParam(name = "deleted", required = false) deleted: Boolean?,
|
||||
@RequestParam(name = "complete", required = false) complete: Boolean?,
|
||||
@Parameter(hidden = true) @Authors authors: List<Author>?,
|
||||
|
|
@ -240,8 +243,9 @@ class SeriesController(
|
|||
genres = genres,
|
||||
tags = tags,
|
||||
ageRatings = ageRatings?.map { it.toIntOrNull() },
|
||||
releaseYears = release_years,
|
||||
releaseYears = releaseYears,
|
||||
authors = authors,
|
||||
sharingLabels = sharingLabels,
|
||||
)
|
||||
|
||||
return seriesDtoRepository.countByFirstCharacter(seriesSearch, principal.user.id, principal.user.restrictions)
|
||||
|
|
|
|||
Loading…
Reference in a new issue