Skip to content

Commit

Permalink
fix: 모임원 명수 리턴
Browse files Browse the repository at this point in the history
  • Loading branch information
mummhy0811 committed Jun 10, 2024
1 parent 51aaf71 commit fae8e0f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ public class DetailTeamResDto {
private BigDecimal accBalance;
private TeamMemberState teamMemberState;
private Long preferTripIdx;
private Integer teamMemberCount;
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void addTeam(AddTeamReqDto addTeamReqDto) {
public DetailTeamResDto detailTeam(DetailTeamReqDto detailTeamReqDto) {
Team team = teamRepository.findById(detailTeamReqDto.getTeamIdx()).orElseThrow(() -> new ApiException(ExceptionEnum.TEAM_NOT_FOUND));
TeamMember teamMember = teamMemberRepository.findById(detailTeamReqDto.getTeamMemberIdx()).orElseThrow(() -> new ApiException(ExceptionEnum.TEAM_MEMBER_NOT_FOUND));
Integer teamMemberCount = teamMemberRepository.findTeamMembersByTeamAndTeamMemberState(team);
Long preferTripIdx = null;
if(team.getPreferTrip()!=null) preferTripIdx = team.getPreferTrip().getTripIdx();

Expand All @@ -78,6 +79,7 @@ public DetailTeamResDto detailTeam(DetailTeamReqDto detailTeamReqDto) {
.accNumber(team.getAccount().getAccNumber())
.accBalance(team.getAccount().getAccBalance())
.teamMemberState(teamMember.getTeamMemberState())
.teamMemberCount(teamMemberCount)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ public interface TeamMemberRepository extends JpaRepository<TeamMember,Long> {
List<TeamMember> findTeamMemberByMember_MemberIdx(Long memberIdx);

Optional<TeamMember> findTeamMemberByMember_MemberIdxAndTeam_TeamIdx(Long memberIdx, Long teamIdx);

@Query("SELECT count(*) FROM TeamMember tm where tm.team = :team and deletedAt is null and (tm.teamMemberState=\"총무\" or tm.teamMemberState=\"모임원\")")
Integer findTeamMembersByTeamAndTeamMemberState(Team team);
}

0 comments on commit fae8e0f

Please sign in to comment.