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 e23cb0a..6fcfb3f 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 @@ -32,10 +32,10 @@ import static cn.teammodel.utils.SchoolDateUtil.calculateWeekNum; @Service public class TeacherServiceImpl implements TeacherService { - @Resource - private SchoolGroupListRepository schoolGroupListRepository; @Resource private SchoolTeacherRepository schoolTeacherRepository; + @Resource + private SchoolGroupListRepository schoolGroupListRepository; @Resource private SchoolRepository schoolRepository; @Resource @@ -46,6 +46,7 @@ public class TeacherServiceImpl implements TeacherService { public List> getTeacherList(TeacherDto teacherDto) { List> result = new ArrayList<>(); Map teacherCountMap = new HashMap<>(); + Map groupCountMap = new HashMap<>(); List groupLists = schoolGroupListRepository.findAllByCode("GroupList-" + teacherDto.getCode()); List schoolTeachers = schoolTeacherRepository.findAllByCode("Teacher-" + teacherDto.getCode()); teacherCountMap.put("教师总人数", schoolTeachers.size()); @@ -83,13 +84,16 @@ public class TeacherServiceImpl implements TeacherService { } jobCountMap.entrySet().removeIf(entry -> entry.getKey().isEmpty()); Map periodCountMap = getPeriodCountMap(periods,schoolTeachers); - + for (GroupList groupList : groupLists) { + groupCountMap.put(groupList.getName(), groupList.getMembers().size()); + } periodCountMap.entrySet().removeIf(entry -> entry.getKey().isEmpty()); updatedSubjectCountMap.entrySet().removeIf(entry -> entry.getKey().isEmpty()); result.add(updatedSubjectCountMap); result.add(jobCountMap); result.add(periodCountMap); result.add(teacherCountMap); + result.add(groupCountMap); return result; } @@ -267,7 +271,7 @@ public class TeacherServiceImpl implements TeacherService { return updatedPeriodCountMap; } - private static @NotNull Map getStringIntegerMap(List groupLists) { + /*private static @NotNull Map getStringIntegerMap(List groupLists) { Map periodCountMap = new HashMap<>(); // 遍历所有 GroupList 对象 for (GroupList group : groupLists) { @@ -282,5 +286,5 @@ public class TeacherServiceImpl implements TeacherService { } } return periodCountMap; - } + }*/ } diff --git a/src/main/java/cn/teammodel/repository/SchoolGroupListRepository.java b/src/main/java/cn/teammodel/repository/SchoolGroupListRepository.java index ccce930..4bbd1e4 100644 --- a/src/main/java/cn/teammodel/repository/SchoolGroupListRepository.java +++ b/src/main/java/cn/teammodel/repository/SchoolGroupListRepository.java @@ -8,6 +8,6 @@ import com.azure.spring.data.cosmos.repository.Query; import java.util.List; public interface SchoolGroupListRepository extends CosmosRepository { - @Query("select * from GroupList as c where c.code = @code") + @Query("select * from GroupList as c where c.code = @code and c.type = 'research' and c.scope = 'school' ") List findAllByCode(String code); }