Browse Source

添加历史考评

liu 2 years ago
parent
commit
a4b1b588f7

+ 5 - 0
src/main/java/com/template/api/SmartEvaluateStudentControllerAPI.java

@@ -6,8 +6,10 @@ import com.template.model.result.CommonResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 
 @RequestMapping("/api/smartEvaluateStudent")
 @Api(tags = {"SmartEvaluateStudentControllerAPI"}, value = "学生评测")
@@ -41,4 +43,7 @@ public interface SmartEvaluateStudentControllerAPI {
     @ApiOperation(value = "查看学生评分详情", httpMethod = "POST")
     public CommonResult queryDetailScore(Integer id);
 
+    @GetMapping(value = "/historicalEvaluation")
+    @ApiOperation(value = "历史考评",notes = "历史考评", httpMethod = "GET")
+    public CommonResult historicalEvaluation(@RequestParam String cardNo);
 }

+ 1 - 1
src/main/java/com/template/api/SmartScoreControllerAPI.java

@@ -117,7 +117,7 @@ public interface SmartScoreControllerAPI {
 
     @GetMapping(value = "/studentExamName")
     @ApiOperation(value = "学生考试名称分组", notes = "学生考试名称分组", httpMethod = "GET")
-    CommonResult studentExamName();
+    CommonResult studentExamName(@RequestParam int userId);
 
 
     @GetMapping(value = "/historicalExam")

+ 7 - 0
src/main/java/com/template/controller/SmartEvaluateStudentController.java

@@ -14,6 +14,7 @@ import com.template.model.evaluate.teacher.SmartEvaluateTdetail;
 import com.template.model.evaluate.teacher.SmartEvaluateTeacher;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.HistoricalEvaluationVo;
 import com.template.services.SmartEvaluateSdetailService;
 import com.template.services.SmartEvaluateStudentService;
 import com.template.services.SmartSubjectManageService;
@@ -281,4 +282,10 @@ public class SmartEvaluateStudentController implements SmartEvaluateStudentContr
         jsonObject.put("scoreList", list);
         return CommonResult.ok(jsonObject);
     }
+
+    @Override
+    public CommonResult historicalEvaluation(String cardNo) {
+        List<HistoricalEvaluationVo> vos=smartEvaluateStudentService.getHistoricalEvaluation(cardNo);
+        return CommonResult.ok(vos);
+    }
 }

+ 2 - 2
src/main/java/com/template/controller/SmartScoreController.java

