| | |
| | | |
| | | @Override |
| | | public void saveMemberLike(MemberLikeDTO memberLikeDTO) { |
| | | if (memberLikeDTO.getMemberId()!=null) { |
| | | if (memberLikeDTO.getMemberId()==null) { |
| | | throw new ServiceException("用户ID不能为空"); |
| | | } |
| | | if (memberLikeDTO.getState()!=null) { |
| | | if (memberLikeDTO.getState()==null) { |
| | | throw new ServiceException("类型不能为空"); |
| | | } |
| | | LambdaQueryWrapper< MemberLike> wrapper= Wrappers.lambdaQuery(); |
| | |
| | | articleMapper.updateById(byId); |
| | | } |
| | | if (memberLikeDTO.getType()==2){ |
| | | ArticleComments byId = articleCommentsService.getById(memberLikeDTO.getArticleId()); |
| | | byId.setLikeCount(byId.getLikeCount()+1); |
| | | articleCommentsService.saveOrUpdate(byId); |
| | | } |
| | | if (memberLikeDTO.getType()==3){ |
| | | ArticleComments byId = articleCommentsService.getById(memberLikeDTO.getArticleId()); |
| | | byId.setLikeCount(byId.getLikeCount()+1); |
| | | articleCommentsService.saveOrUpdate(byId); |