From 176454eae79876ccaa8db01fc9a707ab177b8b3c Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 23 Sep 2022 17:43:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E4=B9=A6=E7=B1=8D=E4=B8=8D?= =?UTF-8?q?=E6=94=BE=E5=85=A5=E6=9C=AA=E5=88=86=E7=BB=84,=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E4=B9=8B=E5=89=8D=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/data/dao/BookDao.kt | 3 +-- app/src/main/java/io/legado/app/data/dao/BookGroupDao.kt | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) 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)