Commit ac06f7be by 段启岩

修复能修改他人博客的问题

parent eed2be66
......@@ -242,8 +242,13 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
Assert.notNull(blog, "blog must not be null");
Assert.notNull(blog.getBlogId(), "blogId must not be null");
Assert.notNull(blog.getUserId(),"userId must not be null");
//1.判断当前用户是否拥有此博客
Blog blogInDb = getById(blog);
QueryWrapper<Blog> blogQueryWrapper = new QueryWrapper<>();
blogQueryWrapper
.eq("blog_id", blog.getBlogId())
.eq("user_id", blog.getUserId());
Blog blogInDb = getOne(blogQueryWrapper);
if (null == blogInDb) {
throw new BlogServiceException(BlogErrorCode.BLOG_NOT_FOUND);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment