From 77054a7a2a59858a8cc362bfdfa8ddc529426bd8 Mon Sep 17 00:00:00 2001 From: Gary Date: Sat, 17 Feb 2024 23:56:03 +0800 Subject: [PATCH] 1.add status enable condition for journal filter --- .../src/main/java/com/luoo/music/dao/JournalDao.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/luoo_music/src/main/java/com/luoo/music/dao/JournalDao.java b/luoo_music/src/main/java/com/luoo/music/dao/JournalDao.java index 480d99d..7e6f790 100644 --- a/luoo_music/src/main/java/com/luoo/music/dao/JournalDao.java +++ b/luoo_music/src/main/java/com/luoo/music/dao/JournalDao.java @@ -62,22 +62,22 @@ public interface JournalDao extends JpaRepository,JpaSpecificati @Query("UPDATE Journal j SET j.comment = j.comment - 1 WHERE j.id = :journalId") int decreaseCommentCount(@Param("journalId") String journalId); - @Query(value = "select * from tb_journal where id in ?1 order by field(id,?1)", nativeQuery = true) + @Query(value = "select * from tb_journal where id in ?1 and state='1' order by field(id,?1)", nativeQuery = true) List orderByField(List objectIds); - @Query(value = "select 1 from tb_journal where ?1 in (select journal_no_tmp.journal_no from (select * from tb_journal order by ABS(journal_no) desc limit 10) as journal_no_tmp) limit 1", nativeQuery = true) + @Query(value = "select 1 from tb_journal where ?1 in (select journal_no_tmp.journal_no from (select * from tb_journal order by ABS(journal_no) desc limit 10) as journal_no_tmp) and state='1' limit 1", nativeQuery = true) Integer isLatest10ByJournalNo(String journalNo); - @Query(value = "select 1 from tb_journal where ?1 in (select journal_no_tmp.id from (select * from tb_journal order by ABS(journal_no) desc limit 10) as journal_no_tmp) limit 1", nativeQuery = true) + @Query(value = "select 1 from tb_journal where ?1 in (select journal_no_tmp.id from (select * from tb_journal order by ABS(journal_no) desc limit 10) as journal_no_tmp) and state='1' limit 1", nativeQuery = true) Integer isLatest10ByJournalId(String journalId); - @Query(value = "select max(ABS(journal_no)) FROM tb_journal", nativeQuery = true) + @Query(value = "select max(ABS(journal_no)) FROM tb_journal where state='1'", nativeQuery = true) int getMaxJournalNo(); - @Query(value = "select id from tb_journal where id not in ?2 order by rand() limit ?1", nativeQuery = true) + @Query(value = "select id from tb_journal where id not in ?2 and state='1' order by rand() limit ?1", nativeQuery = true) List random(int limit, List recommendIds); - @Query(value = "select id from tb_journal order by rand() limit ?1", nativeQuery = true) + @Query(value = "select id from tb_journal where state='1' order by rand() limit ?1", nativeQuery = true) List random(int limit); }