Skip to content

Commit

Permalink
[BE][:wrench: FIX:]: Product controller put method 중복 로직 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
ohoraming committed Aug 8, 2022
1 parent e423cf0 commit 6ab5dab
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/com/narang/web/entity/Product.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,17 @@ public class Product {

@LastModifiedDate
private LocalDateTime updates;

public Product replace(Product compare) {
this.setCategory(compare.getCategory() != null ? compare.getCategory() : this.getCategory());
this.setName(compare.getName() != null ? compare.getName() : this.getName());
this.setPrice(compare.getPrice() != null ? compare.getPrice() : this.getPrice());
this.setAmount(compare.getAmount() != null ? compare.getAmount() : this.getAmount());
this.setContent(compare.getContent() != null ? compare.getContent() : this.getContent());
this.setSeller(compare.getSeller() != null ? compare.getSeller() : this.getSeller());
this.setIsSoldOut(compare.getIsSoldOut() == true ? compare.getIsSoldOut() : this.getIsSoldOut());
return this;
}
}


0 comments on commit 6ab5dab

Please sign in to comment.