diff --git a/src/main/java/com/ycwl/basic/pricing/enums/ProductCategory.java b/src/main/java/com/ycwl/basic/pricing/enums/ProductCategory.java new file mode 100644 index 00000000..f9aa75a3 --- /dev/null +++ b/src/main/java/com/ycwl/basic/pricing/enums/ProductCategory.java @@ -0,0 +1,33 @@ +package com.ycwl.basic.pricing.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 商品分类枚举 + */ +@Getter +@AllArgsConstructor +public enum ProductCategory { + + VLOG("VLOG", "Vlog类"), + PHOTO("PHOTO", "照片类"), + VIDEO("VIDEO", "视频类"), + PRINT("PRINT", "打印类"), + OTHER("OTHER", "其他"); + + private final String code; + private final String description; + + /** + * 根据代码获取枚举 + */ + public static ProductCategory fromCode(String code) { + for (ProductCategory category : values()) { + if (category.code.equals(code)) { + return category; + } + } + throw new IllegalArgumentException("Unknown product category code: " + code); + } +} diff --git a/src/main/java/com/ycwl/basic/pricing/enums/ProductType.java b/src/main/java/com/ycwl/basic/pricing/enums/ProductType.java index e5021261..d2cab829 100644 --- a/src/main/java/com/ycwl/basic/pricing/enums/ProductType.java +++ b/src/main/java/com/ycwl/basic/pricing/enums/ProductType.java @@ -9,20 +9,29 @@ import lombok.Getter; @Getter @AllArgsConstructor public enum ProductType { - - VLOG_VIDEO("VLOG_VIDEO", "Vlog视频"), - RECORDING_SET("RECORDING_SET", "录像集"), - PHOTO_SET("PHOTO_SET", "照相集"), - PHOTO_LOG("PHOTO_LOG", "pLog图"), - PHOTO_VLOG("PHOTO_VLOG", "pLog视频"), - PHOTO_PRINT("PHOTO_PRINT", "照片打印"), - PHOTO_PRINT_MU("PHOTO_PRINT_MU", "手机照片打印"), - PHOTO_PRINT_FX("PHOTO_PRINT_FX", "特效照片打印"), - MACHINE_PRINT("MACHINE_PRINT", "一体机打印"); - + + // VLOG类 + VLOG_VIDEO("VLOG_VIDEO", "Vlog视频", ProductCategory.VLOG), + PHOTO_VLOG("PHOTO_VLOG", "pLog视频", ProductCategory.VLOG), + + // 照片类 + PHOTO("PHOTO", "照片", ProductCategory.PHOTO), + PHOTO_SET("PHOTO_SET", "照片集", ProductCategory.PHOTO), + PHOTO_LOG("PHOTO_LOG", "pLog图", ProductCategory.PHOTO), + + // 视频类(素材视频) + RECORDING_SET("RECORDING_SET", "录像集", ProductCategory.VIDEO), + + // 其他类(打印类等) + PHOTO_PRINT("PHOTO_PRINT", "照片打印", ProductCategory.PRINT), + PHOTO_PRINT_MU("PHOTO_PRINT_MU", "手机照片打印", ProductCategory.PRINT), + PHOTO_PRINT_FX("PHOTO_PRINT_FX", "特效照片打印", ProductCategory.PRINT), + MACHINE_PRINT("MACHINE_PRINT", "一体机打印", ProductCategory.PRINT); + private final String code; private final String description; - + private final ProductCategory category; + /** * 根据代码获取枚举 */ @@ -34,4 +43,18 @@ public enum ProductType { } throw new IllegalArgumentException("Unknown product type code: " + code); } + + /** + * 获取分类代码 + */ + public String getCategoryCode() { + return category.getCode(); + } + + /** + * 获取分类描述 + */ + public String getCategoryDescription() { + return category.getDescription(); + } } \ No newline at end of file