From 4055c5b5b51038f6690ef2584ad51e6c68e899c0 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 25 Feb 2020 19:27:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/data/dao/BookSourceDao.kt | 10 ++-------- .../main/java/io/legado/app/data/dao/RssSourceDao.kt | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) 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")