feat:更新朋友圈功能
This commit is contained in:
@@ -33,6 +33,18 @@ public class MomentServiceImpl implements MomentService {
|
||||
return momentMapper.insert(moment) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateMoment(Long id, MomentDto momentDto) {
|
||||
if (momentMapper.selectById(id) == null) {
|
||||
throw new CustomException("该朋友圈不存在");
|
||||
}
|
||||
|
||||
Moment moment = new Moment();
|
||||
BeanUtils.copyProperties(momentDto, moment);
|
||||
moment.setId(id);
|
||||
return momentMapper.updateById(moment) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MomentDto> queryMoment() {
|
||||
// TODO 只能查询好友的朋友圈
|
||||
@@ -40,13 +52,13 @@ public class MomentServiceImpl implements MomentService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean addComment(Long momentId, CommentDto commentDto) {
|
||||
public Boolean addComment(Long momentId, String content) {
|
||||
if (momentMapper.selectById(momentId) == null) {
|
||||
throw new CustomException("该朋友圈不存在");
|
||||
}
|
||||
|
||||
Comment comment = new Comment();
|
||||
BeanUtils.copyProperties(commentDto, comment);
|
||||
comment.setContent(content);
|
||||
comment.setMomentId(momentId);
|
||||
return commentMapper.insert(comment) == 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user