|  | @@ -42,20 +42,33 @@
 | 
											
												
													
														|  |      </select>
 |  |      </select>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      <select id="queryRankingList" resultType="com.yonge.cooleshow.biz.dal.vo.ActivityRankingVo">
 |  |      <select id="queryRankingList" resultType="com.yonge.cooleshow.biz.dal.vo.ActivityRankingVo">
 | 
											
												
													
														|  | -    	select * from 
 |  | 
 | 
											
												
													
														|  | -    	(
 |  | 
 | 
											
												
													
														|  | -		select aer.id_,aer.score_ score,aer.user_id_ userId,u.avatar_ userAvatar,u.username_ username, aer.create_time_ joinDate,s.name_ userSubject,aer.times_ times
 |  | 
 | 
											
												
													
														|  | -		from activity_evaluation_record aer left join sys_user u on aer.user_id_ = u.id_
 |  | 
 | 
											
												
													
														|  | -        left join student stu on stu.user_id_ = aer.user_id_
 |  | 
 | 
											
												
													
														|  | -        left join subject s on s.id_ = stu.subject_id_
 |  | 
 | 
											
												
													
														|  | -		where aer.activity_id_ = #{activityPlanId} and aer.evaluation_id_ = #{activityEvaluationId} and aer.score_ >= 0
 |  | 
 | 
											
												
													
														|  | -		order by aer.score_ desc,aer.times_ asc, aer.id_ asc limit 1000000
 |  | 
 | 
											
												
													
														|  | -		) a group by userId order by score desc,
 |  | 
 | 
											
												
													
														|  | -        <if test="rankRule != null and rankRule.code == 'EVALUATIONS_NUMBER'">
 |  | 
 | 
											
												
													
														|  | -            times asc,
 |  | 
 | 
											
												
													
														|  | -        </if>
 |  | 
 | 
											
												
													
														|  | -        id_ asc
 |  | 
 | 
											
												
													
														|  | -		limit #{limit}
 |  | 
 | 
											
												
													
														|  | 
 |  | +        SELECT t.* FROM
 | 
											
												
													
														|  | 
 |  | +        (SELECT
 | 
											
												
													
														|  | 
 |  | +            @rownum :=@rownum + 1 AS rownum,
 | 
											
												
													
														|  | 
 |  | +            aer.id_,
 | 
											
												
													
														|  | 
 |  | +            aer.score_ AS score,
 | 
											
												
													
														|  | 
 |  | +            aer.user_id_ AS userId,
 | 
											
												
													
														|  | 
 |  | +            u.avatar_ AS userAvatar,
 | 
											
												
													
														|  | 
 |  | +            u.username_ AS username,
 | 
											
												
													
														|  | 
 |  | +            aer.create_time_ AS joinDate,
 | 
											
												
													
														|  | 
 |  | +            s.name_ AS userSubject,
 | 
											
												
													
														|  | 
 |  | +            aer.times_ AS times
 | 
											
												
													
														|  | 
 |  | +            FROM
 | 
											
												
													
														|  | 
 |  | +            (SELECT @rownum := 0) r,
 | 
											
												
													
														|  | 
 |  | +            activity_evaluation_record aer
 | 
											
												
													
														|  | 
 |  | +            LEFT JOIN sys_user u ON aer.user_id_ = u.id_
 | 
											
												
													
														|  | 
 |  | +            LEFT JOIN student stu ON stu.user_id_ = aer.user_id_
 | 
											
												
													
														|  | 
 |  | +            LEFT JOIN `subject` s ON s.id_ = stu.subject_id_
 | 
											
												
													
														|  | 
 |  | +            WHERE
 | 
											
												
													
														|  | 
 |  | +            aer.activity_id_ = #{activityPlanId} AND aer.evaluation_id_ = #{activityEvaluationId} AND aer.score_ > 0
 | 
											
												
													
														|  | 
 |  | +            ORDER BY
 | 
											
												
													
														|  | 
 |  | +            aer.score_ DESC,
 | 
											
												
													
														|  | 
 |  | +            <if test="rankRule != null and rankRule.code == 'EVALUATIONS_NUMBER'">
 | 
											
												
													
														|  | 
 |  | +                times asc,
 | 
											
												
													
														|  | 
 |  | +            </if>
 | 
											
												
													
														|  | 
 |  | +            aer.id_ ASC
 | 
											
												
													
														|  | 
 |  | +        ) t
 | 
											
												
													
														|  | 
 |  | +        GROUP BY t.userId ORDER BY t.rownum ASC LIMIT #{limit}
 | 
											
												
													
														|  |      </select>
 |  |      </select>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      <select id="queryUserRanking" resultType="com.yonge.cooleshow.biz.dal.vo.ActivityRankingVo">
 |  |      <select id="queryUserRanking" resultType="com.yonge.cooleshow.biz.dal.vo.ActivityRankingVo">
 |