Commit 3870f2fcbf81c61d73e461c2893f8ee735626769

Authored by 芋道源码
Committed by GitHub
2 parents 9d2e98af bf154949

Merge pull request #1235 from dadiyang/fix/product-sku-price-min

[ENHANCE] 商城:商品 SKU 五个金额字段补接口层下限校验(>=0)
yudao-module-mall/yudao-module-product/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSkuSaveReqVO.java
1 package cn.iocoder.yudao.module.product.controller.admin.spu.vo; 1 package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
2 2
3 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
  4 +import jakarta.validation.constraints.Min;
4 import jakarta.validation.constraints.NotEmpty; 5 import jakarta.validation.constraints.NotEmpty;
5 import jakarta.validation.constraints.NotNull; 6 import jakarta.validation.constraints.NotNull;
6 import lombok.*; 7 import lombok.*;
@@ -17,12 +18,15 @@ public class ProductSkuSaveReqVO { @@ -17,12 +18,15 @@ public class ProductSkuSaveReqVO {
17 18
18 @Schema(description = "销售价格,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1999") 19 @Schema(description = "销售价格,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1999")
19 @NotNull(message = "销售价格,单位:分不能为空") 20 @NotNull(message = "销售价格,单位:分不能为空")
  21 + @Min(value = 0, message = "销售价格,单位:分不能小于 0")
20 private Integer price; 22 private Integer price;
21 23
22 @Schema(description = "市场价", example = "2999") 24 @Schema(description = "市场价", example = "2999")
  25 + @Min(value = 0, message = "市场价不能小于 0")
23 private Integer marketPrice; 26 private Integer marketPrice;
24 27
25 @Schema(description = "成本价", example = "19") 28 @Schema(description = "成本价", example = "19")
  29 + @Min(value = 0, message = "成本价不能小于 0")
26 private Integer costPrice; 30 private Integer costPrice;
27 31
28 @Schema(description = "条形码", example = "15156165456") 32 @Schema(description = "条形码", example = "15156165456")
@@ -43,9 +47,11 @@ public class ProductSkuSaveReqVO { @@ -43,9 +47,11 @@ public class ProductSkuSaveReqVO {
43 private Double volume; 47 private Double volume;
44 48
45 @Schema(description = "一级分销的佣金,单位:分", example = "199") 49 @Schema(description = "一级分销的佣金,单位:分", example = "199")
  50 + @Min(value = 0, message = "一级分销的佣金,单位:分不能小于 0")
46 private Integer firstBrokeragePrice; 51 private Integer firstBrokeragePrice;
47 52
48 @Schema(description = "二级分销的佣金,单位:分", example = "19") 53 @Schema(description = "二级分销的佣金,单位:分", example = "19")
  54 + @Min(value = 0, message = "二级分销的佣金,单位:分不能小于 0")
49 private Integer secondBrokeragePrice; 55 private Integer secondBrokeragePrice;
50 56
51 @Schema(description = "属性数组") 57 @Schema(description = "属性数组")