feat: 优惠券适用范围字段添加

This commit is contained in:
郝先瑞 2022-07-13 23:50:14 +08:00
parent 5b523499b9
commit 293bd6c81d
4 changed files with 41 additions and 40 deletions

View File

@ -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<Integer> {
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;
}
}

View File

@ -92,7 +92,7 @@ public class SmsCoupon extends BaseEntity {
/**
* 使用类型(0-全场通用;1-指定商品分类;2-指定商品)
*/
private Integer useType;
private Integer applicationScope;
/**
* 发行量(-1:无限制)

View File

@ -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;
}

View File

@ -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<CouponSpuCategory> spuCategoryList;
@ApiModelProperty("优惠券适用商品分类ID集合")
private List<Long> spuCategoryIds;
@ApiModelProperty("优惠券适用商品列表")
private List<CouponSpu> 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<Long> spuIds;
}