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`")