diff --git a/src/main/java/shop/hooking/hooking/dto/response/BrandRes.java b/src/main/java/shop/hooking/hooking/dto/response/BrandRes.java index 4ca7a9b..c1b40a0 100644 --- a/src/main/java/shop/hooking/hooking/dto/response/BrandRes.java +++ b/src/main/java/shop/hooking/hooking/dto/response/BrandRes.java @@ -50,6 +50,7 @@ public static class cardDto{ private Integer scrapCnt; private LocalDateTime createdAt; private Integer isScrap; + private String cardLink; } } diff --git a/src/main/java/shop/hooking/hooking/dto/response/CopyRes.java b/src/main/java/shop/hooking/hooking/dto/response/CopyRes.java index 757c384..639619e 100644 --- a/src/main/java/shop/hooking/hooking/dto/response/CopyRes.java +++ b/src/main/java/shop/hooking/hooking/dto/response/CopyRes.java @@ -23,26 +23,30 @@ public class CopyRes implements Comparable{ private Integer scrapCnt; private LocalDateTime createdAt; private List index; + private String cardLink; private LocalDateTime scrapTime; private Integer isScrap; + @Builder @QueryProjection - public CopyRes(Long id, Brand brand, String text, Integer scrapCnt,LocalDateTime createdAt) { + public CopyRes(Long id, Brand brand, String text, Integer scrapCnt,LocalDateTime createdAt,String cardLink) { this.id = id; this.brandName = brand.getBrandName(); this.text = text; this.scrapCnt = scrapCnt; this.createdAt = createdAt; + this.cardLink = cardLink; } - public CopyRes(Long id, Brand brand, String text, LocalDateTime createdAt) { + public CopyRes(Long id, Brand brand, String text, LocalDateTime createdAt,String cardLink) { this.id = id; this.brandName = brand.getBrandName(); this.text = text; this.scrapCnt = 0; this.createdAt = createdAt; + this.cardLink = cardLink; } //왜안됨..? diff --git a/src/main/java/shop/hooking/hooking/repository/CardJpaRepository.java b/src/main/java/shop/hooking/hooking/repository/CardJpaRepository.java index ba512d6..7da6f81 100644 --- a/src/main/java/shop/hooking/hooking/repository/CardJpaRepository.java +++ b/src/main/java/shop/hooking/hooking/repository/CardJpaRepository.java @@ -65,7 +65,8 @@ public List filter(CardSearchCondition condition){ card.brand, card.text, card.scrapCnt, - card.createdAt)) + card.createdAt, + card.url)) .from(card) .leftJoin(card.brand, brand) // card, brand 조인 .leftJoin(have) // brand, have 조인 -> brandid가 같은 행을 조인 @@ -91,7 +92,8 @@ public List searchMood(String q){ card.brand, card.text, card.scrapCnt, - card.createdAt)) + card.createdAt, + card.url)) .from(card) .leftJoin(card.brand, brand) .leftJoin(have) @@ -110,7 +112,8 @@ public List searchCopy(String q){ card.brand, card.text, card.scrapCnt, - card.createdAt)) + card.createdAt, + card.url)) .from(card) .where(textContainsQ) .fetch(); @@ -125,7 +128,8 @@ public List searchBrand(String q){ card.brand, card.text, card.scrapCnt, - card.createdAt)) + card.createdAt, + card.url)) .from(card) .leftJoin(card.brand, brand) .where(brandContainsQ) diff --git a/src/main/java/shop/hooking/hooking/service/BrandService.java b/src/main/java/shop/hooking/hooking/service/BrandService.java index bcf5009..15d4989 100644 --- a/src/main/java/shop/hooking/hooking/service/BrandService.java +++ b/src/main/java/shop/hooking/hooking/service/BrandService.java @@ -73,6 +73,7 @@ public BrandRes.BrandDetailDto getOneBrand(Long id) { cardDto.setText(card.getText()); cardDto.setCreatedAt(card.getCreatedAt()); cardDto.setScrapCnt(card.getScrapCnt()); + cardDto.setCardLink(card.getUrl()); cardDtos.add(cardDto); } diff --git a/src/main/java/shop/hooking/hooking/service/CopyService.java b/src/main/java/shop/hooking/hooking/service/CopyService.java index bf8bba9..d7cbbef 100644 --- a/src/main/java/shop/hooking/hooking/service/CopyService.java +++ b/src/main/java/shop/hooking/hooking/service/CopyService.java @@ -223,9 +223,10 @@ public CopyRes createCopyRes(Card card) { Brand brand = card.getBrand(); String text = card.getText(); + String cardLink = card.getUrl(); Integer scrapCnt = length; LocalDateTime createdAt = card.getCreatedAt(); - return new CopyRes(id, brand,text,scrapCnt,createdAt); + return new CopyRes(id, brand,text,scrapCnt,createdAt,cardLink); } public List getCopyListFromBrandsAndSetScrapCnt(HttpServletRequest httpRequest, int index, int limit) { @@ -287,9 +288,10 @@ public CopyRes createScrapRes(Scrap scrap) { Brand brand = scrap.getCard().getBrand(); String text = scrap.getCard().getText(); + String cardLink = scrap.getCard().getUrl(); Integer scrapCnt = length; LocalDateTime createdAt = scrap.getCard().getCreatedAt(); - return new CopyRes(id, brand,text,scrapCnt,createdAt); + return new CopyRes(id, brand,text,scrapCnt,createdAt,cardLink); } public List searchFilterCard(HttpServletRequest httpRequest, int index, CardSearchCondition condition) {