From 381568a60ff7ae0addcce3016a39c1316cf122c8 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 29 Jun 2022 20:52:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/data/dao/SearchBookDao.kt | 9 +++++---- .../ui/book/changesource/ChangeBookSourceViewModel.kt | 8 ++++---- 2 files changed, 9 insertions(+), 8 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 68dc78da3..9f9e8ba44 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,7 +22,7 @@ interface SearchBookDao { and t2.enabled = 1 and t2.bookSourceGroup like '%'||:sourceGroup||'%' order by t2.customOrder""" ) - fun getChangeSourceSearch(name: String, author: String, sourceGroup: String): List + fun changeSourceByGroup(name: String, author: String, sourceGroup: String): List @Query( """select t1.name, t1.author, t1.origin, t1.originName, t1.coverUrl, t1.bookUrl, @@ -30,12 +30,13 @@ interface SearchBookDao { 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 like '%'||:author||'%' - and originName like '%'||:key||'%' and t2.enabled = 1 + where t1.name = :name and t1.author like '%'||:author||'%' and t2.bookSourceGroup like '%'||:sourceGroup||'%' + and (originName like '%'||:key||'%' or t1.latestChapterTitle like '%'||:key||'%') + and t2.enabled = 1 order by t2.customOrder""" ) - fun getChangeSourceSearch( + fun changeSourceSearch( name: String, author: String, key: String, diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceViewModel.kt index 625428657..1aa7cca12 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceViewModel.kt @@ -222,21 +222,21 @@ open class ChangeBookSourceViewModel(application: Application) : BaseViewModel(a private fun getDbSearchBooks(): List { return if (screenKey.isEmpty()) { if (AppConfig.changeSourceCheckAuthor) { - appDb.searchBookDao.getChangeSourceSearch( + appDb.searchBookDao.changeSourceByGroup( name, author, AppConfig.searchGroup ) } else { - appDb.searchBookDao.getChangeSourceSearch( + appDb.searchBookDao.changeSourceByGroup( name, "", AppConfig.searchGroup ) } } else { if (AppConfig.changeSourceCheckAuthor) { - appDb.searchBookDao.getChangeSourceSearch( + appDb.searchBookDao.changeSourceSearch( name, author, screenKey, AppConfig.searchGroup ) } else { - appDb.searchBookDao.getChangeSourceSearch( + appDb.searchBookDao.changeSourceSearch( name, "", screenKey, AppConfig.searchGroup ) }