From 279f9d4b62b4716466839bc69fc7b769a93561d5 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 18 Oct 2020 06:57:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=B4=A9=E6=BA=83bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/data/AppDatabase.kt | 8 ++++---- app/src/main/java/io/legado/app/data/dao/BookGroupDao.kt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/AppDatabase.kt b/app/src/main/java/io/legado/app/data/AppDatabase.kt index 82407528f..7e8acb854 100644 --- a/app/src/main/java/io/legado/app/data/AppDatabase.kt +++ b/app/src/main/java/io/legado/app/data/AppDatabase.kt @@ -49,25 +49,25 @@ abstract class AppDatabase: RoomDatabase() { override fun onOpen(db: SupportSQLiteDatabase) { db.execSQL( """ - insert into book_groups(groupId, groupName, 'order') select ${AppConst.bookGroupAllId}, '全部', -10 + insert into book_groups(groupId, groupName, 'order', show) select ${AppConst.bookGroupAllId}, '全部', -10, 1 where not exists (select * from book_groups where groupId = ${AppConst.bookGroupAllId}) """ ) db.execSQL( """ - insert into book_groups(groupId, groupName, 'order') select ${AppConst.bookGroupLocalId}, '本地', -9 + insert into book_groups(groupId, groupName, 'order', show) select ${AppConst.bookGroupLocalId}, '本地', -9, 1 where not exists (select * from book_groups where groupId = ${AppConst.bookGroupLocalId}) """ ) db.execSQL( """ - insert into book_groups(groupId, groupName, 'order') select ${AppConst.bookGroupAudioId}, '音频', -8 + insert into book_groups(groupId, groupName, 'order', show) select ${AppConst.bookGroupAudioId}, '音频', -8, 1 where not exists (select * from book_groups where groupId = ${AppConst.bookGroupAudioId}) """ ) db.execSQL( """ - insert into book_groups(groupId, groupName, 'order') select ${AppConst.bookGroupNoneId}, '未分组', -7 + insert into book_groups(groupId, groupName, 'order', show) select ${AppConst.bookGroupNoneId}, '未分组', -7, 1 where not exists (select * from book_groups where groupId = ${AppConst.bookGroupNoneId}) """ ) diff --git a/app/src/main/java/io/legado/app/data/dao/BookGroupDao.kt b/app/src/main/java/io/legado/app/data/dao/BookGroupDao.kt index 84b2cdc6e..e0ffea726 100644 --- a/app/src/main/java/io/legado/app/data/dao/BookGroupDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/BookGroupDao.kt @@ -16,7 +16,7 @@ interface BookGroupDao { @Query("SELECT * FROM book_groups ORDER BY `order`") fun liveDataAll(): LiveData> - @Query("SELECT * FROM book_groups where show > 0 ORDER BY `order`") + @Query("SELECT * FROM book_groups where show > 0 or groupId >= 0 ORDER BY `order`") fun liveDataShow(): LiveData> @Query("SELECT * FROM book_groups where groupId >= 0 ORDER BY `order`")