|
|
|
@ -3,8 +3,11 @@ package com.bsd.cases.service.impl;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.bsd.cases.constants.Constants;
|
|
|
|
|
import com.bsd.cases.mapper.CaseContentCommentsMapper;
|
|
|
|
|
import com.bsd.cases.mapper.CaseContentStaticalMapper;
|
|
|
|
|
import com.bsd.cases.model.CaseContentComments;
|
|
|
|
|
import com.bsd.cases.model.CaseContentStatical;
|
|
|
|
|
import com.bsd.cases.service.CaseContentCommentsService;
|
|
|
|
|
import com.bsd.cases.util.AjaxResult;
|
|
|
|
|
import com.bsd.cases.util.PageUtils;
|
|
|
|
|
import com.bsd.cases.vo.CaseContentCommentsVo;
|
|
|
|
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
|
|
|
@ -13,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.yaml.snakeyaml.scanner.Constant;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service("caseContentCommentsService")
|
|
|
|
@ -21,6 +25,8 @@ public class CaseContentCommentsServiceImpl extends BaseServiceImpl<CaseContentC
|
|
|
|
|
implements CaseContentCommentsService<CaseContentComments> {
|
|
|
|
|
@Resource
|
|
|
|
|
private CaseContentCommentsMapper caseContentCommentsMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private CaseContentStaticalMapper caseContentStaticalMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -39,4 +45,36 @@ public class CaseContentCommentsServiceImpl extends BaseServiceImpl<CaseContentC
|
|
|
|
|
JSONObject jsonObject = PageUtils.page(caseContentCommentsList,pageNum,pageSize);
|
|
|
|
|
return jsonObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 评论
|
|
|
|
|
* @param contentId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public AjaxResult addComments(Long contentId,String comments) {
|
|
|
|
|
CaseContentComments caseContentComments = new CaseContentComments();
|
|
|
|
|
caseContentComments.setContentId(contentId);
|
|
|
|
|
caseContentComments.setState(Constants.STATE_VALID);
|
|
|
|
|
caseContentComments.setComments(comments);
|
|
|
|
|
caseContentComments.setCreateDateTime(new Date());
|
|
|
|
|
caseContentComments.setUpdateDateTime(new Date());
|
|
|
|
|
//插人的信息
|
|
|
|
|
caseContentCommentsMapper.insert(caseContentComments);
|
|
|
|
|
//更新统计
|
|
|
|
|
CaseContentStatical findCaseContentStatical = new CaseContentStatical();
|
|
|
|
|
findCaseContentStatical.setState(Constants.STATE_VALID);
|
|
|
|
|
findCaseContentStatical.setContentId(contentId);
|
|
|
|
|
CaseContentStatical caseContentStatical = caseContentStaticalMapper.selectOne(findCaseContentStatical);
|
|
|
|
|
|
|
|
|
|
CaseContentComments findCaseContentComments = new CaseContentComments();
|
|
|
|
|
findCaseContentComments.setState(Constants.STATE_VALID);
|
|
|
|
|
findCaseContentComments.setContentId(contentId);
|
|
|
|
|
Integer num = caseContentCommentsMapper.selectCount(findCaseContentComments);
|
|
|
|
|
caseContentStatical.setCommentsNum(num);
|
|
|
|
|
caseContentStatical.setUpdateDateTime(new Date());
|
|
|
|
|
caseContentStaticalMapper.updateByPrimaryKeySelective(caseContentStatical);
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|