diff --git a/app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt b/app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt index 5e828396a..a2260b4f9 100644 --- a/app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt @@ -22,20 +22,36 @@ interface SearchBookDao { @Query("select * from searchBooks where name = :name and author = :author and origin in (select bookSourceUrl from book_sources where enabled = 1) order by originOrder limit 1") fun getFirstByNameAuthor(name: String, author: String): SearchBook? - @Query("select * from searchBooks where name = :name and author = :author order by originOrder") - fun getByNameAuthor(name: String, author: String): List - - @Query("select * from searchBooks where name = :name and author = :author and origin in (select bookSourceUrl from book_sources where enabled = 1) order by originOrder") + @Query( + """ + select t1.name, t1.author, t1.origin, t1.originName, t1.coverUrl, t1.bookUrl, t1.type, t1.time, t1.intro, t1.kind, t1.latestChapterTitle, t1.tocUrl, t1.variable, t1.wordCount, t2.customOrder as originOrder + from searchBooks as t1 inner join book_sources as t2 + on t1.origin = t2.bookSourceUrl + where t1.name = :name and t1.author = :author + order by t2.customOrder + """ + ) fun getByNameAuthorEnable(name: String, author: String): List - @Query("select * from searchBooks where name = :name and author = :author and originName like '%'||:key||'%' and origin in (select bookSourceUrl from book_sources where enabled = 1) order by originOrder") + @Query( + """ + select t1.name, t1.author, t1.origin, t1.originName, t1.coverUrl, t1.bookUrl, t1.type, t1.time, t1.intro, t1.kind, t1.latestChapterTitle, t1.tocUrl, t1.variable, t1.wordCount, t2.customOrder as originOrder + from searchBooks as t1 inner join book_sources as t2 + on t1.origin = t2.bookSourceUrl + where t1.name = :name and t1.author = :author and originName like '%'||:key||'%' + order by t2.customOrder + """ + ) fun getChangeSourceSearch(name: String, author: String, key: String): List @Query( - """select * from searchBooks - where name = :name and author = :author and origin in (select bookSourceUrl from book_sources where enabled = 1) - and coverUrl is not null and coverUrl <> '' - order by originOrder""" + """ + select t1.name, t1.author, t1.origin, t1.originName, t1.coverUrl, t1.bookUrl, t1.type, t1.time, t1.intro, t1.kind, t1.latestChapterTitle, t1.tocUrl, t1.variable, t1.wordCount, t2.customOrder as originOrder + from searchBooks as t1 inner join book_sources as t2 + on t1.origin = t2.bookSourceUrl + where t1.name = :name and t1.author = :author and t1.coverUrl is not null and t1.coverUrl <> '' + order by t2.customOrder + """ ) fun getEnableHasCover(name: String, author: String): List