Commit 6c1f05ee by 梅存智

投票次数根据投票状态设置

parent 55691753
......@@ -56,4 +56,6 @@ public interface TrResearchAnswerMapper extends BaseMapper<TrResearchAnswer> {
List<ResearchGroupViewVo> queryAnswerRecord(@Param("researchId") Long researchId, @Param("siteId")Long siteId);
List<Long> getFinshIdsByIds(@Param("ids")List<Long> ids, @Param("accountId")Long accountId,@Param("siteId") Long siteId);
Integer getResearchAnsweFinish(@Param("accountId")Long accountId,@Param("researchId") Long researchId);
}
......@@ -115,4 +115,8 @@
</if>
</select>
<select id="getResearchAnsweFinish" resultType="Integer">
SELECT MAX(a.finish) AS finish FROM tr_research_answer a
where a.research_id = #{researchId} and a.account_id = #{accountId} and a.finish = 1
</select>
</mapper>
......@@ -31,6 +31,7 @@
<resultMap id="getVoteResultMap" type="com.yizhi.research.application.vo.domain.VoteRankingVo">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="voteNum" column="vote_num"/>
<collection property="rankingList" ofType="com.yizhi.research.application.vo.domain.VoteRankingListVo">
<result property="id" column="questionId"/>
<result property="no" column="no"/>
......@@ -179,6 +180,7 @@
<if test="isTop == null or isTop == false" >
,IFNULL(myanswer.answerState,0) AS answerState
</if>
,r.vote_num
FROM tr_research_question a
INNER JOIN tr_research_question_option b ON a.id=b.question_id AND b.deleted=0
LEFT JOIN tr_research_answer_question_result c ON c.option_id=b.id
......
......@@ -1019,7 +1019,14 @@ public class TrResearchQuestionServiceImpl extends ServiceImpl<TrResearchQuestio
RequestContext context = ContextHolder.get();
Long companyId = context.getCompanyId();
Long siteId = context.getSiteId();
return researchQuestionMapper.getVoteResult(companyId, siteId, researchId, context.getAccountId(), false);
VoteRankingVo voteRankingVo = researchQuestionMapper.getVoteResult(companyId, siteId, researchId, context.getAccountId(), false);
if(voteRankingVo != null){
Integer finish = trResearchAnswerMapper.getResearchAnsweFinish(context.getAccountId(), researchId);
if(finish != null && finish == 1){
voteRankingVo.setVoteNum(0);
}
}
return voteRankingVo;
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment