This commit is contained in:
kunfei 2022-06-29 20:52:37 +08:00
parent 3779e3a3b6
commit 381568a60f
2 changed files with 9 additions and 8 deletions

View File

@ -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<SearchBook>
fun changeSourceByGroup(name: String, author: String, sourceGroup: String): List<SearchBook>
@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,

View File

@ -222,21 +222,21 @@ open class ChangeBookSourceViewModel(application: Application) : BaseViewModel(a
private fun getDbSearchBooks(): List<SearchBook> {
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
)
}