diff --git a/app/src/main/java/io/legado/app/data/dao/BookDao.kt b/app/src/main/java/io/legado/app/data/dao/BookDao.kt index b10e75312..ff150b5c3 100644 --- a/app/src/main/java/io/legado/app/data/dao/BookDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/BookDao.kt @@ -30,8 +30,7 @@ interface BookDao { @Query( """ - select * from books - where type != ${BookType.audio} + select * from books where type != ${BookType.audio} and origin != '${BookType.local}' and ((SELECT sum(groupId) FROM book_groups where groupId > 0) & `group`) = 0 """ ) 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 ea5662e6e..e8a3983a6 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 @@ -21,7 +21,14 @@ interface BookGroupDao { @get:Query( """ SELECT * FROM book_groups where (groupId >= 0 and show > 0) - or (groupId = -4 and show > 0 and (select count(bookUrl) from books where ((SELECT sum(groupId) FROM book_groups where groupId > 0) & `group`) = 0) > 0) + or (groupId = -4 and show > 0 + and ( + select count(bookUrl) from books + where type != '${BookType.audio}' + and origin != '${BookType.local}' + and ((SELECT sum(groupId) FROM book_groups where groupId > 0) & `group`) = 0 + ) > 0 + ) or (groupId = -3 and show > 0 and (select count(bookUrl) from books where type = ${BookType.audio}) > 0) or (groupId = -2 and show > 0 and (select count(bookUrl) from books where origin = '${BookType.local}') > 0) or (groupId = -1 and show > 0)