dzx 8 mesi fa
parent
commit
fce15ed987

+ 12 - 2
src/main/java/com/xjrsoft/module/student/controller/StudentTryReadingReportController.java

@@ -12,7 +12,6 @@ import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.banding.dto.BandingTaskClassPageDto;
-import com.xjrsoft.module.banding.entity.BandingTaskClass;
 import com.xjrsoft.module.banding.service.IBandingTaskClassService;
 import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
 import com.xjrsoft.module.banding.vo.BandingTaskClassPageVo;
@@ -165,7 +164,18 @@ public class StudentTryReadingReportController {
     @SaCheckPermission("studentreportrecord:detail")
     @XjrLog(value = "导出")
     public RT<List<BandingTaskClassPageVo>> classList(@Valid Long teacherId){
-        List<BandingTaskClassPageVo> list = bandingTaskClassService.getList(new BandingTaskClassPageDto());
+        BandingTaskClassPageDto dto = new BandingTaskClassPageDto();
+        if(teacherId != null){
+            dto.setTeacherId(teacherId);
+        }else{
+            dto.setTeacherId(StpUtil.getLoginIdAsLong());
+        }
+        StudentReportPlan plan = reportPlanService.getLastTryReadingPlan();
+        if(plan == null){
+            return RT.ok(new ArrayList<>());
+        }
+        dto.setBandingTaskId(plan.getBandingTaskId());
+        List<BandingTaskClassPageVo> list = bandingTaskClassService.getList(dto);
         return RT.ok(list);
     }
 

+ 2 - 0
src/main/java/com/xjrsoft/module/student/service/IStudentReportPlanService.java

@@ -54,4 +54,6 @@ public interface IStudentReportPlanService extends MPJBaseService<StudentReportP
     List<StudentReportPlan> getWillBeginData();
 
     List<StudentReportPlanClassRelation> getStudentReportPlanClassRelationList(Long id);
+
+    StudentReportPlan getLastTryReadingPlan();
 }

+ 18 - 0
src/main/java/com/xjrsoft/module/student/service/impl/StudentReportPlanServiceImpl.java

@@ -240,4 +240,22 @@ public class StudentReportPlanServiceImpl extends MPJBaseServiceImpl<StudentRepo
                         .eq(StudentReportPlanClassRelation::getStudentReportPlanId, id)
         );
     }
+
+    /**
+     * 查询最新的有效的报到计划
+     * @return
+     */
+    @Override
+    public StudentReportPlan getLastTryReadingPlan() {
+        List<StudentReportPlan> list = this.list(
+                new QueryWrapper<StudentReportPlan>().lambda()
+                        .eq(StudentReportPlan::getCategory, 2)
+                        .eq(StudentReportPlan::getStatus, 1)
+                        .orderByDesc(StudentReportPlan::getEndTime)
+        );
+        if(list.isEmpty()){
+            return null;
+        }
+        return list.get(0);
+    }
 }

+ 3 - 0
src/main/resources/mapper/banding/BandingTaskClassMapper.xml

@@ -44,6 +44,9 @@
         <if test="dto.majorSetName != null and dto.majorSetName != ''">
             and t2.name like concat('%', #{dto.majorSetName},'%')
         </if>
+        <if test="dto.teacherId != null">
+            and t1.teacher_id = #{dto.teacherId}
+        </if>
         ORDER BY t1.sort_code IS NULL, t1.sort_code ASC
     </select>