Commit c98ba008 by Author name

2.2发布评论完善验证,博客发布修改的博客类型验证完成,博客评论展示完成

parent d59d9d2c
...@@ -9,6 +9,7 @@ import cn.meteor.beyondclouds.core.api.Response; ...@@ -9,6 +9,7 @@ import cn.meteor.beyondclouds.core.api.Response;
import cn.meteor.beyondclouds.core.bean.Subject; import cn.meteor.beyondclouds.core.bean.Subject;
import cn.meteor.beyondclouds.modules.blog.bean.BlogDetail; import cn.meteor.beyondclouds.modules.blog.bean.BlogDetail;
import cn.meteor.beyondclouds.modules.blog.entity.Blog; import cn.meteor.beyondclouds.modules.blog.entity.Blog;
import cn.meteor.beyondclouds.modules.blog.exception.BlogCategoryServiceException;
import cn.meteor.beyondclouds.modules.blog.exception.BlogServiceException; import cn.meteor.beyondclouds.modules.blog.exception.BlogServiceException;
import cn.meteor.beyondclouds.modules.blog.form.PublishBlogForm; import cn.meteor.beyondclouds.modules.blog.form.PublishBlogForm;
import cn.meteor.beyondclouds.modules.blog.form.UpdateBlogForm; import cn.meteor.beyondclouds.modules.blog.form.UpdateBlogForm;
...@@ -42,7 +43,7 @@ public class BlogApi { ...@@ -42,7 +43,7 @@ public class BlogApi {
@ApiOperation("发布博客") @ApiOperation("发布博客")
@PostMapping("/blog") @PostMapping("/blog")
public Response publishBlog (@RequestBody @Valid PublishBlogForm publishBlogForm, BindingResult result, @CurrentSubject Subject subject) throws OssException { public Response publishBlog (@RequestBody @Valid PublishBlogForm publishBlogForm, BindingResult result, @CurrentSubject Subject subject) {
if (result.hasErrors()) { if (result.hasErrors()) {
return Response.fieldError(result.getFieldError()); return Response.fieldError(result.getFieldError());
} }
...@@ -51,9 +52,14 @@ public class BlogApi { ...@@ -51,9 +52,14 @@ public class BlogApi {
BeanUtils.copyProperties(publishBlogForm, blog); BeanUtils.copyProperties(publishBlogForm, blog);
blog.setUserId((String) subject.getId()); blog.setUserId((String) subject.getId());
try {
blogService.publishBlog(blog, publishBlogForm.getBlogContent(), blogService.publishBlog(blog, publishBlogForm.getBlogContent(),
publishBlogForm.getTopicIds(), publishBlogForm.getTagIds()); publishBlogForm.getTopicIds(), publishBlogForm.getTagIds());
return Response.success(); return Response.success();
} catch (BlogCategoryServiceException e) {
e.printStackTrace();
return Response.error(e);
}
} }
...@@ -137,7 +143,7 @@ public class BlogApi { ...@@ -137,7 +143,7 @@ public class BlogApi {
try { try {
blogService.updateBlog(blog, updateBlogForm.getContent(),updateBlogForm.getTopicIds(),updateBlogForm.getTagIds()); blogService.updateBlog(blog, updateBlogForm.getContent(),updateBlogForm.getTopicIds(),updateBlogForm.getTagIds());
return Response.success(); return Response.success();
} catch (BlogServiceException e) { } catch (BlogServiceException | BlogCategoryServiceException e) {
e.printStackTrace(); e.printStackTrace();
return Response.error(e); return Response.error(e);
} }
......
package cn.meteor.beyondclouds.modules.blog.api; package cn.meteor.beyondclouds.modules.blog.api;
import cn.meteor.beyondclouds.common.form.PageForm;
import cn.meteor.beyondclouds.common.vo.PageVO;
import cn.meteor.beyondclouds.core.annotation.CurrentSubject; import cn.meteor.beyondclouds.core.annotation.CurrentSubject;
import cn.meteor.beyondclouds.core.api.Response; import cn.meteor.beyondclouds.core.api.Response;
import cn.meteor.beyondclouds.core.bean.Subject; import cn.meteor.beyondclouds.core.bean.Subject;
import cn.meteor.beyondclouds.modules.blog.entity.BlogComment;
import cn.meteor.beyondclouds.modules.blog.exception.BlogCommentServiceException; import cn.meteor.beyondclouds.modules.blog.exception.BlogCommentServiceException;
import cn.meteor.beyondclouds.modules.blog.exception.BlogServiceException;
import cn.meteor.beyondclouds.modules.blog.form.BlogCommentForm; import cn.meteor.beyondclouds.modules.blog.form.BlogCommentForm;
import cn.meteor.beyondclouds.modules.blog.service.IBlogCommentService; import cn.meteor.beyondclouds.modules.blog.service.IBlogCommentService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -30,11 +35,16 @@ public class BlogCommentApi { ...@@ -30,11 +35,16 @@ public class BlogCommentApi {
@ApiOperation("发表评论") @ApiOperation("发表评论")
@PostMapping("/blog/{blogId}/comment") @PostMapping("/blog/{blogId}/comment")
public Response createComment (@PathVariable("blogId") String blogId, @RequestBody @Valid BlogCommentForm blogCommentForm, @CurrentSubject Subject subject){ public Response createComment (@PathVariable("blogId") String blogId, @RequestBody @Valid BlogCommentForm blogCommentForm, @CurrentSubject Subject subject) {
try {
blogCommentService.commentCreate(blogId, blogCommentForm.getParentId(), blogCommentService.commentCreate(blogId, blogCommentForm.getParentId(),
blogCommentForm.getComment(), (String) subject.getId()); blogCommentForm.getComment(), (String) subject.getId());
return Response.success(); return Response.success();
} catch (BlogServiceException | BlogCommentServiceException e) {
e.printStackTrace();
return Response.error(e);
}
} }
@ApiOperation("删除评论") @ApiOperation("删除评论")
...@@ -48,4 +58,21 @@ public class BlogCommentApi { ...@@ -48,4 +58,21 @@ public class BlogCommentApi {
return Response.error(e); return Response.error(e);
} }
} }
@ApiOperation("评论列表")
@GetMapping("/blog/{blogId}/comments")
public Response<PageVO<BlogComment>> getBlogCommentPage(@PathVariable("blogId") String bLogId ,
@Valid PageForm pageForm ,
@RequestParam(value = "parent_id",required = false) Integer parentId) {
//获取评论列表
try {
IPage<BlogComment> commentPage = blogCommentService.getCommentPage(pageForm.getPage(), pageForm.getSize(), bLogId, parentId);
PageVO<BlogComment> blogCommentPageVO = new PageVO<>(commentPage);
return Response.success(blogCommentPageVO);
} catch (BlogCommentServiceException e) {
e.printStackTrace();
return Response.error(e);
}
}
} }
package cn.meteor.beyondclouds.modules.blog.enums;
import cn.meteor.beyondclouds.core.IErrorCode;
/**
* @author gaoTong
* @date 2020/2/2 10:02
*/
public enum BlogCategoryErrorCode implements IErrorCode {
INCORRECT_CATEGORY(8005,"博客分类错误")
;
private long code;
private String msg;
BlogCategoryErrorCode(long code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public long code() {
return code;
}
@Override
public String msg() {
return msg;
}
}
...@@ -8,7 +8,8 @@ import cn.meteor.beyondclouds.core.IErrorCode; ...@@ -8,7 +8,8 @@ import cn.meteor.beyondclouds.core.IErrorCode;
*/ */
public enum BlogCommentErrorCode implements IErrorCode { public enum BlogCommentErrorCode implements IErrorCode {
COMMENT_NOT_FOUND(8003,"该评论不存在"), COMMENT_NOT_FOUND(8003,"该评论不存在"),
NO_DELETE_PRIVILEGES(8004,"没有权限删除评论") NO_DELETE_PRIVILEGES(8004,"没有权限删除评论"),
PARENT_COMMENT_NOT_FOUND(8006,"父评论不存在"),
; ;
private long code; private long code;
......
...@@ -2,6 +2,7 @@ package cn.meteor.beyondclouds.modules.blog.service; ...@@ -2,6 +2,7 @@ package cn.meteor.beyondclouds.modules.blog.service;
import cn.meteor.beyondclouds.modules.blog.entity.BlogComment; import cn.meteor.beyondclouds.modules.blog.entity.BlogComment;
import cn.meteor.beyondclouds.modules.blog.exception.BlogCommentServiceException; import cn.meteor.beyondclouds.modules.blog.exception.BlogCommentServiceException;
import cn.meteor.beyondclouds.modules.blog.exception.BlogServiceException;
import cn.meteor.beyondclouds.modules.project.entity.ProjectComment; import cn.meteor.beyondclouds.modules.project.entity.ProjectComment;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
...@@ -23,7 +24,7 @@ public interface IBlogCommentService extends IService<BlogComment> { ...@@ -23,7 +24,7 @@ public interface IBlogCommentService extends IService<BlogComment> {
* @param comment * @param comment
* @param userId * @param userId
*/ */
void commentCreate(String blogId,Integer parentId,String comment,String userId); void commentCreate(String blogId,Integer parentId,String comment,String userId) throws BlogServiceException, BlogCommentServiceException;
/** /**
* 删除评论 * 删除评论
...@@ -31,4 +32,15 @@ public interface IBlogCommentService extends IService<BlogComment> { ...@@ -31,4 +32,15 @@ public interface IBlogCommentService extends IService<BlogComment> {
* @param userId * @param userId
*/ */
void deleteComment(Integer commentId, String userId) throws BlogCommentServiceException; void deleteComment(Integer commentId, String userId) throws BlogCommentServiceException;
/**
* 获取评论分页
* @param pageNumber
* @param size
* @param blogId
* @param parentId
* @return
*/
IPage<BlogComment> getCommentPage(Integer pageNumber, Integer size, String blogId, Integer parentId) throws BlogCommentServiceException;
} }
...@@ -5,6 +5,7 @@ import cn.meteor.beyondclouds.modules.blog.entity.Blog; ...@@ -5,6 +5,7 @@ import cn.meteor.beyondclouds.modules.blog.entity.Blog;
import cn.meteor.beyondclouds.modules.blog.entity.BlogComment; import cn.meteor.beyondclouds.modules.blog.entity.BlogComment;
import cn.meteor.beyondclouds.modules.blog.entity.BlogExt; import cn.meteor.beyondclouds.modules.blog.entity.BlogExt;
import cn.meteor.beyondclouds.modules.blog.entity.BlogTag; import cn.meteor.beyondclouds.modules.blog.entity.BlogTag;
import cn.meteor.beyondclouds.modules.blog.exception.BlogCategoryServiceException;
import cn.meteor.beyondclouds.modules.blog.exception.BlogServiceException; import cn.meteor.beyondclouds.modules.blog.exception.BlogServiceException;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
...@@ -28,7 +29,7 @@ public interface IBlogService extends IService<Blog> { ...@@ -28,7 +29,7 @@ public interface IBlogService extends IService<Blog> {
* @param topicIds * @param topicIds
* @param tagIds * @param tagIds
*/ */
void publishBlog(Blog blog , String content , List<String> topicIds , List<String> tagIds); void publishBlog(Blog blog , String content , List<String> topicIds , List<String> tagIds) throws BlogCategoryServiceException;
/** /**
* 删除博客 * 删除博客
...@@ -70,7 +71,7 @@ public interface IBlogService extends IService<Blog> { ...@@ -70,7 +71,7 @@ public interface IBlogService extends IService<Blog> {
* @param topicIds * @param topicIds
* @param tagIds * @param tagIds
*/ */
void updateBlog(Blog blog , String content , List<String> topicIds , List<String> tagIds) throws BlogServiceException; void updateBlog(Blog blog , String content , List<String> topicIds , List<String> tagIds) throws BlogServiceException, BlogCategoryServiceException;
} }
......
...@@ -3,11 +3,15 @@ package cn.meteor.beyondclouds.modules.blog.service.impl; ...@@ -3,11 +3,15 @@ package cn.meteor.beyondclouds.modules.blog.service.impl;
import cn.meteor.beyondclouds.modules.blog.entity.Blog; import cn.meteor.beyondclouds.modules.blog.entity.Blog;
import cn.meteor.beyondclouds.modules.blog.entity.BlogComment; import cn.meteor.beyondclouds.modules.blog.entity.BlogComment;
import cn.meteor.beyondclouds.modules.blog.enums.BlogCommentErrorCode; import cn.meteor.beyondclouds.modules.blog.enums.BlogCommentErrorCode;
import cn.meteor.beyondclouds.modules.blog.enums.BlogErrorCode;
import cn.meteor.beyondclouds.modules.blog.exception.BlogCommentServiceException; import cn.meteor.beyondclouds.modules.blog.exception.BlogCommentServiceException;
import cn.meteor.beyondclouds.modules.blog.exception.BlogServiceException;
import cn.meteor.beyondclouds.modules.blog.mapper.BlogCommentMapper; import cn.meteor.beyondclouds.modules.blog.mapper.BlogCommentMapper;
import cn.meteor.beyondclouds.modules.blog.service.IBlogCommentService; import cn.meteor.beyondclouds.modules.blog.service.IBlogCommentService;
import cn.meteor.beyondclouds.modules.blog.service.IBlogService; import cn.meteor.beyondclouds.modules.blog.service.IBlogService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -32,12 +36,17 @@ public class BlogCommentServiceImpl extends ServiceImpl<BlogCommentMapper, BlogC ...@@ -32,12 +36,17 @@ public class BlogCommentServiceImpl extends ServiceImpl<BlogCommentMapper, BlogC
} }
@Override @Override
public void commentCreate(String blogId, Integer parentId, String comment, String userId) { public void commentCreate(String blogId, Integer parentId, String comment, String userId) throws BlogServiceException, BlogCommentServiceException {
//判断博客是否存在
Blog blog = blogService.getById(blogId);
if (null == blog) {
throw new BlogServiceException(BlogErrorCode.BLOG_NOT_FOUND);
}
//定义路径 //定义路径
String thread; String thread;
int depth; int depth;
//1.判断为第几级评论 //1.判断为第几级评论
if (parentId == null) { if (parentId == null) {
...@@ -45,8 +54,12 @@ public class BlogCommentServiceImpl extends ServiceImpl<BlogCommentMapper, BlogC ...@@ -45,8 +54,12 @@ public class BlogCommentServiceImpl extends ServiceImpl<BlogCommentMapper, BlogC
} else { } else {
QueryWrapper<BlogComment> queryWrapper = new QueryWrapper<>(); QueryWrapper<BlogComment> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("comment_id", parentId); queryWrapper.eq("comment_id", parentId)
.eq("blog_id",blogId);
BlogComment blogCommentParent = getOne(queryWrapper); BlogComment blogCommentParent = getOne(queryWrapper);
if (null == blogCommentParent) {
throw new BlogCommentServiceException(BlogCommentErrorCode.PARENT_COMMENT_NOT_FOUND);
}
depth = blogCommentParent.getDepth() + 1; depth = blogCommentParent.getDepth() + 1;
} }
...@@ -100,4 +113,34 @@ public class BlogCommentServiceImpl extends ServiceImpl<BlogCommentMapper, BlogC ...@@ -100,4 +113,34 @@ public class BlogCommentServiceImpl extends ServiceImpl<BlogCommentMapper, BlogC
blogCommentQueryWrapper.like("thread", blogComment.getThread()); blogCommentQueryWrapper.like("thread", blogComment.getThread());
remove(blogCommentQueryWrapper); remove(blogCommentQueryWrapper);
} }
@Override
public IPage<BlogComment> getCommentPage(Integer pageNumber, Integer size, String blogId, Integer parentId) throws BlogCommentServiceException {
Assert.notNull(blogId, "blogId must not be null");
IPage<BlogComment> page = new Page<>(pageNumber, size);
//如果parentId为null,则只获取一级评论
if (null == parentId) {
QueryWrapper blogCommentQueryWrapper = new QueryWrapper();
blogCommentQueryWrapper.eq("blog_id", blogId);
blogCommentQueryWrapper.eq("depth", 0);
blogCommentQueryWrapper.orderByDesc("create_time");
return page(page,blogCommentQueryWrapper);
}
//如果parent不为空,则获取其子评论
BlogComment blogComment = getById(parentId);
if (null == blogComment) {
throw new BlogCommentServiceException(BlogCommentErrorCode.PARENT_COMMENT_NOT_FOUND);
}
//根据parentId查出其子评论
QueryWrapper blogCommentQueryWrapper = new QueryWrapper();
blogCommentQueryWrapper.eq("parent_id", parentId);
return page(page,blogCommentQueryWrapper);
}
} }
...@@ -2,15 +2,15 @@ package cn.meteor.beyondclouds.modules.blog.service.impl; ...@@ -2,15 +2,15 @@ package cn.meteor.beyondclouds.modules.blog.service.impl;
import cn.meteor.beyondclouds.modules.blog.bean.BlogDetail; import cn.meteor.beyondclouds.modules.blog.bean.BlogDetail;
import cn.meteor.beyondclouds.modules.blog.entity.Blog; import cn.meteor.beyondclouds.modules.blog.entity.Blog;
import cn.meteor.beyondclouds.modules.blog.entity.BlogCategory;
import cn.meteor.beyondclouds.modules.blog.entity.BlogExt; import cn.meteor.beyondclouds.modules.blog.entity.BlogExt;
import cn.meteor.beyondclouds.modules.blog.entity.BlogTag; import cn.meteor.beyondclouds.modules.blog.entity.BlogTag;
import cn.meteor.beyondclouds.modules.blog.enums.BlogCategoryErrorCode;
import cn.meteor.beyondclouds.modules.blog.enums.BlogErrorCode; import cn.meteor.beyondclouds.modules.blog.enums.BlogErrorCode;
import cn.meteor.beyondclouds.modules.blog.exception.BlogCategoryServiceException;
import cn.meteor.beyondclouds.modules.blog.exception.BlogServiceException; import cn.meteor.beyondclouds.modules.blog.exception.BlogServiceException;
import cn.meteor.beyondclouds.modules.blog.mapper.BlogMapper; import cn.meteor.beyondclouds.modules.blog.mapper.BlogMapper;
import cn.meteor.beyondclouds.modules.blog.service.IBlogCommentService; import cn.meteor.beyondclouds.modules.blog.service.*;
import cn.meteor.beyondclouds.modules.blog.service.IBlogExtService;
import cn.meteor.beyondclouds.modules.blog.service.IBlogService;
import cn.meteor.beyondclouds.modules.blog.service.IBlogTagService;
import cn.meteor.beyondclouds.modules.topic.entity.TopicReference; import cn.meteor.beyondclouds.modules.topic.entity.TopicReference;
import cn.meteor.beyondclouds.modules.topic.service.ITopicReferenceService; import cn.meteor.beyondclouds.modules.topic.service.ITopicReferenceService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -48,6 +48,13 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB ...@@ -48,6 +48,13 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
private IBlogCommentService blogCommentService; private IBlogCommentService blogCommentService;
private IBlogCategoryService blogCategoryService;
@Autowired
public void setBlogCategoryService(IBlogCategoryService blogCategoryService) {
this.blogCategoryService = blogCategoryService;
}
@Autowired @Autowired
public void setBlogCommentService(IBlogCommentService blogCommentService) { public void setBlogCommentService(IBlogCommentService blogCommentService) {
this.blogCommentService = blogCommentService; this.blogCommentService = blogCommentService;
...@@ -61,18 +68,24 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB ...@@ -61,18 +68,24 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
} }
@Override @Override
public void publishBlog(Blog blog, String content, List<String> topicIds, List<String> tagIds) { public void publishBlog(Blog blog, String content, List<String> topicIds, List<String> tagIds) throws BlogCategoryServiceException {
//1.保存博客 //1.判断博客类型是否存在
BlogCategory blogCategory = blogCategoryService.getById(blog.getCategoryId());
if (null == blogCategory) {
throw new BlogCategoryServiceException(BlogCategoryErrorCode.INCORRECT_CATEGORY);
}
//2.保存博客
save(blog); save(blog);
//2.存入内容 //3.存入内容
BlogExt blogExt = new BlogExt(); BlogExt blogExt = new BlogExt();
blogExt.setBlogId(blog.getBlogId()); blogExt.setBlogId(blog.getBlogId());
blogExt.setContent(content); blogExt.setContent(content);
blogExtService.save(blogExt); blogExtService.save(blogExt);
//3.判断是否引用话题 //4.判断是否引用话题
if (null != topicIds) { if (null != topicIds) {
for (String topicId : topicIds) { for (String topicId : topicIds) {
TopicReference topicReference = new TopicReference(); TopicReference topicReference = new TopicReference();
...@@ -84,7 +97,7 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB ...@@ -84,7 +97,7 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
} }
} }
//4.判断是否引用标签 //5.判断是否引用标签
if (null != tagIds) { if (null != tagIds) {
for (String tagId : tagIds) { for (String tagId : tagIds) {
BlogTag blogTag = new BlogTag(); BlogTag blogTag = new BlogTag();
...@@ -182,7 +195,7 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB ...@@ -182,7 +195,7 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
} }
@Override @Override
public void updateBlog(Blog blog, String content, List<String> topicIds, List<String> tagIds) throws BlogServiceException { public void updateBlog(Blog blog, String content, List<String> topicIds, List<String> tagIds) throws BlogServiceException, BlogCategoryServiceException {
Assert.notNull(blog, "blog must not be null"); Assert.notNull(blog, "blog must not be null");
Assert.notNull(blog.getBlogId(), "blogId must not be null"); Assert.notNull(blog.getBlogId(), "blogId must not be null");
...@@ -193,6 +206,14 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB ...@@ -193,6 +206,14 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
throw new BlogServiceException(BlogErrorCode.BLOG_NOT_FOUND); throw new BlogServiceException(BlogErrorCode.BLOG_NOT_FOUND);
} }
//判断博客类型是否正确
if (blog.getCategoryId() != null) {
BlogCategory blogCategory = blogCategoryService.getById(blog.getCategoryId());
if (null == blogCategory) {
throw new BlogCategoryServiceException(BlogCategoryErrorCode.INCORRECT_CATEGORY);
}
}
//2.更新博客基本信息 //2.更新博客基本信息
updateById(blog); updateById(blog);
......
package cn.meteor.beyondclouds.modules.post.api;
/**
* @author gaoTong
* @date 2020/2/2 9:40
*/
public class postApi {
}
package cn.meteor.beyondclouds.modules.post.api;
/**
* @author gaoTong
* @date 2020/2/2 9:42
*/
public class postCommentApi {
}
package cn.meteor.beyondclouds.modules.post.exception;
import cn.meteor.beyondclouds.core.IErrorCode;
import cn.meteor.beyondclouds.core.exception.ServiceException;
/**
* @author gaoTong
* @date 2020/2/2 9:44
*/
public class PostCommentServiceException extends ServiceException {
public PostCommentServiceException(long errorCode, String errorMsg) {
super(errorCode, errorMsg);
}
public PostCommentServiceException(IErrorCode errorCode) {
super(errorCode);
}
}
package cn.meteor.beyondclouds.modules.post.exception;
import cn.meteor.beyondclouds.core.IErrorCode;
import cn.meteor.beyondclouds.core.exception.ServiceException;
/**
* @author gaoTong
* @date 2020/2/2 9:43
*/
public class PostServiceException extends ServiceException {
public PostServiceException(long errorCode, String errorMsg) {
super(errorCode, errorMsg);
}
public PostServiceException(IErrorCode errorCode) {
super(errorCode);
}
}
...@@ -86,7 +86,7 @@ public class ProjectCommentApi { ...@@ -86,7 +86,7 @@ public class ProjectCommentApi {
@RequestParam(value = "parentId" ,required = false) Integer parentId) { @RequestParam(value = "parentId" ,required = false) Integer parentId) {
try { try {
// 根据用户获取列表并返回 // 根据用户获取列表并返回
IPage<ProjectComment>commentPage = projectCommentService.getCommentPage(pageForm.getPage(), pageForm.getSize(), projectId, parentId); IPage<ProjectComment> commentPage = projectCommentService.getCommentPage(pageForm.getPage(), pageForm.getSize(), projectId, parentId);
PageVO<ProjectComment> projectPageVO = new PageVO<>(commentPage); PageVO<ProjectComment> projectPageVO = new PageVO<>(commentPage);
return Response.success(projectPageVO); return Response.success(projectPageVO);
} catch (ProjectCommentServiceException e) { } catch (ProjectCommentServiceException e) {
......
...@@ -3,7 +3,7 @@ spring: ...@@ -3,7 +3,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
username: root username: root
password: 100Centa30821%mysql password: 123123
swagger: swagger:
enable: true enable: true
......
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