提交 e82f7f74 authored 作者: Whispa's avatar Whispa

commit

上级 7fc75c08
......@@ -163,7 +163,7 @@ public class PostController {
@GetMapping("/listPostsByUser/{userId}")
public List<Post> postListBy(@PathVariable(value = "userId") String id, @RequestParam(value = "pageNo") Integer pageNo, @RequestParam(value = "pageSize") Integer pageSize) {
List<Post> postList = repository.findAllByUserInfoUserIdOrderByIdDesc(id, PageRequest.of(pageNo, pageSize)).toList();
List<Post> postList = repository.findAllByUserInfoUserIdOrderByCreateDateDesc(id, PageRequest.of(pageNo, pageSize)).toList();
return this.postList(postList, id);
}
......
......@@ -10,7 +10,7 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
public interface PostRepository extends PagingAndSortingRepository<Post, String> {
Page<Post> findAllByUserInfoUserIdOrderByIdDesc(String tUser_userId, Pageable pageable);
Page<Post> findAllByUserInfoUserIdOrderByCreateDateDesc(String tUser_userId, Pageable pageable);
Page<Post> findAllByDescriptionContainingOrTitleContainingOrUserInfoNickContaining(String query, String query1, String query2, Pageable pageable);
//@Query(value = "select a from #{#entityName} a WHERE EXISTS(SELECT f.follower FROM Following f WHERE f.follower=:me and f.followed=a.user)")
//Page<Post> findAllByOrderByIdDesc(@Param("me") User user, Pageable pageable);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论