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 e80f590f5..94fe063f4 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 @@ -17,13 +17,7 @@ interface BookSourceDao { @Query("select * from book_sources where enabledExplore = 1 and trim(exploreUrl) <> '' order by customOrder asc") fun liveExplore(): LiveData> - @Query( - """ - select * from book_sources - where enabledExplore = 1 and trim(exploreUrl) <> '' and (bookSourceGroup like :key or bookSourceName like :key) - order by customOrder asc - """ - ) + @Query(" select * from book_sources where enabledExplore = 1 and trim(exploreUrl) <> '' and (bookSourceGroup like :key or bookSourceName like :key) order by customOrder asc ") fun liveExplore(key: String): LiveData> @Query("select bookSourceGroup from book_sources where trim(bookSourceGroup) <> ''") @@ -47,7 +41,7 @@ interface BookSourceDao { @Query("select * from book_sources where enabled = 1 and bookSourceGroup like '%' || :group || '%'") fun getEnabledByGroup(group: String): List - @get:Query("select * from book_sources where bookUrlPattern is not null || bookUrlPattern <> ''") + @get:Query("select * from book_sources where trim(bookUrlPattern) <> ''") val hasBookUrlPattern: List @get:Query("select * from book_sources where bookSourceGroup is null or bookSourceGroup = ''") diff --git a/app/src/main/java/io/legado/app/data/dao/RssSourceDao.kt b/app/src/main/java/io/legado/app/data/dao/RssSourceDao.kt index c1c1e85d9..5436ee26c 100644 --- a/app/src/main/java/io/legado/app/data/dao/RssSourceDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/RssSourceDao.kt @@ -28,7 +28,7 @@ interface RssSourceDao { @Query("SELECT * FROM rssSources where enabled = 1 order by customOrder") fun liveEnabled(): LiveData> - @Query("select sourceGroup from rssSources where sourceGroup is not null and sourceGroup <> ''") + @Query("select sourceGroup from rssSources where trim(sourceGroup) <> ''") fun liveGroup(): LiveData> @get:Query("select min(customOrder) from rssSources")