Skip to content

Commit

Permalink
Merge pull request #105 from Hooking-CEOS/feature/copy
Browse files Browse the repository at this point in the history
Feature/copy
  • Loading branch information
JiwonKim08 authored Aug 1, 2023
2 parents d301c3a + cd3cc2c commit 3c1a412
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static class cardDto{
private Integer scrapCnt;
private LocalDateTime createdAt;
private Integer isScrap;
private String cardLink;
}

}
8 changes: 6 additions & 2 deletions src/main/java/shop/hooking/hooking/dto/response/CopyRes.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,30 @@ public class CopyRes implements Comparable<CopyRes>{
private Integer scrapCnt;
private LocalDateTime createdAt;
private List<Integer> 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;
}

//왜안됨..?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public List<CopyRes> 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가 같은 행을 조인
Expand All @@ -91,7 +92,8 @@ public List<CopyRes> searchMood(String q){
card.brand,
card.text,
card.scrapCnt,
card.createdAt))
card.createdAt,
card.url))
.from(card)
.leftJoin(card.brand, brand)
.leftJoin(have)
Expand All @@ -110,7 +112,8 @@ public List<CopyRes> searchCopy(String q){
card.brand,
card.text,
card.scrapCnt,
card.createdAt))
card.createdAt,
card.url))
.from(card)
.where(textContainsQ)
.fetch();
Expand All @@ -125,7 +128,8 @@ public List<CopyRes> searchBrand(String q){
card.brand,
card.text,
card.scrapCnt,
card.createdAt))
card.createdAt,
card.url))
.from(card)
.leftJoin(card.brand, brand)
.where(brandContainsQ)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/shop/hooking/hooking/service/CopyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<CopyRes> getCopyListFromBrandsAndSetScrapCnt(HttpServletRequest httpRequest, int index, int limit) {
Expand Down Expand Up @@ -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<CopyRes> searchFilterCard(HttpServletRequest httpRequest, int index, CardSearchCondition condition) {
Expand Down

0 comments on commit 3c1a412

Please sign in to comment.