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); }