-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from hyundai-fruitfruit/fix/review-res
Fix/review res 응답 형식 변경
- Loading branch information
Showing
23 changed files
with
396 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.hyundai.app.guide; | ||
|
||
import com.hyundai.app.guide.domain.Guide; | ||
import com.hyundai.app.guide.domain.HashtagCategory; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author 황수영 | ||
* @since 2024/03/09 | ||
* (설명) | ||
*/ | ||
public interface GuideMapper { | ||
|
||
List<Guide> getGuideAll(); | ||
List<HashtagCategory> getHashtagCategoryAll(); | ||
} |
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,66 @@ | ||
package com.hyundai.app.guide; | ||
|
||
import com.hyundai.app.guide.domain.Guide; | ||
import com.hyundai.app.guide.domain.HashtagCategory; | ||
import com.hyundai.app.guide.dto.GuideTypeResDto; | ||
import com.hyundai.app.guide.dto.HashtagListResDto; | ||
import com.hyundai.app.store.domain.Hashtag; | ||
import com.hyundai.app.store.mapper.HashtagMapper; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.log4j.Log4j; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.NoSuchElementException; | ||
|
||
/** | ||
* @author 황수영 | ||
* @since 2024/03/09 | ||
* (설명) | ||
*/ | ||
@Log4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class GuideService { | ||
|
||
private final GuideMapper guideMapper; | ||
private final HashtagMapper hashtagMapper; | ||
|
||
public List<GuideTypeResDto> getGuideAll() { | ||
List<Guide> guideList = guideMapper.getGuideAll(); | ||
List<GuideTypeResDto> guideTypeList = GuideType.of(guideList); | ||
log.debug("GuideService 전체 가이드 조회 : " + guideTypeList); | ||
return guideTypeList; | ||
} | ||
|
||
/** | ||
* @author 황수영 | ||
* @since 2024/02/26 | ||
* 분류별 해시태그 전체 조회 | ||
*/ | ||
public List<HashtagListResDto> getHashtagCategoryAll(String guideType) { | ||
log.debug("분류별 해시태그 조회 분류 : " + guideType); | ||
GuideType guideTypeEnum = GuideType.valueOf(guideType.toUpperCase()); | ||
log.debug("분류별 해시태그 조회 분류 : " + guideTypeEnum); | ||
|
||
List<HashtagCategory> hashtagCategories = guideMapper.getHashtagCategoryAll(); | ||
|
||
// TODO: 캐싱 필요! | ||
List<HashtagListResDto> result = new ArrayList<>(); | ||
|
||
for (String category : guideTypeEnum.getHashtagType()) { | ||
List<Hashtag> hashtags = hashtagMapper.getHashtagByCategory(category); | ||
String korean = hashtagCategories.stream() | ||
.filter(h -> h.getTitle().equals(category)) | ||
.findFirst() | ||
.map(HashtagCategory::getKorean) | ||
.orElseThrow(NoSuchElementException::new); | ||
// 한글로 변경 | ||
HashtagListResDto hashtagListResDto = new HashtagListResDto(korean, hashtags); | ||
result.add(hashtagListResDto); | ||
log.debug("분류별 해시태그 조회 => category : " + category + " : " + hashtagListResDto); | ||
} | ||
return result; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.hyundai.app.guide; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
/** | ||
* @author 황수영 | ||
* @since 2024/03/09 | ||
* (설명) | ||
*/ | ||
@Getter | ||
@AllArgsConstructor | ||
public enum HashtagType { | ||
|
||
FOOD(10000, "음식"), | ||
ATMOSPHERE(10001, "분위기"), | ||
ETC(10002, "가격"); | ||
|
||
private final int id; | ||
private final String korean; | ||
} |
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,22 @@ | ||
package com.hyundai.app.guide.domain; | ||
|
||
import lombok.*; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author 황수영 | ||
* @since 2024/03/09 | ||
* (설명) | ||
*/ | ||
@Getter | ||
@Builder | ||
@ToString | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Guide { | ||
|
||
private int id; | ||
private String korean; | ||
private String guideType; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/hyundai/app/guide/domain/HashtagCategory.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,18 @@ | ||
package com.hyundai.app.guide.domain; | ||
|
||
import lombok.*; | ||
|
||
/** | ||
* @author 황수영 | ||
* @since 2024/03/09 | ||
* (설명) | ||
*/ | ||
@Getter | ||
@Builder | ||
@ToString | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class HashtagCategory { | ||
private String title; | ||
private String korean; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.hyundai.app.store.domain; | ||
|
||
import lombok.*; | ||
|
||
/** | ||
* @author 황수영 | ||
* @since 2024/03/04 | ||
* (설명) | ||
*/ | ||
|
||
@Getter | ||
@Builder | ||
@ToString | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Image { | ||
|
||
private int id; | ||
private String imgUrl; | ||
private int storeId; | ||
private String memberId; | ||
private String reviewId; | ||
} |
Oops, something went wrong.