소스 검색

定向组卷,限制年度

mingfu 3 주 전
부모
커밋
53949d97f7

+ 3 - 0
ie-admin/src/main/java/com/ruoyi/web/controller/learn/LearnTeacherController.java

@@ -256,6 +256,9 @@ public class LearnTeacherController extends BaseController {
         req.setDirectType(true);
         req.setSubjectId(11L);
         req.setTeacherId(getTeacherId());
+        SysUser sysUser = SecurityUtils.getLoginUser().getUser();
+        DzControl control = dzControlService.selectDzControl(sysUser.getLocation(), ExamType.valueOf(req.getExamType()));
+        req.setMatchYear(control.getPlanYear());
         return AjaxResult.success(learnTeacherService.buildPapersDirect(req));
     }
 

+ 1 - 1
ie-admin/src/main/java/com/ruoyi/web/service/LearnTeacherService.java

@@ -254,7 +254,7 @@ public class LearnTeacherService {
             }
         } else {
             // directKey = universityId_examType_directKey
-            Map<Long, Map<String, LearnDirectedKnowledge>> universityDirectedKnowledgeMap = learnDirectedKnowledgeMapper.selectByUniversityIds(universityDirectStudentMap.keySet().toArray(new Long[universityDirectStudentMap.size()])).stream().collect(
+            Map<Long, Map<String, LearnDirectedKnowledge>> universityDirectedKnowledgeMap = learnDirectedKnowledgeMapper.selectByUniversityIds(universityDirectStudentMap.keySet().toArray(new Long[universityDirectStudentMap.size()]), req.getMatchYear()).stream().collect(
                     Collectors.groupingBy(LearnDirectedKnowledge::getUniversityId, Collectors.toMap(this::buildDirectKey, a -> a)));
             for(Long universityId : universityDirectedKnowledgeMap.keySet()) {
                 Map<String, LearnDirectedKnowledge> directedKnowledgeMap = universityDirectedKnowledgeMap.get(universityId);

+ 3 - 0
ie-system/src/main/java/com/ruoyi/learn/domain/TestPaperVO.java

@@ -63,6 +63,9 @@ public class TestPaperVO {
         @ApiModelProperty("定向计划")
         Long majorPlanId;
 
+        @ApiModelProperty("年度")
+        Integer matchYear;
+
         @JsonIgnore
         Long teacherId;
 

+ 2 - 1
ie-system/src/main/java/com/ruoyi/learn/mapper/LearnDirectedKnowledgeMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.learn.mapper;
 
 import java.util.List;
 import com.ruoyi.learn.domain.LearnDirectedKnowledge;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 定向知识点关系Mapper接口
@@ -11,7 +12,7 @@ import com.ruoyi.learn.domain.LearnDirectedKnowledge;
  */
 public interface LearnDirectedKnowledgeMapper 
 {
-    public List<LearnDirectedKnowledge> selectByUniversityIds(Long[] universityIds);
+    public List<LearnDirectedKnowledge> selectByUniversityIds(@Param("universityIds") Long[] universityIds, @Param("matchYear") Integer matchYear);
 
     /**
      * 查询定向知识点关系

+ 2 - 2
ie-system/src/main/resources/mapper/learn/LearnDirectedKnowledgeMapper.xml

@@ -51,9 +51,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
-    <select id="selectByUniversityIds" parameterType="Long" resultMap="LearnDirectedKnowledgeResult">
+    <select id="selectByUniversityIds" resultMap="LearnDirectedKnowledgeResult">
         <include refid="selectLearnDirectedKnowledgeVo"/>
-        where university_id in <foreach item="id" collection="array" open="(" separator="," close=")">#{id}</foreach>
+        where match_year = #{matchYear} and university_id in <foreach item="id" collection="universityIds" open="(" separator="," close=")">#{id}</foreach>
     </select>
 
     <insert id="insertLearnDirectedKnowledge" parameterType="LearnDirectedKnowledge" useGeneratedKeys="true" keyProperty="id">