Просмотр исходного кода

手动卷条件与老师及当前条件联动,不显示无学生的条件

mingfu 2 недель назад
Родитель
Сommit
40ce9dd092

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

@@ -4,6 +4,7 @@ import cn.hutool.core.lang.Dict;
 import com.alibaba.fastjson2.JSONObject;
 import com.google.common.collect.Lists;
 import com.ruoyi.common.annotation.Anonymous;
+import com.ruoyi.common.core.content.VistorContextHolder;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.AjaxResult2;
@@ -279,9 +280,10 @@ public class LearnTeacherController extends BaseController {
 
     @GetMapping("/universities")
     @ApiOperation("院校列表")
-    public AjaxResult universities(@ApiParam("批次ID") Long batchId)
+    public AjaxResult universities(@ApiParam("批次ID") Long batchId, @RequestParam @ApiParam("考生类型") ExamType examType)
     {
-        return AjaxResult.success(learnTeacherService.selectUniversityList(getTeacherId(), batchId));
+        SysUser sysUser = VistorContextHolder.getContext();
+        return AjaxResult.success(learnTeacherService.selectUniversityList(getTeacherId(), batchId, null == examType ? sysUser.getExamType().name() : examType.name()));
     }
 
     @GetMapping("/majors")
@@ -290,7 +292,7 @@ public class LearnTeacherController extends BaseController {
     {
         SysUser sysUser = SecurityUtils.getLoginUser().getUser();
         DzControl control = dzControlService.selectDzControl(sysUser.getLocation(), examType);
-        return AjaxResult.success(learnTeacherService.selectMajorList(universityId, control.getPlanYear(), batchId, examType.name()));
+        return AjaxResult.success(learnTeacherService.selectMajorList(sysUser.getUserTypeId(), universityId, control.getPlanYear(), batchId, examType.name()));
     }
 
 

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

@@ -170,13 +170,13 @@ public class LearnTeacherService {
         return learnStudentMapper.selectClassStudents(batchId, new Long[] {classId});
     }
 
-    public List<BBusiWishUniversities> selectUniversityList(Long teacherId, Long batchId) {
-        return busiWishUniversitiesMapper.selectUniversityListForTeacher(teacherId, batchId);
+    public List<BBusiWishUniversities> selectUniversityList(Long teacherId, Long batchId, String examType) {
+        return busiWishUniversitiesMapper.selectUniversityListForTeacher(teacherId, batchId, examType);
     }
 
-    public List<Dict> selectMajorList(Long universityId, Integer year, Long batchId, String examType) {
+    public List<Dict> selectMajorList(Long teacherId, Long universityId, Integer year, Long batchId, String examType) {
         // TODO 由于未区分考生类型,好些会重复,暂取最小计划,使用这个去匹配相关的类型
-        return marjorPlanMapper.selectMajorForUniversity(universityId, year, "ExactHand", batchId, 11L, examType).stream().map(t -> Dict.create().set("id", t.getId()).set("majorGroup", t.getMajorGroup())
+        return marjorPlanMapper.selectMajorForUniversity(teacherId, universityId, year, "ExactHand", batchId, 11L, examType).stream().map(t -> Dict.create().set("id", t.getId()).set("majorGroup", t.getMajorGroup())
                 .set("majorName", t.getMajorName()).set("count", t.getXuefei()).set("total", t.getPlanTotal())).collect(Collectors.toList());
     }
 

+ 1 - 1
ie-system/src/main/java/com/ruoyi/ie/mapper/AMarjorPlanMapper.java

@@ -15,7 +15,7 @@ import org.apache.ibatis.annotations.Param;
 public interface AMarjorPlanMapper 
 {
     public List<AMarjorPlan> selectAMarjorPlanByIds(Long[] ids);
-    public List<AMarjorPlan>  selectMajorForUniversity(@Param("universityId") Long universityId, @Param("year") Integer year, @Param("buildType") String buildType, @Param("batchId") Long batchId, @Param("subjectId") Long subjectId, @Param("examType") String examType);
+    public List<AMarjorPlan>  selectMajorForUniversity(@Param("teacherId") Long teacherId, @Param("universityId") Long universityId, @Param("year") Integer year, @Param("buildType") String buildType, @Param("batchId") Long batchId, @Param("subjectId") Long subjectId, @Param("examType") String examType);
     /**
      * 查询专业计划要求
      * 

+ 1 - 1
ie-system/src/main/java/com/ruoyi/syzy/mapper/BBusiWishUniversitiesMapper.java

@@ -15,7 +15,7 @@ import org.springframework.security.core.parameters.P;
  */
 public interface BBusiWishUniversitiesMapper {
 
-    public List<BBusiWishUniversities> selectUniversityListForTeacher(@Param("teacherId") Long teacherId, @Param("batchId") Long batchId);
+    public List<BBusiWishUniversities> selectUniversityListForTeacher(@Param("teacherId") Long teacherId, @Param("batchId") Long batchId, @Param("examType") String examType);
 
 
     public List<BBusiWishUniversities> listMyByPage(String customerCode);

+ 4 - 3
ie-system/src/main/resources/mapper/ie/AMarjorPlanMapper.xml

@@ -40,11 +40,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectMajorForUniversity" parameterType="Map" resultMap="AMarjorPlanResult">
         SELECT MIN(mp.id) id, mp.`majorGroup`, mp.`majorName`, COUNT(DISTINCT sl.`student_id`) planTotal, COUNT(DISTINCT ts.`id`) xuefei
-          FROM `learn_student` sl
-          LEFT JOIN `learn_test_student` ts ON ts.`batch_id` = #{batchId} and ts.build_type = #{buildType} and ts.subject_id = #{subjectId} and ts.`student_id` = sl.`student_id`
+          FROM `dz_teacher_class` tc JOIN `learn_student` sl ON tc.`class_id` = sl.`class_id`
+          LEFT JOIN `learn_test_student` ts ON ts.`batch_id` = #{batchId} and ts.build_type = #{buildType} and ts.subject_id = #{subjectId}
+              and ts.`student_id` = sl.`student_id` and ts.class_id = sl.class_id
           JOIN `a_marjor_plan` mp ON sl.`major_plan_id` = mp.`id`
           JOIN `sys_user` u ON sl.`student_id` = u.`user_id`
-         <where>sl.class_id is not null and sl.`university_id` = #{universityId} and mp.year = #{year}
+         <where>tc.teacher_id = #{teacherId} and sl.`university_id` = #{universityId} and mp.year = #{year}
              <if test="examType != null  and examType != ''">  AND u.`exam_type` = #{examType}</if>
          </where>
          GROUP BY mp.`majorGroup`, mp.`majorName`

+ 2 - 2
ie-system/src/main/resources/mapper/syzy/BBusiWishUniversitiesMapper.xml

@@ -74,8 +74,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
   <select id="selectUniversityListForTeacher" resultMap="BBusiWishUniversitiesResult">
     SELECT u.`id`, u.`name`, COUNT(*) collect, SUM(IF(ts.`id` IS NULL, 0, 1)) hits
       FROM `dz_teacher_class` tc
-      JOIN `learn_student` sl ON tc.`class_id` = sl.`class_id`
-      LEFT JOIN `learn_test_student` ts ON ts.`batch_id` = #{batchId} AND ts.`build_type` = 'FullHand' AND ts.`student_id` = sl.`student_id`
+      JOIN `learn_student` sl ON tc.`class_id` = sl.`class_id` JOIN sys_user su ON su.`user_id` = sl.`student_id` AND su.`exam_type` = #{examType}
+      LEFT JOIN `learn_test_student` ts ON ts.`batch_id` = #{batchId} AND ts.`build_type` = 'FullHand' AND ts.`student_id` = sl.`student_id` and ts.class_id = sl.class_id
       JOIN `b_busi_wish_universities` u ON sl.`university_id` = u.`id`
     WHERE tc.`teacher_id` = #{teacherId} AND NOW() &lt; tc.`out_date`
     GROUP BY sl.`university_id`, u.`name`