From e9f9963fa0707cdcd4210dbb33f01127b57b8ddd Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 11 Feb 2020 09:57:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8D=A2=E6=BA=90=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/data/dao/SearchBookDao.kt | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) 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