|
|
@ -91,4 +91,41 @@ public class CaseContentCommentsServiceImpl extends BaseServiceImpl<CaseContentC
|
|
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
|
|
return ajaxResult;
|
|
|
|
return ajaxResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 删除自己的评论
|
|
|
|
|
|
|
|
* @param commentsId
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public AjaxResult delComments(Long commentsId) {
|
|
|
|
|
|
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
|
|
|
|
|
|
CaseUsers caseUsers = caseUsersService.currentUser();
|
|
|
|
|
|
|
|
CaseContentComments caseContentComments = caseContentCommentsMapper.selectByPrimaryKey(commentsId);
|
|
|
|
|
|
|
|
if (caseUsers.getId()!= caseContentComments.getCreateBy()){
|
|
|
|
|
|
|
|
ajaxResult.setRetcode(AjaxResult.FAILED);
|
|
|
|
|
|
|
|
ajaxResult.setRetmsg("无权限删除非本人的评论");
|
|
|
|
|
|
|
|
return ajaxResult;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
caseContentComments.setState(Constants.STATE_INVALID);
|
|
|
|
|
|
|
|
caseContentComments.setUpdateDateTime(new Date());
|
|
|
|
|
|
|
|
caseContentCommentsMapper.updateByPrimaryKeySelective(caseContentComments);
|
|
|
|
|
|
|
|
//更新统计
|
|
|
|
|
|
|
|
CaseContentStatical findCaseContentStatical = new CaseContentStatical();
|
|
|
|
|
|
|
|
findCaseContentStatical.setState(Constants.STATE_VALID);
|
|
|
|
|
|
|
|
findCaseContentStatical.setContentId(caseContentComments.getContentId());
|
|
|
|
|
|
|
|
CaseContentStatical caseContentStatical = caseContentStaticalMapper.selectOne(findCaseContentStatical);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CaseContentComments findCaseContentComments = new CaseContentComments();
|
|
|
|
|
|
|
|
findCaseContentComments.setState(Constants.STATE_VALID);
|
|
|
|
|
|
|
|
findCaseContentComments.setContentId(caseContentComments.getContentId());
|
|
|
|
|
|
|
|
Integer num = caseContentCommentsMapper.selectCount(findCaseContentComments);
|
|
|
|
|
|
|
|
caseContentStatical.setCommentsNum(num);
|
|
|
|
|
|
|
|
caseContentStatical.setUpdateDateTime(new Date());
|
|
|
|
|
|
|
|
caseContentStaticalMapper.updateByPrimaryKeySelective(caseContentStatical);
|
|
|
|
|
|
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
|
|
|
|
|
|
ajaxResult.setRetmsg("已删除评论");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ajaxResult;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|