Skip to content

Commit

Permalink
Merge pull request #23 from curator-OEUVRE/dev
Browse files Browse the repository at this point in the history
fix : 회원 탈퇴 오류수정, 해쉬태그 플로어 조회 필드명 수정
  • Loading branch information
kim-wonjin authored Jul 29, 2023
2 parents 8aad4c8 + 2a10d6d commit 25d4e43
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ public class GetHashtagPictureDto {
@ApiModelProperty(notes = "스크랩 여부", example = "true")
private final Boolean isScraped;

@ApiModelProperty(notes = "플로어 no", example = "1")
private final Long floorNo;

@ApiModelProperty(notes = "회원 no", example = "1")
private final Long userNo;

@ApiModelProperty(notes = "아이디", example = "one_zzini_")
private final String id;
@ApiModelProperty(notes = "회원 아이디", example = "one_zzini_")
private final String userId;

@ApiModelProperty(notes = "프로필 이미지 url", example = "image_url")
private final String profileImageUrl;
Expand All @@ -70,8 +73,9 @@ public GetHashtagPictureDto (
Boolean isMine,
Boolean isLiked,
Boolean isScraped,
Long floorNo,
Long userNo,
String id,
String userId,
String profileImageUrl
) {
this.pictureNo = pictureNo;
Expand All @@ -86,8 +90,9 @@ public GetHashtagPictureDto (
this.isMine = isMine;
this.isLiked = isLiked;
this.isScraped = isScraped;
this.floorNo = floorNo;
this.userNo = userNo;
this.id = id;
this.userId = userId;
this.profileImageUrl = profileImageUrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface PictureHashtagRepository extends JpaRepository <PictureHashtag,
void deleteByNo(Long pictureHashtagNo);

@Query(value = "SELECT count(l.no) as count, p.no as pictureNo, p.image_url as imageUrl, p.title, p.manufacture_year as manufactureYear, p.material, p.scale, p.description, " +
" p.height, p.width, u.no as userNo, u.id, u.profile_image_url as profileImageUrl " +
" p.height, p.width, p.floor_no as floorNo, u.no as userNo, u.id as userId, u.profile_image_url as profileImageUrl " +
"FROM oeuvre.picture_hashtag ph LEFT JOIN oeuvre.picture p on ph.picture_no = p.no " +
" LEFT JOIN oeuvre.likes l on p.no = l.picture_no " +
" LEFT JOIN oeuvre.floor f on p.floor_no = f.no " +
Expand All @@ -39,13 +39,14 @@ interface GetPopularPicture {
String getDescription();
Float getHeight();
Float getWidth();
Long getFloorNo();
Long getUserNo();
String getId();
String getUserId();
String getProfileImageUrl();
}

@Query(value = "SELECT distinct p.no as pictureNo, p.image_url as imageUrl, p.title, p.manufacture_year as manufactureYear, p.material, p.scale, p.description, p.height, p.width, " +
" user.no as userNo, user.id, user.profile_image_url as profileImageUrl, " +
" p.floor_no as floorNo, user.no as userNo, user.id as userId, user.profile_image_url as profileImageUrl, " +
" (SELECT count(likes.no) FROM oeuvre.picture LEFT JOIN oeuvre.likes ON likes.picture_no = p.no and likes.status = 1 WHERE picture.status = 1) as count " +
"FROM oeuvre.picture p " +
" LEFT JOIN oeuvre.picture_hashtag ph ON p.no = ph.picture_no " +
Expand All @@ -69,7 +70,7 @@ interface GetPopularPicture {
Page<GetHashtagPicture> findAllByHashtagNoSortByPopular(@Param("hashtagNo") Long hashtagNo, @Param("userNo") Long userNo, Pageable pageable);

@Query(value = "SELECT distinct p.no as pictureNo, p.image_url as imageUrl, p.title, p.manufacture_year as manufactureYear, p.material, p.scale, p.description, p.height, p.width, " +
" user.no as userNo, user.id, user.profile_image_url as profileImageUrl " +
" p.floor_no as floorNo ,user.no as userNo, user.id as userId, user.profile_image_url as profileImageUrl " +
"FROM oeuvre.picture p " +
" LEFT JOIN oeuvre.picture_hashtag ph ON p.no = ph.picture_no " +
" LEFT JOIN oeuvre.floor ON p.floor_no = floor.no " +
Expand Down Expand Up @@ -97,8 +98,9 @@ interface GetHashtagPicture {
String getDescription();
Float getHeight();
Float getWidth();
Long getFloorNo();
Long getUserNo();
String getId();
String getUserId();
String getProfileImageUrl();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ public List<GetPopularHashtagResponseDto> getPopularHashtags(User user) {
Objects.equals(picture.getUserNo(), user.getNo()),
likesRepository.existsByUserNoAndPictureNo(user.getNo(), picture.getPictureNo()),
scrapRepository.existsByUserNoAndPictureNo(user.getNo(), picture.getPictureNo()),
picture.getFloorNo(),
picture.getUserNo(),
picture.getId(),
picture.getUserId(),
picture.getProfileImageUrl()
));
});
Expand Down Expand Up @@ -111,8 +112,9 @@ public PageResponseDto<List<GetHashtagPictureDto>> getHashtagPictures(User user,
Objects.equals(picture.getUserNo(), user.getNo()),
likesRepository.existsByUserNoAndPictureNo(user.getNo(), picture.getPictureNo()),
scrapRepository.existsByUserNoAndPictureNo(user.getNo(), picture.getPictureNo()),
picture.getFloorNo(),
picture.getUserNo(),
picture.getId(),
picture.getUserId(),
picture.getProfileImageUrl()
));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ public void deleteUser(User user) {
pictures.forEach( picture -> {
picture.setStatus(0);
pictureHashtagRepository.deleteAllByPictureNo(picture.getNo());
likesRepository.deleteAllByPictureNo(picture.getNo());
scrapRepository.deleteAllByPictureNo(picture.getNo());
});
pictureRepository.saveAll(pictures);
Expand Down

0 comments on commit 25d4e43

Please sign in to comment.