提交 7ad9c737 authored 作者: Whispa's avatar Whispa

commit

上级 bacf739a
package com.example.afrishop_v3.models; package com.example.afrishop_v3.models;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -7,6 +9,7 @@ import javax.persistence.Id; ...@@ -7,6 +9,7 @@ import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
...@@ -29,6 +32,7 @@ public class TbCfToicoupon { ...@@ -29,6 +32,7 @@ public class TbCfToicoupon {
* 优惠券id * 优惠券id
*/ */
@ManyToOne() @ManyToOne()
@JsonIgnore
@JoinColumn(columnDefinition = "coupon_id") @JoinColumn(columnDefinition = "coupon_id")
private TbCfCoupon coupon; private TbCfCoupon coupon;
/** /**
...@@ -59,6 +63,31 @@ public class TbCfToicoupon { ...@@ -59,6 +63,31 @@ public class TbCfToicoupon {
this.toitableId = toitableId; this.toitableId = toitableId;
} }
@JsonProperty
public String couponTitle(){
return coupon == null ? "" : coupon.getCouponTitle();
}
@JsonProperty
public BigDecimal withAmount(){
return coupon == null ? BigDecimal.ZERO : coupon.getWithAmount();
}
@JsonProperty
public BigDecimal deductAmount(){
return coupon == null ? BigDecimal.ZERO : coupon.getDeductAmount();
}
@JsonProperty
public Date validStartTime(){
return coupon == null ? null : coupon.getValidStartTime();
}
@JsonProperty
public Date validEndTime(){
return coupon == null ? null : coupon.getValidEndTime();
}
/** /**
* 获取:发放/领取表id * 获取:发放/领取表id
*/ */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论