mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix(sql): Union issue
It doesn't like history.*
This commit is contained in:
parent
3199f07363
commit
6e3eaad481
2 changed files with 24 additions and 16 deletions
|
@ -84,7 +84,7 @@ data class MangaChapterHistory(val manga: Manga, val chapter: Chapter, val histo
|
||||||
mangaId = _mangaId!!,
|
mangaId = _mangaId!!,
|
||||||
url = chapterUrl!!,
|
url = chapterUrl!!,
|
||||||
name = name!!,
|
name = name!!,
|
||||||
scanlator = scanlator!!,
|
scanlator = scanlator,
|
||||||
read = read!!,
|
read = read!!,
|
||||||
bookmark = bookmark!!,
|
bookmark = bookmark!!,
|
||||||
lastPageRead = lastPageRead!!,
|
lastPageRead = lastPageRead!!,
|
||||||
|
@ -98,11 +98,12 @@ data class MangaChapterHistory(val manga: Manga, val chapter: Chapter, val histo
|
||||||
historyId?.let {
|
historyId?.let {
|
||||||
History.mapper(
|
History.mapper(
|
||||||
id = historyId,
|
id = historyId,
|
||||||
chapterId = historyChapterId!!,
|
chapterId = historyChapterId ?: chapterId ?: 0L,
|
||||||
lastRead = historyLastRead,
|
lastRead = historyLastRead,
|
||||||
timeRead = historyTimeRead,
|
timeRead = historyTimeRead,
|
||||||
)
|
)
|
||||||
} ?: History.create().apply {
|
} ?: History.create().apply {
|
||||||
|
(historyChapterId ?: chapterId)?.let { chapter_id = it }
|
||||||
historyLastRead?.let { last_read = it }
|
historyLastRead?.let { last_read = it }
|
||||||
historyTimeRead?.let { time_read = it }
|
historyTimeRead?.let { time_read = it }
|
||||||
},
|
},
|
||||||
|
|
|
@ -67,7 +67,10 @@ SELECT * FROM (
|
||||||
SELECT
|
SELECT
|
||||||
mangas.*,
|
mangas.*,
|
||||||
chapters.*,
|
chapters.*,
|
||||||
history.*
|
history.history_id AS history_id,
|
||||||
|
history.history_chapter_id AS history_chapter_id,
|
||||||
|
history.history_last_read AS history_last_read,
|
||||||
|
history.history_time_read AS history_time_read
|
||||||
FROM (
|
FROM (
|
||||||
SELECT mangas.*
|
SELECT mangas.*
|
||||||
FROM mangas
|
FROM mangas
|
||||||
|
@ -166,24 +169,28 @@ UNION --
|
||||||
SELECT * FROM (
|
SELECT * FROM (
|
||||||
SELECT
|
SELECT
|
||||||
mangas.*,
|
mangas.*,
|
||||||
NULL AS _id,
|
chapters.*,
|
||||||
NULL AS manga_id,
|
|
||||||
NULL AS url,
|
|
||||||
NULL AS name,
|
|
||||||
NULL AS read,
|
|
||||||
NULL AS scanlator,
|
|
||||||
NULL AS bookmark,
|
|
||||||
NULL AS date_fetch,
|
|
||||||
NULL AS date_upload,
|
|
||||||
NULL AS last_page_read,
|
|
||||||
NULL AS pages_left,
|
|
||||||
NULL AS chapter_number,
|
|
||||||
NULL AS source_order,
|
|
||||||
NULL AS history_id,
|
NULL AS history_id,
|
||||||
NULL AS history_chapter_id,
|
NULL AS history_chapter_id,
|
||||||
mangas.date_added AS history_last_read,
|
mangas.date_added AS history_last_read,
|
||||||
NULL AS history_time_read
|
NULL AS history_time_read
|
||||||
FROM mangas
|
FROM mangas
|
||||||
|
JOIN (
|
||||||
|
SELECT
|
||||||
|
NULL AS _id,
|
||||||
|
NULL AS manga_id,
|
||||||
|
NULL AS url,
|
||||||
|
NULL AS name,
|
||||||
|
NULL AS read,
|
||||||
|
NULL AS scanlator,
|
||||||
|
NULL AS bookmark,
|
||||||
|
NULL AS date_fetch,
|
||||||
|
NULL AS date_upload,
|
||||||
|
NULL AS last_page_read,
|
||||||
|
NULL AS pages_left,
|
||||||
|
NULL AS chapter_number,
|
||||||
|
NULL AS source_order
|
||||||
|
) AS chapters
|
||||||
WHERE favorite = 1
|
WHERE favorite = 1
|
||||||
AND lower(title) LIKE '%' || :search || '%'
|
AND lower(title) LIKE '%' || :search || '%'
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue