pull/32/head
kunfei 5 years ago
parent be3b85a3d9
commit cc2d7be337
  1. 2
      app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt
  2. 2
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceViewModel.kt

@ -29,7 +29,7 @@ interface SearchBookDao {
@Query("select * from searchBooks where name = :name and author = :author order by originOrder") @Query("select * from searchBooks where name = :name and author = :author order by originOrder")
fun getByNameAuthor(name: String, author: String): List<SearchBook> fun getByNameAuthor(name: String, author: String): List<SearchBook>
@Query("select * from searchBooks where name = :name and author = :author order by 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")
fun getByNameAuthorEnable(name: String, author: String): List<SearchBook> fun getByNameAuthorEnable(name: String, author: String): List<SearchBook>
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)

@ -14,7 +14,7 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
fun startSearch() { fun startSearch() {
execute { execute {
App.db.searchBookDao().getByNameAuthor(name, author).let { App.db.searchBookDao().getByNameAuthorEnable(name, author).let {
searchBookData.postValue(it) searchBookData.postValue(it)
} }
} }

Loading…
Cancel
Save