1.add status enable condition for journal filter

main
Gary 9 months ago
parent b7d6e25126
commit 77054a7a2a

@ -62,22 +62,22 @@ public interface JournalDao extends JpaRepository<Journal,String>,JpaSpecificati
@Query("UPDATE Journal j SET j.comment = j.comment - 1 WHERE j.id = :journalId") @Query("UPDATE Journal j SET j.comment = j.comment - 1 WHERE j.id = :journalId")
int decreaseCommentCount(@Param("journalId") String 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<Journal> orderByField(List<String> objectIds); List<Journal> orderByField(List<String> 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); 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); 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(); 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<String> random(int limit, List<String> recommendIds); List<String> random(int limit, List<String> 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<String> random(int limit); List<String> random(int limit);
} }

Loading…
Cancel
Save