| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Boolean create(CommentDTO commentDTO) { |
| | | public CommentDTO create(CommentDTO commentDTO) { |
| | | if (StringUtils.isEmpty(commentDTO.getContent())) { |
| | | throw new ValidationException("评论内容不能为空"); |
| | | } |
| | |
| | | commentPo.setState(true); |
| | | commentPo.create(SecurityUtils.getUserId()); |
| | | if (commentPoMapper.insert(commentPo) <= 0) { |
| | | throw new ValidationException("添加评论失败"); |
| | | CommentDTO commentDTO1 = new CommentDTO(); |
| | | return commentDTO1; |
| | | // throw new ValidationException("添加评论失败"); |
| | | } |
| | | return true; |
| | | BeanUtils.copyProperties(commentPo, commentDTO); |
| | | commentDTO.setId(commentPo.getId().intValue()); |
| | | return commentDTO; |
| | | } |
| | | |
| | | /** |