fix: 换源数据

pull/95/head 3.20.021109
kunfei 5 years ago
parent 8cf16178d4
commit e9f9963fa0
  1. 34
      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") @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? fun getFirstByNameAuthor(name: String, author: String): SearchBook?
@Query("select * from searchBooks where name = :name and author = :author order by originOrder") @Query(
fun getByNameAuthor(name: String, author: String): List<SearchBook> """
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
@Query("select * from searchBooks where name = :name and author = :author and origin in (select bookSourceUrl from book_sources where enabled = 1) order by 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<SearchBook> fun getByNameAuthorEnable(name: String, author: String): List<SearchBook>
@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<SearchBook> fun getChangeSourceSearch(name: String, author: String, key: String): List<SearchBook>
@Query( @Query(
"""select * from searchBooks """
where name = :name and author = :author and origin in (select bookSourceUrl from book_sources where enabled = 1) 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
and coverUrl is not null and coverUrl <> '' from searchBooks as t1 inner join book_sources as t2
order by originOrder""" 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<SearchBook> fun getEnableHasCover(name: String, author: String): List<SearchBook>

Loading…
Cancel
Save