This commit is contained in:
sjm
2023-12-26 23:16:03 +08:00
parent eda0e41b53
commit 8b6b6a6b7a
6 changed files with 57 additions and 81 deletions

View File

@@ -39,13 +39,6 @@ public class CommentController {
return commentService.AddLikeCount(id);
}
// 显示评论
@RequestMapping(method = RequestMethod.GET, value = "/view_comment")
public ResponseEntity<List<CommentNode>> queryObserveByBlogId (
@ApiParam(name = "url_id", value = "id", required = true) @PathVariable Integer url_id
) {
return ResponseEntity.ok(commentService.queryCommentByUrlId(url_id));
}
// 显示回复
@RequestMapping(method = RequestMethod.GET, value = "/view_reply")
@@ -59,10 +52,8 @@ public ResponseEntity<List<CommentNode>> queryObserveByBlogId (
* @param UrlId 博客id
* @return 博客的评论信息
*/
@GetMapping("/UrlId")
public ResponseEntity<List<CommentNode>> queryCommentByUrlId (
@ApiParam(name = "UrlId", value = "urlid", required = true) @PathVariable Integer UrlId
) {
@RequestMapping(method = RequestMethod.GET, value = "/UrlId")
public ResponseEntity<List<CommentNode>> queryCommentByUrlId (Integer UrlId) {
return ResponseEntity.ok(commentService.queryCommentByUrlId(UrlId));
}
@@ -71,10 +62,8 @@ public ResponseEntity<List<CommentNode>> queryObserveByBlogId (
* @param Id 评论id
* @return 评论信息,携带用户信息
*/
@GetMapping("/Id")
public ResponseEntity<CommentUser> queryObserveUserById (
@ApiParam(name = "Id", value = "评论id", required = true)@PathVariable Integer Id
) {
@RequestMapping(method = RequestMethod.GET, value = "/Id")
public ResponseEntity<CommentUser> queryObserveUserById (Integer Id) {
return ResponseEntity.ok(commentService.queryCommentUserById(Id));
}
}

View File

@@ -29,26 +29,8 @@ public interface CommentDao {
List<Comment> selectByAllReply(int id);
@Select("SELECT * FROM ln_comment o LEFT JOIN ln_user u"+
"ON o.user_id=u.id"+
"WHERE o.user_id = #{userId,jdbcType=INTEGER} AND o.root_comment_id = 0")
@Results({
@Result(id = true, column = "id", property = "id"),
@Result(column = "url_id", property = "urlId"),
@Result(column = "user_id", property = "userId"),
@Result(column = "content", property = "content"),
@Result(column = "content", property = "user",
one = @One(select = "com.lovenav.dao.UserDao.queryUserForComment",
fetchType = FetchType.EAGER)),
@Result(column = "root_comment_id", property = "rootCommentId"),
@Result(column = "comment_status", property = "commentStatus"),
@Result(column = "comment_time", property = "commentTime"),
@Result(column = "update_time", property = "updateTime"),
@Result(column = "like_count", property = "likeCount"),
@Result(column = "rating", property = "rating")
})
List<CommentNode> queryFirstCommentList (@Param("urlId") Integer UrlId);
List<CommentNode> queryFirstCommentList (Integer UrlId);
@@ -59,24 +41,6 @@ public interface CommentDao {
* @author RenShiWei
* Date: 2020/4/16 10:37
*/
@Select("SELECT * FROM ln_comment o LEFT JOIN ln_user u " +
"ON o.user_id=u.id " +
"WHERE o.user_id = #{userId,jdbcType=INTEGER} AND o.last_id != 0 ")
@Results({
@Result(id = true, column = "id", property = "id"),
@Result(column = "url_id", property = "urlId"),
@Result(column = "user_id", property = "userId"),
@Result(column = "content", property = "content"),
@Result(column = "content", property = "user",
one = @One(select = "com.lovenav.dao.UserDao.queryUserForComment",
fetchType = FetchType.EAGER)),
@Result(column = "root_comment_id", property = "rootCommentId"),
@Result(column = "comment_status", property = "commentStatus"),
@Result(column = "comment_time", property = "commentTime"),
@Result(column = "update_time", property = "updateTime"),
@Result(column = "like_count", property = "likeCount"),
@Result(column = "rating", property = "rating")
})
List<CommentNode> querySecondCommentList(@Param("urlId")Integer UrlId);
List<CommentNode> querySecondCommentList(Integer UrlId);
}

View File

@@ -143,7 +143,14 @@ public class Comment implements Serializable {
*/
private Integer rating;
public interface UpdateGroup {
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
private static final long serialVersionUID = 1L;

View File

@@ -3,7 +3,7 @@ package com.lovenav.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;