From 70b097f2672cef858c1044c1e077588094df80b7 Mon Sep 17 00:00:00 2001 From: chen-xin-zhi <3588068430@qq.com> Date: Sat, 9 Nov 2024 16:26:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BA=86=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E7=AB=AF=E7=94=A8=E6=88=B7=E5=88=9B=E5=BB=BA=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/enums/FileUploadBizEnum.java | 1 - .../heritage/model/enums/GoodTypeEnum.java | 50 +++++++++++++++++++ .../cultural/heritage/model/vo/GoodVO.java | 6 +++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/cultural/heritage/model/enums/GoodTypeEnum.java diff --git a/src/main/java/com/cultural/heritage/model/enums/FileUploadBizEnum.java b/src/main/java/com/cultural/heritage/model/enums/FileUploadBizEnum.java index ca37a61..a7c1c49 100644 --- a/src/main/java/com/cultural/heritage/model/enums/FileUploadBizEnum.java +++ b/src/main/java/com/cultural/heritage/model/enums/FileUploadBizEnum.java @@ -3,7 +3,6 @@ package com.cultural.heritage.model.enums; import lombok.Getter; import org.springframework.util.ObjectUtils; -import java.io.File; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; diff --git a/src/main/java/com/cultural/heritage/model/enums/GoodTypeEnum.java b/src/main/java/com/cultural/heritage/model/enums/GoodTypeEnum.java new file mode 100644 index 0000000..a104bf5 --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/enums/GoodTypeEnum.java @@ -0,0 +1,50 @@ +package com.cultural.heritage.model.enums; + +import org.springframework.util.ObjectUtils; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + + +/** + * 商品类型枚举类 + */ +public enum GoodTypeEnum { + + PRODUCT("常规类商品", "product"), + SERVICE("服务类商品", "service"); + + private final String text; + + private final String value; + + GoodTypeEnum(String text, String value) { + this.text = text; + this.value = value; + } + + + /** + * 获取值列表 + */ + public static List getValues() { + return Arrays.stream(values()).map(item -> item.value).collect(Collectors.toList()); + } + + /** + * 根据 value 获取枚举 + */ + public static GoodTypeEnum getEnumByValue(String value) { + if (ObjectUtils.isEmpty(value)) { + return null; + } + for (GoodTypeEnum anEnum : GoodTypeEnum.values()) { + if (anEnum.value.equals(value)) { + return anEnum; + } + } + return null; + } + +} diff --git a/src/main/java/com/cultural/heritage/model/vo/GoodVO.java b/src/main/java/com/cultural/heritage/model/vo/GoodVO.java index 8dc8716..8b9cb5e 100644 --- a/src/main/java/com/cultural/heritage/model/vo/GoodVO.java +++ b/src/main/java/com/cultural/heritage/model/vo/GoodVO.java @@ -34,6 +34,12 @@ public class GoodVO implements Serializable { private String goodImg; + /** + * 商品库存量 + */ + private Integer inventory; + + /** * 商品标签 */