commit | 4527a72e20b393de24ad82d5f5114b583d05103d | [log] [tgz] |
---|---|---|
author | 夜雨声烦 <xxi13552467509@163.com> | Wed Apr 23 17:04:25 2025 +0800 |
committer | 夜雨声烦 <xxi13552467509@163.com> | Wed Apr 23 17:44:06 2025 +0800 |
tree | 640ffc78a9396d94525cfb9ab74aa52bb355b65a | |
parent | 3e18466136de0084889408283efd78f35a1bb53f [diff] [blame] |
searchpost Change-Id: I3b471ad217a958e2e8bf22c005b1a3fd36454151
diff --git a/src/main/java/com/example/g8backend/controller/PostController.java b/src/main/java/com/example/g8backend/controller/PostController.java index f373539..a47734a 100644 --- a/src/main/java/com/example/g8backend/controller/PostController.java +++ b/src/main/java/com/example/g8backend/controller/PostController.java
@@ -109,4 +109,14 @@ Long likeCount = postService.getPostLikeCount(postId); return ResponseEntity.ok().body(likeCount); } + + // 搜索帖子 + @GetMapping("/search") + public List<Post> searchPosts( + @RequestParam(required = false) String keyword, + @RequestParam(required = false) List<Long> tags, // 修改为接收多个标签 + @RequestParam(required = false) String author) { + + return postService.searchPosts(keyword, tags, author); + } }