diff --git a/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt b/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt index d2b48fa49..85965050c 100644 --- a/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt @@ -29,14 +29,14 @@ interface BookSourceDao { @Query("select distinct enabled from book_sources where bookSourceName like :searchKey or bookSourceGroup like :searchKey or bookSourceUrl like :searchKey") fun searchIsEnable(searchKey: String = ""): List - @Query("update book_sources set enabled = 1 where bookSourceUrl in (:sourceUrls)") - fun enableSection(vararg sourceUrls: String) + @Query("update book_sources set enabled = 1 where bookSourceUrl = :sourceUrl") + fun enableSection(sourceUrl: String) - @Query("update book_sources set enabled = 0 where bookSourceUrl in (:sourceUrls)") - fun disableSection(vararg sourceUrls: String) + @Query("update book_sources set enabled = 0 where bookSourceUrl = :sourceUrl") + fun disableSection(sourceUrl: String) - @Query("delete from book_sources where bookSourceUrl in (:sourceUrls)") - fun delSection(vararg sourceUrls: String) + @Query("delete from book_sources where bookSourceUrl = :sourceUrl") + fun delSection(sourceUrl: String) @Query("select * from book_sources where enabledExplore = 1 order by customOrder asc") fun observeFind(): DataSource.Factory diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt index 598167e43..4c36f0d59 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt @@ -69,8 +69,8 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) val sources = App.db.bookSourceDao().noGroup sources.map { source -> source.bookSourceGroup = group - App.db.bookSourceDao().update(source) } + App.db.bookSourceDao().update(*sources.toTypedArray()) } } @@ -84,8 +84,8 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) it.add(newGroup) source.bookSourceGroup = TextUtils.join(",", it) } - App.db.bookSourceDao().update(source) } + App.db.bookSourceDao().update(*sources.toTypedArray()) } } @@ -98,8 +98,8 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) it.remove(group) source.bookSourceGroup = TextUtils.join(",", it) } - App.db.bookSourceDao().update(source) } + App.db.bookSourceDao().update(*sources.toTypedArray()) } } }