feat:更新物品返回数据类型
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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 @@
|
||||
<if test="query.order == 'date' or query.order == '' or query.order == null">
|
||||
ORDER BY purchase_date DESC
|
||||
</if>
|
||||
<if test="query.order == 'day'">
|
||||
ORDER BY totalDay
|
||||
</if>
|
||||
<if test="query.order == 'price'">
|
||||
ORDER BY averagePrice
|
||||
ORDER BY price DESC
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user