Skip to content

Commit

Permalink
HotFix : 선생님 검색 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ywj9811 committed Feb 24, 2025
1 parent 04bb80b commit 535655f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public AllApplicationResponse getAllApplication() {
List<ApplicationForm> applicationForms = adminGetService.allApplication();
return new AllApplicationResponse(applicationForms.stream()
.map(applicationForm -> {
List<ClassMatching> classMatchings = adminGetService.allMatching(applicationForm);
List<ClassMatching> classMatchings = adminGetService.allMatching(applicationForm.getApplicationFormId());
int accept = (int)classMatchings.stream()
.filter(classMatching -> classMatching.getMatchStatus().equals(MatchingStatus.수락) || classMatching.getMatchStatus().equals(MatchingStatus.전송))
.count();
Expand All @@ -47,7 +47,7 @@ public CommonParentsResponse getParentsInfo(String applicationFormId) {

public AllAlarmTalkResponse getAlarmTalkInfo(String applicationFormId) {
ApplicationForm applicationForm = adminGetService.applicationFormById(applicationFormId);
List<ClassMatching> classMatchings = adminGetService.allMatching(applicationForm);
List<ClassMatching> classMatchings = adminGetService.allMatching(applicationFormId);
List<AlarmTalkResponse> alarmTalkResponses = classMatchings.stream()
.map(AdminMapper::mapToAlarmTalkResponse)
.toList();
Expand All @@ -69,8 +69,8 @@ public ClassDetailsResponse getClassDetails(String applicationFormId) {
}

public AllFilteringTeacher searchAllTeacher(String applicationFormId, TeacherSearchRequest request) {
ApplicationForm applicationForm = adminGetService.applicationFormById(applicationFormId);
List<Teacher> teachers = adminGetService.allTeacherBySearch(applicationForm, request);
List<ClassMatching> classMatchings = adminGetService.allMatching(applicationFormId);
List<Teacher> teachers = adminGetService.allTeacherBySearch(classMatchings, request);
return new AllFilteringTeacher(teachers.stream()
.map(teacher -> {
List<TeacherDistrict> teacherDistricts = adminGetService.allDistrictByTeacher(teacher);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public List<ApplicationForm> allApplication() {
return applicationFormRepository.findAll(Sort.by(Sort.Direction.DESC, "createdAt"));
}

public List<ClassMatching> allMatching(ApplicationForm applicationForm) {
return classMatchingRepository.allByApplicationForm(applicationForm);
public List<ClassMatching> allMatching(String applicationFormId) {
return classMatchingRepository.allByApplicationForm(applicationFormId);
}

public ApplicationForm applicationFormById(String applicationFormId) {
Expand All @@ -54,8 +54,8 @@ public List<Goal> allGoalByApplicationForm(ApplicationForm applicationForm) {
return goalRepository.findAllByApplicationForm(applicationForm);
}

public List<Teacher> allTeacherBySearch(ApplicationForm applicationForm, TeacherSearchRequest teacherSearchRequest) {
return teacherRepository.findAllSearchTeacher(applicationForm, teacherSearchRequest);
public List<Teacher> allTeacherBySearch(List<ClassMatching> classMatchings, TeacherSearchRequest teacherSearchRequest) {
return teacherRepository.findAllSearchTeacher(classMatchings, teacherSearchRequest);
}

public Teacher teacherById(long teacherId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.yedu.backend.domain.matching.domain.repository;

import com.yedu.backend.domain.matching.domain.entity.ClassMatching;
import com.yedu.backend.domain.parents.domain.entity.ApplicationForm;

import java.util.List;

public interface ClassMatchingDslRepository {
List<ClassMatching> allByApplicationForm(ApplicationForm applicationForm);
List<ClassMatching> allByApplicationForm(String applicationFormId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.querydsl.jpa.impl.JPAQueryFactory;
import com.yedu.backend.domain.matching.domain.entity.ClassMatching;
import com.yedu.backend.domain.matching.domain.entity.constant.MatchingStatus;
import com.yedu.backend.domain.parents.domain.entity.ApplicationForm;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

Expand All @@ -19,9 +18,9 @@ public class ClassMatchingDslRepositoryImpl implements ClassMatchingDslRepositor
private final JPAQueryFactory queryFactory;

@Override
public List<ClassMatching> allByApplicationForm(ApplicationForm applicationForm) {
public List<ClassMatching> allByApplicationForm(String applicationFormId) {
return queryFactory.selectFrom(classMatching)
.where(classMatching.applicationForm.eq(applicationForm))
.where(classMatching.applicationForm.applicationFormId.eq(applicationFormId))
.orderBy(statusOrderSpecifier())
.fetch();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.yedu.backend.domain.teacher.domain.repository;

import com.yedu.backend.admin.application.dto.req.TeacherSearchRequest;
import com.yedu.backend.domain.matching.domain.entity.ClassMatching;
import com.yedu.backend.domain.parents.domain.entity.ApplicationForm;
import com.yedu.backend.domain.teacher.domain.entity.Teacher;

import java.util.List;

public interface TeacherDslRepository {
List<Teacher> findAllMatchingApplicationForm(ApplicationForm applicationForm);
List<Teacher> findAllSearchTeacher(ApplicationForm applicationForm, TeacherSearchRequest request);
List<Teacher> findAllSearchTeacher(List<ClassMatching> classMatchings, TeacherSearchRequest request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.querydsl.core.types.dsl.CaseBuilder;
import com.querydsl.jpa.impl.JPAQueryFactory;
import com.yedu.backend.admin.application.dto.req.TeacherSearchRequest;
import com.yedu.backend.domain.matching.domain.entity.ClassMatching;
import com.yedu.backend.domain.parents.domain.entity.ApplicationForm;
import com.yedu.backend.domain.parents.domain.entity.constant.ClassType;
import com.yedu.backend.domain.parents.domain.entity.constant.Gender;
Expand Down Expand Up @@ -69,9 +70,9 @@ private BooleanExpression subjectSpecifier(ClassType classType) {
}

@Override
public List<Teacher> findAllSearchTeacher(ApplicationForm applicationForm, TeacherSearchRequest request) {
List<Long> teacherIds = getTeachers(applicationForm)
.stream().map(Teacher::getTeacherId)
public List<Teacher> findAllSearchTeacher(List<ClassMatching> classMatchings, TeacherSearchRequest request) {
List<Long> teacherIds = classMatchings.stream()
.map(classMatching -> classMatching.getTeacher().getTeacherId())
.toList();

BooleanBuilder builder = searchLikeSpecifier(request);
Expand Down

0 comments on commit 535655f

Please sign in to comment.