diff --git a/home-service/src/main/java/com/cxx/home/dto/ProductDto.java b/home-service/src/main/java/com/cxx/home/dto/ProductDto.java index 0116fb7..79eacbd 100644 --- a/home-service/src/main/java/com/cxx/home/dto/ProductDto.java +++ b/home-service/src/main/java/com/cxx/home/dto/ProductDto.java @@ -32,18 +32,10 @@ public class ProductDto { @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date expiryDate; - @Schema(description = "总天数") - @JsonView(ReadView.class) - private Integer totalDay; - @Schema(description = "价格") @PositiveOrZero(message = "商品价格必须大于等于0") private Double price; - @Schema(description = "日均价格") - @JsonView(ReadView.class) - private Double averagePrice; - @Schema(description = "类别") private String category; diff --git a/home-service/src/main/resources/mapper/ProductMapper.xml b/home-service/src/main/resources/mapper/ProductMapper.xml index 9c554b9..fdb4fc2 100644 --- a/home-service/src/main/resources/mapper/ProductMapper.xml +++ b/home-service/src/main/resources/mapper/ProductMapper.xml @@ -7,9 +7,7 @@ name AS name, purchase_date AS purchaseDate, expiry_date AS expiryDate, - @totalDay := (DATEDIFF(CURDATE(), purchase_date) + 1) AS totalDay, price AS price, - ROUND(price / @totalDay, 2) AS averagePrice, category AS category, purchaser AS purchaser, channel AS channel, @@ -24,11 +22,8 @@ ORDER BY purchase_date DESC - - ORDER BY totalDay - - ORDER BY averagePrice + ORDER BY price DESC