|
@@ -7,6 +7,7 @@
|
|
|
<result column="user_id_" property="userId" />
|
|
|
<result column="evaluation_id_" property="evaluationId" />
|
|
|
<result column="score_" property="score" />
|
|
|
+ <result column="times_" property="times" />
|
|
|
<result column="create_time_" property="createTime" />
|
|
|
</resultMap>
|
|
|
|
|
@@ -17,6 +18,7 @@
|
|
|
, t.user_id_ as userId
|
|
|
, t.evaluation_id_ as evaluationId
|
|
|
, t.score_ as score
|
|
|
+ , t.times_ as times
|
|
|
, t.create_time_ as createTime
|
|
|
</sql>
|
|
|
|
|
@@ -40,20 +42,32 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="queryRankingList" resultType="com.yonge.cooleshow.biz.dal.vo.ActivityRankingVo">
|
|
|
- select aer.score_ socre,aer.user_id_ userId,u.avatar_ userAvatar,u.username_ username, aer.create_time_ joinDate,s.name_ userSubject
|
|
|
+ select * from
|
|
|
+ (
|
|
|
+ select aer.score_ socre,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}
|
|
|
- order by aer.score_ desc,aer.create_time_ asc
|
|
|
+ order by aer.score_ desc,aer.times_ asc, aer.id_ asc
|
|
|
+ ) a group by userId
|
|
|
limit #{limit}
|
|
|
</select>
|
|
|
|
|
|
<select id="queryUserRanking" resultType="com.yonge.cooleshow.biz.dal.vo.ActivityRankingVo">
|
|
|
- select aer.score_ socre,aer.user_id_ userId,u.avatar_ userAvatar,u.username_ username, aer.create_time_ joinDate,s.name_ userSubject
|
|
|
+ select aer.score_ socre,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.user_id_ = #{userId}
|
|
|
+ where aer.id_ in (
|
|
|
+ select aer.id_ from activity_evaluation_record aer where aer.activity_id_ = #{activityPlanId} and aer.evaluation_id_ = #{activityEvaluationId} and aer.user_id_ = #{userId}
|
|
|
+ order by aer.score_ desc,aer.times_ asc aer.id_ asc limit 1
|
|
|
+ )
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryLastestRecord" resultMap="BaseResultMap">
|
|
|
+ select <include refid="baseColumns"/>
|
|
|
+ from activity_evaluation_record aer
|
|
|
+ where aer.activity_id_ = #{activityPlanId} and aer.user_id_ = #{userId} order by id_ desc limit 1
|
|
|
</select>
|
|
|
</mapper>
|