This commit is contained in:
whz 2024-05-31 09:52:30 +08:00
parent 45a3065210
commit ec4ac10cd3
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ public class Paged<T> implements Serializable {
public Paged(List<T> list, Long totalRows, Integer page, Integer pageSize){
this.list = list;
pager = new Pager(page, pageSize, totalRows);
this.pager = new Pager(page, pageSize, totalRows);
}
@Getter

View File

@ -7,10 +7,10 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
public interface PostRepository extends JpaRepository<Post, Long> {
@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<Post> 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<Post> findAllNewestByTag(String tag, Pageable pageable);
}