Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
Update GroupApply
Browse files Browse the repository at this point in the history
  • Loading branch information
jueun275 committed May 11, 2020
1 parent 6bae63b commit 00fbcc0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ public Boolean applyDelete(@RequestBody GroupMemberRequestDto id){
}

@GetMapping("findGroupApply/{userCd}")
public List<GroupResponseDto> findGroupAppliesToUser(@PathVariable Long userCd){
public List<GroupApplyResponseDto> findGroupAppliesToUser(@PathVariable Long userCd){

return groupApplyService.findGroupAppliesToUser(userCd);
}

@GetMapping("findUserApply/{groupCd}")
public List<UserResponseDto> findUserAppliesToGroup(@PathVariable Long groupCd)
public List<GroupApplyResponseDto> findUserAppliesToGroup(@PathVariable Long groupCd)
{
return groupApplyService.findUserAppliesToGroup(groupCd);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

@Service
@RequiredArgsConstructor
Expand Down Expand Up @@ -49,29 +50,20 @@ public void delete (GroupMemberRequestDto requestDto) {
}

@Transactional(readOnly = true)
public List<GroupResponseDto> findGroupAppliesToUser(Long userId){
public List<GroupApplyResponseDto> findGroupAppliesToUser(Long userId){
UserEntity user = userService.findEntity(userId);
List<GroupApplyEntity> groupApplyEntities = groupApplyRepository.findAllByUserFKAndAndApplyState(user,1);
List<GroupResponseDto> groupResponseDto = new ArrayList<>();
return groupApplyRepository.findAllByUserFKAndAndApplyState(user,1).stream()
.map(GroupApplyResponseDto :: new)
.collect(Collectors.toList());

for (GroupApplyEntity groupApplyEntity : groupApplyEntities){
GroupResponseDto responseDto = new GroupResponseDto(groupApplyEntity.getGroupFK());
groupResponseDto.add(responseDto);
}
return groupResponseDto;
}

@Transactional(readOnly = true)
public List<UserResponseDto> findUserAppliesToGroup(Long groupCd){
public List<GroupApplyResponseDto> findUserAppliesToGroup(Long groupCd){
GroupEntity group = groupRepository.findByGroupCd(groupCd);
List<GroupApplyEntity> groupApplyEntities = groupApplyRepository.findAllByGroupFKAndApplyState(group,2);
List<UserResponseDto> userResponseDto = new ArrayList<>();

for (GroupApplyEntity groupApplyEntity : groupApplyEntities){
UserResponseDto responseDto = new UserResponseDto(groupApplyEntity.getUserFK());
userResponseDto.add(responseDto);
}
return userResponseDto;
return groupApplyRepository.findAllByGroupFKAndApplyState(group,2).stream()
.map(GroupApplyResponseDto :: new)
.collect(Collectors.toList());
}

private Boolean checkApply(Long groupCd, Long userCd)
Expand Down

0 comments on commit 00fbcc0

Please sign in to comment.