优化
This commit is contained in:
parent
45a3065210
commit
ec4ac10cd3
@ -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
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user