提交 c492c0fa 编写于 作者: minghao.wu's avatar minghao.wu

fix: 得赞数相同的情况下 按照谁的最后一张得票早谁第一

上级 91fa63f2
......@@ -84,29 +84,31 @@
<select id="selectElectedStarCountByExamTitleIdList" resultType="java.lang.Integer">
select
sum(star_count) as star
count(p_star_record.id) as star
from p_reply
where analysis_round_exam_title_id in
join p_star_record on p_reply.id = p_star_record.reply_id and p_star_record.is_deleted = 0
where p_reply.analysis_round_exam_title_id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
and is_deleted = 0
group by user_id
order by star desc, created_time
and p_reply.is_deleted = 0
group by p_reply.user_id
order by star desc, max(p_star_record.id)
limit 1
</select>
<select id="selectElectedDoctorIdByExamTitleIdList" resultType="java.lang.Integer">
select
ifnull(user_id,0)
ifnull(p_reply.user_id,0)
from p_reply
where analysis_round_exam_title_id in
join p_star_record on p_reply.id = p_star_record.reply_id and p_star_record.is_deleted = 0
where p_reply.analysis_round_exam_title_id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
and is_deleted = 0
group by user_id
order by sum(star_count) desc, created_time
and p_reply.is_deleted = 0
group by p_reply.user_id
order by count(p_star_record.id) desc, max(p_star_record.id)
limit 1
</select>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册