Coupon.java
3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package com.topdraw.business.module.coupon.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* @author XiangHan
* @date 2021-10-22
*/
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@Accessors(chain = true)
@Table(name="m_coupon")
public class Coupon implements Serializable {
/** id */
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
/** 标识 */
@Column(name = "code", nullable = false)
private String code;
/** 名称 */
@Column(name = "title", nullable = false)
private String title;
/** 图片 */
@Column(name = "images")
private String images;
/** 发行量,-1代表不限量 */
@Column(name = "stock")
private Integer stock;
/** 剩余量,-1代表不限量 */
@Column(name = "remain_stock")
private Integer remainStock;
/** 优惠形式:1:现金;2:折扣 */
@Column(name = "use_type")
private Integer useType;
/** 面额 */
@Column(name = "denomination")
private BigDecimal denomination;
/** 折扣 */
@Column(name = "discount")
private BigDecimal discount;
/** 适用用户范围:1:新用户;2:全体用户 */
@Column(name = "user_range")
private Integer userRange;
/** 限领次数 -1:无限次; >0:具体次数 */
@Column(name = "collect_limit")
private Integer collectLimit;
/** 适用门槛:1:无门槛;2:满减形式 */
@Column(name = "threshold_type")
private Integer thresholdType;
/** 满减门槛 */
@Column(name = "amount_threshold")
private BigDecimal amountThreshold;
/** 产品范围:1:全部商品;2:指定商品 */
@Column(name = "item_range")
private Integer itemRange;
/** 生效形式:1:固定日期;2:相对日期 */
@Column(name = "effect_type")
private Integer effectType;
/** 生效时间 */
@Column(name = "start_time")
private Timestamp startTime;
/** 过期时间 */
@Column(name = "expire_time")
private LocalDateTime expireTime;
/** 自领取当日,几天内有效 */
@Column(name = "valid_days")
private Integer validDays;
/** 使用说明 */
@Column(name = "description")
private String description;
/** 状态0:未开始,1:启用;2:停用 */
@Column(name = "status")
private Integer status;
/** 创建时间 */
@CreatedDate
@Column(name = "create_time")
private Timestamp createTime;
/** 更新时间 */
@LastModifiedDate
@Column(name = "update_time")
private Timestamp updateTime;
public void copy(Coupon source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}