@@ -26,26 +26,29 @@ interface BookGroupDao {
|
||||
@get:Query(
|
||||
"""
|
||||
with const as (SELECT sum(groupId) sumGroupId FROM book_groups where groupId > 0)
|
||||
SELECT book_groups.* FROM book_groups, const
|
||||
where (groupId >= 0 and show > 0 and exists (select 1 from books where `group` & book_groups.groupId > 0))
|
||||
or (groupId = -1 and show > 0)
|
||||
or (groupId = -2 and show > 0 and exists (select 1 from books where type & ${BookType.local} > 0))
|
||||
or (groupId = -3 and show > 0 and exists (select 1 from books where type & ${BookType.audio} > 0))
|
||||
or (groupId = -11 and show > 0 and exists (select 1 from books where type & ${BookType.updateError} > 0))
|
||||
or (groupId = -4 and show > 0
|
||||
and exists (
|
||||
select 1 from books
|
||||
where type & ${BookType.audio} = 0
|
||||
and type & ${BookType.local} = 0
|
||||
and const.sumGroupId & `group` = 0
|
||||
SELECT book_groups.* FROM book_groups join const
|
||||
where show > 0
|
||||
and (
|
||||
(groupId >= 0 and exists (select 1 from books where `group` & book_groups.groupId > 0))
|
||||
or groupId = -1
|
||||
or (groupId = -2 and exists (select 1 from books where type & ${BookType.local} > 0))
|
||||
or (groupId = -3 and exists (select 1 from books where type & ${BookType.audio} > 0))
|
||||
or (groupId = -11 and exists (select 1 from books where type & ${BookType.updateError} > 0))
|
||||
or (groupId = -4
|
||||
and exists (
|
||||
select 1 from books
|
||||
where type & ${BookType.audio} = 0
|
||||
and type & ${BookType.local} = 0
|
||||
and const.sumGroupId & `group` = 0
|
||||
)
|
||||
)
|
||||
)
|
||||
or (groupId = -5 and show > 0
|
||||
and exists (
|
||||
select 1 from books
|
||||
where type & ${BookType.audio} = 0
|
||||
and type & ${BookType.local} > 0
|
||||
and const.sumGroupId & `group` = 0
|
||||
or (groupId = -5
|
||||
and exists (
|
||||
select 1 from books
|
||||
where type & ${BookType.audio} = 0
|
||||
and type & ${BookType.local} > 0
|
||||
and const.sumGroupId & `group` = 0
|
||||
)
|
||||
)
|
||||
)
|
||||
ORDER BY `order`"""
|
||||
|
||||
Reference in New Issue
Block a user