-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 수강생 명단 페이지 대시보드 조회 API 추가 (#796)
* feat: 수강생 명단 조회를 위한 레포지토리 메서드 추가 * refactor: 조회 쿼리가 한번만 나가도록 수정 * feat: curriculum 휴강 여부 전달 메서드 추가 * feat: 페이징 처리 추가 * feat: 휴강 enum 값 추가 * feat: 수강생 명단 조회 서비스 구현 * fix: 휴강일 경우 발생하는 NPE 제거 * refactor: static import 하도록 수정 * refactor: 중복 로직 메서드로 추출 * refactor: 과제 휴강시에도 정적 팩토리 메서드 사용하도록 수정 * fix: 0으로 나누는 일이 발생하지 않도록 수정 * fix: 페이지의 content를 가져와서 forEach를 돌리도록 수정 * refactor: errorcode static import 하도록 수정 * refactor: filter를 map으로 대체 * refactor: where의 조건 순서 최적화 * refactor: 삼항 연산자 메서드로 추출
- Loading branch information
1 parent
76d2a19
commit 98d4681
Showing
18 changed files
with
283 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/com/gdschongik/gdsc/domain/study/dao/AssignmentHistoryQueryMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.gdschongik.gdsc.domain.study.dao; | ||
|
||
import static com.gdschongik.gdsc.domain.study.domain.AssignmentSubmissionStatus.*; | ||
import static com.gdschongik.gdsc.domain.study.domain.QAssignmentHistory.*; | ||
import static com.gdschongik.gdsc.domain.study.domain.QStudyDetail.*; | ||
|
||
import com.gdschongik.gdsc.domain.member.domain.Member; | ||
import com.gdschongik.gdsc.domain.study.domain.Study; | ||
import com.querydsl.core.types.dsl.BooleanExpression; | ||
|
||
public interface AssignmentHistoryQueryMethod { | ||
default BooleanExpression eqMember(Member member) { | ||
return member == null ? null : assignmentHistory.member.eq(member); | ||
} | ||
|
||
default BooleanExpression eqStudy(Study study) { | ||
return study == null ? null : assignmentHistory.studyDetail.study.eq(study); | ||
} | ||
|
||
default BooleanExpression isSubmitted() { | ||
return assignmentHistory.submissionStatus.in(FAILURE, SUCCESS); | ||
} | ||
|
||
default BooleanExpression eqStudyId(Long studyId) { | ||
return studyId != null ? studyDetail.study.id.eq(studyId) : null; | ||
} | ||
|
||
default BooleanExpression eqMemberId(Long memberId) { | ||
return memberId != null ? assignmentHistory.member.id.eq(memberId) : null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/com/gdschongik/gdsc/domain/study/dao/StudyAchievementCustomRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.gdschongik.gdsc.domain.study.dao; | ||
|
||
import com.gdschongik.gdsc.domain.study.domain.StudyAchievement; | ||
import java.util.List; | ||
|
||
public interface StudyAchievementCustomRepository { | ||
List<StudyAchievement> findByStudyIdAndMemberIds(Long studyId, List<Long> memberIds); | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/gdschongik/gdsc/domain/study/dao/StudyAchievementCustomRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.gdschongik.gdsc.domain.study.dao; | ||
|
||
import static com.gdschongik.gdsc.domain.study.domain.QStudyAchievement.*; | ||
|
||
import com.gdschongik.gdsc.domain.study.domain.StudyAchievement; | ||
import com.querydsl.core.types.dsl.BooleanExpression; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public class StudyAchievementCustomRepositoryImpl implements StudyAchievementCustomRepository { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
@Override | ||
public List<StudyAchievement> findByStudyIdAndMemberIds(Long studyId, List<Long> memberIds) { | ||
return queryFactory | ||
.selectFrom(studyAchievement) | ||
.where(eqStudyId(studyId), studyAchievement.student.id.in(memberIds)) | ||
.fetch(); | ||
} | ||
|
||
private BooleanExpression eqStudyId(Long studyId) { | ||
return studyId != null ? studyAchievement.study.id.eq(studyId) : null; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/gdschongik/gdsc/domain/study/dao/StudyAchievementRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.gdschongik.gdsc.domain.study.dao; | ||
|
||
import com.gdschongik.gdsc.domain.study.domain.StudyAchievement; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface StudyAchievementRepository | ||
extends JpaRepository<StudyAchievement, Long>, StudyAchievementCustomRepository {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.