Administrator 1 rok pred
rodič
commit
6b816aacc4

+ 6 - 2
ruoyi-modules/ruoyi-system/src/main/resources/mapper/score/ScoreDataMapper.xml

@@ -44,17 +44,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="avg"    column="sdm_avg"    />
     </resultMap>
     <select id="classRank" parameterType="org.dromara.system.domain.score.ScoreData" resultMap="ScoreDataVoResult">
+
         SELECT
         (@INDEX := @INDEX + 1) AS `score_sort`,
+        a.score_class_name
+        FROM
+        (SELECT
         d.score_class_name
         FROM
-        score_data d,(select @INDEX:=0) init
+        score_data d
         <where>
             <if test="scoreType != null  and scoreType != ''"> and d.score_type = #{scoreType}</if>
             <if test="scoreTime != null "> and d.score_time = #{scoreTime}</if>
             <if test="scoreClassName != null  and scoreClassName != ''"> and d.score_class_name like concat( #{scoreClassName}, '%')</if>
         </where>
-         order by d.avg  DESC
+         order by d.avg  DESC) a,(select @INDEX:=0) init
     </select>
 
 

+ 19 - 8
ruoyi-modules/ruoyi-system/src/main/resources/mapper/score/ScoreDataStudentMapper.xml

@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <resultMap type="org.dromara.system.domain.score.vo.ScoreDataDetailVo" id="ScoreDataDetailResult">
         <result property="scoreDetailId"    column="sdd_score_detail_id"    />
+        <result property="scoreSort"    column="sdd_score_sort"    />
         <result property="scoreId"    column="sdd_score_id"    />
         <result property="xueke"    column="sdd_xueke"    />
         <result property="score"    column="sdd_score"    />
@@ -84,13 +85,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="gradeRank" parameterType="org.dromara.system.domain.score.ScoreData" resultMap="ScoreDataStudentResult">
-
-        SELECT (@index:=@index+1) AS `score_sort`,s.score_data_name,s.score_data_name_id,s.zongfen,s.score_id
+        select ( @INDEX := @INDEX + 1 ) AS `score_sort`,
+        a.score_data_name,
+        a.score_data_name_id,
+        a.zongfen,
+        a.score_id
+        FROM
+        (s.score_data_name,s.score_data_name_id,s.zongfen,s.score_id
         FROM score_data_student s
         <where>
          score_id IN (
             select d.score_id
-            FROM score_data d,(select @INDEX:=0) init
+            FROM score_data d
         <where>
             <if test="scoreType != null  and scoreType != ''"> and d.score_type = #{scoreType}</if>
             <if test="scoreTime != null "> and d.score_time = #{scoreTime}</if>
@@ -99,18 +105,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         )
             <if test="scoreDataName != null  and scoreDataName != ''"> and s.score_data_name = #{scoreDataName}</if>
         </where>
-        order by s.zongfen  DESC
+        order by s.zongfen  DESC) a,(select @INDEX:=0) init
     </select>
     <select id="xuekeRank" parameterType="org.dromara.system.domain.score.bo.ScoreDataBo" resultMap="ScoreDataDetailResult">
 
-        SELECT
-        (@INDEX := @INDEX + 1) AS `score_sort`,
+        select  (@INDEX := @INDEX + 1) AS `sdd_score_sort`,
+        a.score_data_name as sdd_score_data_name,
+        a.score_data_name_id as sdd_score_data_name_id,
+        a.xueke as sdd_xueke,
+        a.score as sdd_score
+        FROM
+       ( SELECT
         dd.score_data_name as sdd_score_data_name,
         dd.score_data_name_id as sdd_score_data_name_id,
         dd.xueke as sdd_xueke,
         dd.score as sdd_score
         FROM
-        score_data_detail dd,(select @INDEX:=0) init
+        score_data_detail dd
         WHERE
         score_id IN (
         SELECT
@@ -125,7 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
             ) and dd.xueke=#{xueke}
           <if test="scoreDataName != null and scoreDataName">and dd.score_data_name = #{scoreDataName}</if>
-        order by dd.score  DESC
+        order by dd.score  DESC) a,(select @INDEX:=0) init
     </select>
 
 </mapper>