Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
231a22cd
Commit
231a22cd
authored
Feb 04, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
博客评论添加用户的昵称和头像
parent
8da61f2b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
src/main/java/cn/meteor/beyondclouds/modules/blog/entity/BlogComment.java
+9
-2
src/main/java/cn/meteor/beyondclouds/modules/blog/service/impl/BlogCommentServiceImpl.java
+14
-0
No files found.
src/main/java/cn/meteor/beyondclouds/modules/blog/entity/BlogComment.java
View file @
231a22cd
...
...
@@ -2,14 +2,15 @@ package cn.meteor.beyondclouds.modules.blog.entity;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.time.LocalDateTime
;
import
java.io.Serializable
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* <p>
* 博客评论表
...
...
@@ -35,6 +36,12 @@ public class BlogComment implements Serializable {
@ApiModelProperty
(
value
=
"评论者ID"
)
private
String
userId
;
@ApiModelProperty
(
value
=
"用户昵称"
)
private
String
userNick
;
@ApiModelProperty
(
value
=
"用户头像"
)
private
String
userAvatar
;
@ApiModelProperty
(
value
=
"上一级评论ID"
)
private
Integer
parentId
;
...
...
src/main/java/cn/meteor/beyondclouds/modules/blog/service/impl/BlogCommentServiceImpl.java
View file @
231a22cd
...
...
@@ -9,6 +9,8 @@ import cn.meteor.beyondclouds.modules.blog.exception.BlogServiceException;
import
cn.meteor.beyondclouds.modules.blog.mapper.BlogCommentMapper
;
import
cn.meteor.beyondclouds.modules.blog.service.IBlogCommentService
;
import
cn.meteor.beyondclouds.modules.blog.service.IBlogService
;
import
cn.meteor.beyondclouds.modules.user.entity.User
;
import
cn.meteor.beyondclouds.modules.user.service.IUserService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -30,11 +32,18 @@ public class BlogCommentServiceImpl extends ServiceImpl<BlogCommentMapper, BlogC
private
IBlogService
blogService
;
private
IUserService
userService
;
@Autowired
public
void
setBlogService
(
IBlogService
blogService
)
{
this
.
blogService
=
blogService
;
}
@Autowired
public
void
setUserService
(
IUserService
userService
)
{
this
.
userService
=
userService
;
}
/**
* 发布评论
* @param blogId
...
...
@@ -77,12 +86,17 @@ public class BlogCommentServiceImpl extends ServiceImpl<BlogCommentMapper, BlogC
}
//2.创建评论
// 查找用户
User
user
=
userService
.
getById
(
userId
);
BlogComment
blogComment
=
new
BlogComment
();
blogComment
.
setBlogId
(
blogId
);
blogComment
.
setComment
(
comment
);
blogComment
.
setDepth
(
depth
);
blogComment
.
setParentId
(
parentId
);
blogComment
.
setUserId
(
userId
);
blogComment
.
setUserNick
(
user
.
getNickName
());
blogComment
.
setUserAvatar
(
user
.
getUserAvatar
());
save
(
blogComment
);
//3.查找上一层目录
if
(
blogComment
.
getParentId
()
==
null
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment