From 293bd6c81d69f5f1b80ac08b7d66631b30914436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Wed, 13 Jul 2022 23:50:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E6=83=A0=E5=88=B8=E9=80=82?= =?UTF-8?q?=E7=94=A8=E8=8C=83=E5=9B=B4=E5=AD=97=E6=AE=B5=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enums/CouponApplicationScopeEnum.java | 34 ++++++++++++++++ .../mall/sms/pojo/entity/SmsCoupon.java | 2 +- .../sms/pojo/entity/SmsCouponSpuCategory.java | 6 +-- .../youlai/mall/sms/pojo/form/CouponForm.java | 39 +++---------------- 4 files changed, 41 insertions(+), 40 deletions(-) create mode 100644 mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/common/enums/CouponApplicationScopeEnum.java diff --git a/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/common/enums/CouponApplicationScopeEnum.java b/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/common/enums/CouponApplicationScopeEnum.java new file mode 100644 index 000000000..39453e4cd --- /dev/null +++ b/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/common/enums/CouponApplicationScopeEnum.java @@ -0,0 +1,34 @@ +package com.youlai.mall.sms.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; +import com.youlai.common.base.IBaseEnum; +import lombok.Getter; + +/** + * 优惠券适用类型枚举 + * + * @author haoxr + * @date 2022/7/13 + */ +@Getter +public enum CouponApplicationScopeEnum implements IBaseEnum { + + ALL(0, "全场通用"), + SPU_CATEGORY(1, "指定商品分类"), + SPU(2, "指定商品"), + ; + + @Getter + @EnumValue // Mybatis-Plus 提供注解表示插入数据库时插入该值 + private Integer value; + + @Getter + @JsonValue // 表示对枚举序列化时返回此字段 + private String label; + + CouponApplicationScopeEnum(Integer value, String label) { + this.value = value; + this.label = label; + } +} diff --git a/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/entity/SmsCoupon.java b/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/entity/SmsCoupon.java index a34aa1215..d2a17a524 100644 --- a/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/entity/SmsCoupon.java +++ b/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/entity/SmsCoupon.java @@ -92,7 +92,7 @@ public class SmsCoupon extends BaseEntity { /** * 使用类型(0-全场通用;1-指定商品分类;2-指定商品) */ - private Integer useType; + private Integer applicationScope; /** * 发行量(-1:无限制) diff --git a/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/entity/SmsCouponSpuCategory.java b/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/entity/SmsCouponSpuCategory.java index eba83bb29..58fa0f761 100644 --- a/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/entity/SmsCouponSpuCategory.java +++ b/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/entity/SmsCouponSpuCategory.java @@ -3,6 +3,7 @@ package com.youlai.mall.sms.pojo.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; import lombok.Data; import java.io.Serializable; @@ -26,11 +27,6 @@ public class SmsCouponSpuCategory implements Serializable { */ private Long categoryId; - /** - * 商品分类名称 - */ - private String categoryName; - @TableField(exist = false) private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/form/CouponForm.java b/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/form/CouponForm.java index e152d3c25..f68b43f96 100644 --- a/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/form/CouponForm.java +++ b/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/pojo/form/CouponForm.java @@ -64,44 +64,15 @@ public class CouponForm { @ApiModelProperty("有效期截止时间") private Date validityEndTime; - @ApiModelProperty("使用类型(0:全场通用;1:指定商品分类;2:指定商品)") - private Integer useType; + @ApiModelProperty("应用范围(0:全场通用;1:指定商品分类;2:指定商品)") + private Integer applicationScope; @ApiModelProperty("备注") private String remark; - @ApiModelProperty("优惠券适用商品分类列表") - private List spuCategoryList; + @ApiModelProperty("优惠券适用商品分类ID集合") + private List spuCategoryIds; @ApiModelProperty("优惠券适用商品列表") - private List spuList; - - @ApiModel("优惠券适用商品分类") - @Data - public static class CouponSpuCategory { - - private Long id; - - private Long categoryId; - - private String categoryName; - - } - - @ApiModel("优惠券适用商品") - @Data - - public static class CouponSpu { - - private Long id; - - private Long spuId; - - private String spuName; - - } - - public static void main(String[] args) { - double div = NumberUtil.div(1L, 1L); - } + private List spuIds; } \ No newline at end of file