Browse Source

fix:活动积分人员信息

liujunchi 3 years ago
parent
commit
043e694b4e

+ 22 - 22
cooleshow-user/user-biz/src/main/resources/config/mybatis/ActivityEvaluationMapper.xml

@@ -82,32 +82,32 @@
     </select>
 
     <select id="selectActivityUser" resultType="com.yonge.cooleshow.biz.dal.vo.ActivityMusicVo">
-        select t.score
-        ,t.username_ as username
-        ,t.avatar_ as userAvatar
+        select t2.score
+        ,t2.username_ as username
+        ,t2.avatar_ as userAvatar
         ,s.name_ as userSubject
-        ,t.evaluationId
-        ,t.userId
+        ,t2.evaluationId
+        ,t2.userId
         from
-        (select
+        (select aem2.evaluation_id_ as evaluationId
+            ,su.id_ as userId
+            ,su.username_
+            ,su.avatar_
+            ,t.score
+        from (select
             max(aem.score_) as score,
-            aem.evaluation_id_,
-            aem.user_id_,
-        su.username_,
-        su.avatar_,
-        su.id_ as userId,
-        aem.evaluation_id_ as evaluationId
+            aem.evaluation_id_
+            from  activity_evaluation_record aem
+            where
+                aem.score_ is not null   and aem.activity_id_ = #{activityPlanId}
+            group by aem.evaluation_id_
+                       ) t
+            left join activity_evaluation_record aem2 on aem2.score_ = t.score and t.evaluation_id_ = aem2.evaluation_id_
+            left join sys_user su on su.id_ = aem2.user_id_
+            where aem2.activity_id_ = #{activityPlanId} and su.del_flag_ = 0 group by t.score,t.evaluation_id_
 
-        from  activity_evaluation_record aem
-        left join sys_user su on su.id_ = aem.user_id_
-        <where>
-            su.del_flag_ = 0 and aem.score_ is not null
-            <if test="activityPlanId != null">
-                and aem.activity_id_ = #{activityPlanId}
-            </if>
-        </where>
-        group by aem.evaluation_id_) t
-        left join student stu on stu.user_id_ = t.user_id_
+        ) t2
+        left join student stu on stu.user_id_ = t2.userId
         left join subject s on s.id_ = stu.subject_id_
 
     </select>