I having trouble with netPrice, publishStatus column in Product table. I'm trying to update product table, but input goes wrong way. (PUT netPrice(input) -> publishStatus(output)), (PUT publishStatus(input) -> netPrice(output)). I think tables are twisted.
@Transactional
public String update(String productNumber, ProductUpdateRequestDto requestDto){
Product product = productRepository.findByProductNumber(productNumber);
product.update(requestDto.getProductName(),
product.getProductNumber(),
requestDto.getStockQuantity(),
requestDto.getDescription(),
requestDto.getCategoryId() ,
requestDto.getPublishStatus(),
requestDto.getNetPrice(), requestDto.getUnit());
return productNumber;
@Getter
@NoArgsConstructor
public class ProductUpdateRequestDto {
private String productName;
private String productNumber;
private int stockQuantity;
private String description;
private Long categoryId;
private int publishStatus;
private int netPrice;
private String unit;
@Builder
public ProductUpdateRequestDto(String productName, String productNumber, int stockQuantity, String description, Long categoryId, int publishStatus, int netPrice, String unit){
this.productName = productName;
this.productNumber =productNumber;
this.stockQuantity = stockQuantity;
this.description = description;
this.categoryId = categoryId;
this.netPrice = netPrice;
this.publishStatus = publishStatus;
this.unit = unit;
}
if you need more info to understand my question. I will update it!
@Builder
public void update(String productName, String productNumber, int stockQuantity, String description, Long categoryId, int netPrice, int publishStatus, String unit){
this.productName = productName;
this.productNumber = productNumber;
this.stockQuantity = stockQuantity;
this.description = description;
this.categoryId = categoryId;
this.netPrice = netPrice;
this.publishStatus = publishStatus;
this.unit = unit;