Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: 상품 할인율 관련 코드 수정 #50

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/main/java/com/example/neoul/dto/product/ProductRes.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ public class ProductRes {
@Setter
@Getter
// main - 상품 상세조회
public static class ProductDetailRes {
public static class ProductDetailRes { //todo 상품 할인률, 할인가 추가
private Long productId; //상품 id
private Long brandId; //브랜드 id
private Long categoryPId; //카테고리 id
private String categoryName; //상품 카테고리
private String productName; //상품명
private Integer price; //상품금액
private Integer discountedRatio; //상품 할인률
private Integer discountedSalePrice; //상품 할인가
private List<String> productImgList; //상품사진
private String deliveryInfo; //상품 배송정보 (무료배송 etc..)
private String productUrl; //상품상세 url
Expand Down Expand Up @@ -71,9 +73,15 @@ public static class getLikedProductRes {
@Builder
@Setter
@Getter
public static class LikedProductList {
private Long productId; //브랜드 id
private String productName; //브랜드 이름
public static class LikedProductList { //상품 이미지,브랜드 이름, 가격, 할인률 추가
private Long productId; //상품 id
private String productName; //상품명
private List<String> productImgList; //상품사진
private Long brandId; //브랜드 id
private String brandName; //브랜드 이름
private Integer price; //상품금액
private Integer discountedRatio; //상품 할인률
private Integer discountedSalePrice; //상품 할인가
}


Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/example/neoul/entity/brand/Product.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public class Product extends BaseEntity {

private Integer price;

@Column(name = "discounted_ratio")
private Integer discountedRatio; //상품 할인률

@Column(name = "discounted_sale_price")
private Integer discountedSalePrice; //상품 할인가

@Column(name = "delivery_info")
private String deliveryInfo; //배송정보

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/example/neoul/service/ProductService.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public ProductRes.ProductDetailRes getProduct(Long productId) {
.categoryName(product.getCategoryP().getName()) //얘는 살려야함
.productName(product.getName())
.price(product.getPrice())
.discountedRatio(product.getDiscountedRatio())
.discountedSalePrice(product.getDiscountedSalePrice())
.productImgList(productImgList) //얘는 살려야함
.deliveryInfo(product.getDeliveryInfo())
.productUrl(product.getProductUrl())
Expand Down