From ec4ac10cd3a712e44bf1b24757300962a2d1aebf Mon Sep 17 00:00:00 2001 From: whz <303054730@qq.com> Date: Fri, 31 May 2024 09:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/lk/paopao/dto/rest/response/Paged.java | 2 +- src/main/java/com/lk/paopao/repository/PostRepository.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/lk/paopao/dto/rest/response/Paged.java b/src/main/java/com/lk/paopao/dto/rest/response/Paged.java index e7ceb85..5ac96b0 100644 --- a/src/main/java/com/lk/paopao/dto/rest/response/Paged.java +++ b/src/main/java/com/lk/paopao/dto/rest/response/Paged.java @@ -17,7 +17,7 @@ public class Paged implements Serializable { public Paged(List list, Long totalRows, Integer page, Integer pageSize){ this.list = list; - pager = new Pager(page, pageSize, totalRows); + this.pager = new Pager(page, pageSize, totalRows); } @Getter diff --git a/src/main/java/com/lk/paopao/repository/PostRepository.java b/src/main/java/com/lk/paopao/repository/PostRepository.java index b4c5689..5acef9d 100644 --- a/src/main/java/com/lk/paopao/repository/PostRepository.java +++ b/src/main/java/com/lk/paopao/repository/PostRepository.java @@ -7,10 +7,10 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; public interface PostRepository extends JpaRepository { - @Query("SELECT p FROM Post p where isDel=0 ORDER BY p.createdOn DESC") + @Query(value = "SELECT p FROM Post p where isDel=0") Page findAllNewest(Pageable pageable); - @Query("SELECT p FROM Post p where isDel=0 and p.tags LIKE CONCAT('%', :tag, '%') ORDER BY p.createdOn DESC") + @Query("SELECT p FROM Post p where p.isDel=0 and p.tags LIKE CONCAT('%', :tag, '%') ") Page findAllNewestByTag(String tag, Pageable pageable); }