瀏覽代碼

云教练作业优化

zouxuan 3 年之前
父節點
當前提交
c484367ecc

+ 18 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java

@@ -532,6 +532,22 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 
 	@Override
 	public int countWaitCreateHomeworkNum(TeacherServeHomeworkQueryInfo queryInfo) {
-		return 0;
+		List<StudentExtracurricularExercisesSituation> weekServiceWithStudents = studentExtracurricularExercisesSituationDao.findWeekServiceWithStudents(null, queryInfo.getTeacherId(), null);
+		if(weekServiceWithStudents == null || weekServiceWithStudents.size() == 0){
+			return 0;
+		}
+		List<StudentExtracurricularExercisesSituation> containsList = weekServiceWithStudents.stream().filter(e -> e.getCourseIds().contains(",")).collect(Collectors.toList());
+		int num = 0;
+		if(containsList != null && containsList.size() > 0){
+			for (StudentExtracurricularExercisesSituation e : containsList) {
+				String[] split = e.getCourseIds().split(",");
+				if(e.getNotOverCourseNum() == 0){
+					num = num + split.length - e.getNotOverCourseNum();
+				}
+			}
+		}
+		List<StudentExtracurricularExercisesSituation> situationList = weekServiceWithStudents.stream().filter(e -> !e.getCourseIds().contains(",") && e.getNotOverCourseNum() == 0).collect(Collectors.toList());
+		num += situationList.size();
+		return num;
 	}
-}
+}

+ 4 - 1
mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml

@@ -476,7 +476,10 @@
 
 	<select id="findWeekServiceWithStudents" resultMap="StudentExtracurricularExercisesSituation">
 		SELECT * FROM student_extracurricular_exercises_situation_
-		WHERE monday_=#{monday}
+		WHERE
+		  <if test="monday != null and monday != ''">
+			  monday_=#{monday}
+		  </if>
 		  <if test="teacherId!=null">
 			  AND teacher_id_=#{teacherId}
 		  </if>