From fae8e0ff97f81de9796f1ac63a833edd571d5278 Mon Sep 17 00:00:00 2001 From: mummhy0811 Date: Mon, 10 Jun 2024 11:36:54 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=AA=A8=EC=9E=84=EC=9B=90=20=EB=AA=85?= =?UTF-8?q?=EC=88=98=20=EB=A6=AC=ED=84=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../triptogether/team/dto/response/DetailTeamResDto.java | 1 + .../hanaro/triptogether/team/service/impl/TeamServiceImpl.java | 2 ++ .../triptogether/teamMember/domain/TeamMemberRepository.java | 3 +++ 3 files changed, 6 insertions(+) diff --git a/src/main/java/com/hanaro/triptogether/team/dto/response/DetailTeamResDto.java b/src/main/java/com/hanaro/triptogether/team/dto/response/DetailTeamResDto.java index b192308..025cb53 100644 --- a/src/main/java/com/hanaro/triptogether/team/dto/response/DetailTeamResDto.java +++ b/src/main/java/com/hanaro/triptogether/team/dto/response/DetailTeamResDto.java @@ -15,4 +15,5 @@ public class DetailTeamResDto { private BigDecimal accBalance; private TeamMemberState teamMemberState; private Long preferTripIdx; + private Integer teamMemberCount; } diff --git a/src/main/java/com/hanaro/triptogether/team/service/impl/TeamServiceImpl.java b/src/main/java/com/hanaro/triptogether/team/service/impl/TeamServiceImpl.java index a1ae267..15505ff 100644 --- a/src/main/java/com/hanaro/triptogether/team/service/impl/TeamServiceImpl.java +++ b/src/main/java/com/hanaro/triptogether/team/service/impl/TeamServiceImpl.java @@ -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(); @@ -78,6 +79,7 @@ public DetailTeamResDto detailTeam(DetailTeamReqDto detailTeamReqDto) { .accNumber(team.getAccount().getAccNumber()) .accBalance(team.getAccount().getAccBalance()) .teamMemberState(teamMember.getTeamMemberState()) + .teamMemberCount(teamMemberCount) .build(); } diff --git a/src/main/java/com/hanaro/triptogether/teamMember/domain/TeamMemberRepository.java b/src/main/java/com/hanaro/triptogether/teamMember/domain/TeamMemberRepository.java index 51f7a71..eccf41d 100644 --- a/src/main/java/com/hanaro/triptogether/teamMember/domain/TeamMemberRepository.java +++ b/src/main/java/com/hanaro/triptogether/teamMember/domain/TeamMemberRepository.java @@ -18,4 +18,7 @@ public interface TeamMemberRepository extends JpaRepository { List findTeamMemberByMember_MemberIdx(Long memberIdx); Optional 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); }