diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java index fb614ca..3b9f332 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java @@ -139,11 +139,11 @@ public class TeacherServiceImpl implements TeacherService { do { if(StringUtils.isNotEmpty(teacherDto.getGrade())) { - slice = lessonRecordRepository.findAllByGrade(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getGrade(),pageRequest); + slice = lessonRecordRepository.findAllByGrade(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getGrade(),teacherDto.getSubjectId(),pageRequest); } else if(StringUtils.isNotEmpty(teacherDto.getTmdId())) { - slice = lessonRecordRepository.findAllByAcademicYearId(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getTmdId(),pageRequest); + slice = lessonRecordRepository.findAllByAcademicYearId(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getTmdId(),teacherDto.getSubjectId(),pageRequest); } else { - slice = lessonRecordRepository.findAll(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), pageRequest); + slice = lessonRecordRepository.findAll(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getSubjectId(), pageRequest); } List content = slice.getContent(); if (ObjectUtils.isEmpty(content)) { diff --git a/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java b/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java index d27bba9..86e1c2d 100644 --- a/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java +++ b/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java @@ -18,4 +18,6 @@ public class TeacherDto { public Integer year; @ApiModelProperty("年级") public String grade; + @ApiModelProperty("科目信息") + public String subjectId; } diff --git a/src/main/java/cn/teammodel/repository/LessonRecordRepository.java b/src/main/java/cn/teammodel/repository/LessonRecordRepository.java index 8ee424d..ca88428 100644 --- a/src/main/java/cn/teammodel/repository/LessonRecordRepository.java +++ b/src/main/java/cn/teammodel/repository/LessonRecordRepository.java @@ -19,11 +19,14 @@ public interface LessonRecordRepository extends CosmosRepository getLessonsByConditions(String code, Long startTime, Long endTime,String tmdId); - @Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and c.tmdid = @tmdId ") - Slice findAllByAcademicYearId(String code, String tmdId,Pageable pageable); - @Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and array_contains(c.grade,@grade) ") - Slice findAllByGrade(String code, String grade,Pageable pageable); - @Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 ") - Slice findAll(String code,Pageable pageable); + @Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and c.tmdid = @tmdId and " + + "(IS_NULL(@subjectId) or c.subjectId = @subjectId) ") + Slice findAllByAcademicYearId(String code, String tmdId,String subjectId,Pageable pageable); + @Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and array_contains(c.grade,@grade) and" + + "(IS_NULL(@subjectId) or c.subjectId = @subjectId) ") + Slice findAllByGrade(String code, String grade,String subjectId,Pageable pageable); + @Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and " + + "(IS_NULL(@subjectId) or c.subjectId = @subjectId) ") + Slice findAll(String code,String subjectId,Pageable pageable); }