|
|
@ -11,6 +11,7 @@ import com.bsd.cases.model.CaseUsers;
|
|
|
|
import com.bsd.cases.service.CaseContentLikeService;
|
|
|
|
import com.bsd.cases.service.CaseContentLikeService;
|
|
|
|
import com.bsd.cases.service.CaseUsersService;
|
|
|
|
import com.bsd.cases.service.CaseUsersService;
|
|
|
|
import com.bsd.cases.util.AjaxResult;
|
|
|
|
import com.bsd.cases.util.AjaxResult;
|
|
|
|
|
|
|
|
import org.apache.ibatis.annotations.Case;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
@ -47,14 +48,29 @@ public class CaseContentLikeServiceImpl extends BaseServiceImpl<CaseContentLikeM
|
|
|
|
ajaxResult.setRetcode(AjaxResult.FAILED);
|
|
|
|
ajaxResult.setRetcode(AjaxResult.FAILED);
|
|
|
|
ajaxResult.setRetmsg("未找到该文章");
|
|
|
|
ajaxResult.setRetmsg("未找到该文章");
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
CaseContentLike caseContentLike = new CaseContentLike();
|
|
|
|
CaseContentLike findMeContentLike = new CaseContentLike();
|
|
|
|
caseContentLike.setContentId(contentId);
|
|
|
|
findMeContentLike.setState(Constants.STATE_VALID);
|
|
|
|
caseContentLike.setCreateDateTime(new Date());
|
|
|
|
findMeContentLike.setContentId(contentId);
|
|
|
|
caseContentLike.setUpdateDateTime(new Date());
|
|
|
|
findMeContentLike.setCreateBy(caseUsers.getId());
|
|
|
|
caseContentLike.setCreateBy(caseUsers.getId());
|
|
|
|
CaseContentLike meContentLike = caseContentLikeMapper.selectOne(findMeContentLike);
|
|
|
|
caseContentLike.setUpdateBy(caseUsers.getId());
|
|
|
|
if (null == meContentLike){
|
|
|
|
caseContentLike.setState(Constants.STATE_VALID);
|
|
|
|
//点赞
|
|
|
|
caseContentLikeMapper.insert(caseContentLike);
|
|
|
|
CaseContentLike caseContentLike = new CaseContentLike();
|
|
|
|
|
|
|
|
caseContentLike.setContentId(contentId);
|
|
|
|
|
|
|
|
caseContentLike.setCreateDateTime(new Date());
|
|
|
|
|
|
|
|
caseContentLike.setUpdateDateTime(new Date());
|
|
|
|
|
|
|
|
caseContentLike.setCreateBy(caseUsers.getId());
|
|
|
|
|
|
|
|
caseContentLike.setUpdateBy(caseUsers.getId());
|
|
|
|
|
|
|
|
caseContentLike.setState(Constants.STATE_VALID);
|
|
|
|
|
|
|
|
caseContentLikeMapper.insert(caseContentLike);
|
|
|
|
|
|
|
|
ajaxResult.setRetmsg("已成功点赞");
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
//取消点赞
|
|
|
|
|
|
|
|
findMeContentLike.setState(Constants.STATE_INVALID);
|
|
|
|
|
|
|
|
caseContentLikeMapper.updateByPrimaryKeySelective(findMeContentLike);
|
|
|
|
|
|
|
|
ajaxResult.setRetmsg("已成功取消点赞");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//更新点赞统计数据
|
|
|
|
CaseContentLike findCaseContentLike = new CaseContentLike();
|
|
|
|
CaseContentLike findCaseContentLike = new CaseContentLike();
|
|
|
|
findCaseContentLike.setContentId(contentId);
|
|
|
|
findCaseContentLike.setContentId(contentId);
|
|
|
|
findCaseContentLike.setState(Constants.STATE_VALID);
|
|
|
|
findCaseContentLike.setState(Constants.STATE_VALID);
|
|
|
@ -66,7 +82,6 @@ public class CaseContentLikeServiceImpl extends BaseServiceImpl<CaseContentLikeM
|
|
|
|
caseContentStatical.setLikeNum(likeNum);
|
|
|
|
caseContentStatical.setLikeNum(likeNum);
|
|
|
|
caseContentStatical.setUpdateDateTime(new Date());
|
|
|
|
caseContentStatical.setUpdateDateTime(new Date());
|
|
|
|
caseContentStaticalMapper.updateByPrimaryKeySelective(caseContentStatical);
|
|
|
|
caseContentStaticalMapper.updateByPrimaryKeySelective(caseContentStatical);
|
|
|
|
ajaxResult.setRetmsg("已成功点赞");
|
|
|
|
|
|
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ajaxResult;
|
|
|
|
return ajaxResult;
|
|
|
|