@@ -681,8 +681,8 @@ public class SmartScoreController implements SmartScoreControllerAPI {
 
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult studentExamName() {
-       List<StudentExamNameVo> vos =smartScoreService.getstudentExamName();
+    public CommonResult studentExamName(int userId) {
+       List<StudentExamNameVo> vos =smartScoreService.getstudentExamName(userId);
        return CommonResult.ok(vos);
     }
 

+ 5 - 0
src/main/java/com/template/mapper/SmartEvaluateStudentMapper.java

@@ -2,8 +2,12 @@ package com.template.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.template.model.evaluate.student.SmartEvaluateStudent;
+import com.template.model.vo.HistoricalEvaluationVo;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * <p>
  * 用户表 Mapper 接口
@@ -15,4 +19,5 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface SmartEvaluateStudentMapper extends BaseMapper<SmartEvaluateStudent> {
 
+    List<HistoricalEvaluationVo> getHistoricalEvaluation(@Param("cardNo") String cardNo);
 }

+ 1 - 1
src/main/java/com/template/mapper/SmartScoreMapper.java

@@ -27,7 +27,7 @@ public interface SmartScoreMapper extends BaseMapper<SmartScore> {
 
     Double getAverageScore(@Param("userId") int userId,@Param("semesterId") Integer semesterId,@Param("smartSemesterId") Integer smartSemesterId);
 
-    List<StudentExamNameVo> getStudentExamName();
+    List<StudentExamNameVo> getStudentExamName(@Param("userId") int userId);
 
     List<HistoricalExamVo> getHistoricalExam(@Param("userId") int userId,@Param("semesterId") int semesterId,@Param("examTypeId") int examTypeId);
 }

+ 14 - 0
src/main/java/com/template/model/vo/HistoricalEvaluationVo.java

@@ -0,0 +1,14 @@
+package com.template.model.vo;
+
+import lombok.Data;
+
+@Data
+public class HistoricalEvaluationVo {
+//    学期
+    private String term;
+//    分数
+    private String scoreNum;
+//    总评
+    private String scoreLevel;
+
+}

+ 3 - 0
src/main/java/com/template/services/SmartEvaluateStudentService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.evaluate.student.SmartEvaluateStudent;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.HistoricalEvaluationVo;
 
 import java.util.List;
 
@@ -38,4 +39,6 @@ public interface SmartEvaluateStudentService extends IService<SmartEvaluateStude
      * @return
      */
     SmartEvaluateStudent getTeacherMessage(String cardNo, String name);
+
+    List<HistoricalEvaluationVo> getHistoricalEvaluation(String cardNo);
 }

+ 1 - 1
src/main/java/com/template/services/SmartScoreService.java

@@ -44,7 +44,7 @@ public interface SmartScoreService extends IService<SmartScore> {
      */
     Double getAverageScore(int userId, Integer semesterId, Integer smartSemesterId);
 
-    List<StudentExamNameVo> getstudentExamName();
+    List<StudentExamNameVo> getstudentExamName(int userId);
 
     List<HistoricalExamVo> getHistoricalExam(int userId, int semesterId, int examTypeId);
 }

+ 6 - 0
src/main/java/com/template/services/impl/SmartEvaluateStudentServiceImpl.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.template.mapper.SmartEvaluateStudentMapper;
 import com.template.model.evaluate.student.SmartEvaluateStudent;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.HistoricalEvaluationVo;
 import com.template.services.SmartEvaluateStudentService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -83,4 +84,9 @@ public class SmartEvaluateStudentServiceImpl extends ServiceImpl<SmartEvaluateSt
         return ses;
     }
 
+    @Override
+    public List<HistoricalEvaluationVo> getHistoricalEvaluation(String cardNo) {
+        return smartEvaluateStudentMapper.getHistoricalEvaluation(cardNo);
+    }
+
 }

+ 2 - 2
src/main/java/com/template/services/impl/SmartScoreServiceImpl.java

@@ -92,8 +92,8 @@ public class SmartScoreServiceImpl extends ServiceImpl<SmartScoreMapper, SmartSc
     }
 
     @Override
-    public List<StudentExamNameVo> getstudentExamName() {
-        return smartScoreMapper.getStudentExamName();
+    public List<StudentExamNameVo> getstudentExamName(int userId) {
+        return smartScoreMapper.getStudentExamName(userId);
     }
 
     @Override

+ 12 - 0
src/main/resources/mapper/template/SmartEvaluateStudentMapper.xml

@@ -2,4 +2,16 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartEvaluateStudentMapper">
 
+    <select id="getHistoricalEvaluation" resultType="com.template.model.vo.HistoricalEvaluationVo">
+        SELECT
+            ses.term,
+            ses.score_num as scoreNum,
+            ses.score_level as scoreLevel
+        FROM
+            `smart_evaluate_student` ses
+                LEFT JOIN smart_semester ss ON ses.term = ss.`name`
+        WHERE ses.card_no=#{cardNo} and and ses.deleted=0
+        ORDER BY
+            ss.start_time
+    </select>
 </mapper>

+ 1 - 1
src/main/resources/mapper/template/SmartScoreMapper.xml

@@ -106,7 +106,7 @@
         FROM
             `smart_score` ss
                 LEFT JOIN smart_examtype me ON ss.exam_type = me.id
-        where  ss.deleted=0
+        where  ss.deleted=0 AND ss.user_id=#{userId}
         GROUP BY
             ss.semester_id,
             ss.exam_type