OrderCoupon.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package com.futu.course.orders.domain;
  2. import com.baomidou.mybatisplus.annotation.IdType;
  3. import com.baomidou.mybatisplus.annotation.TableField;
  4. import com.baomidou.mybatisplus.annotation.TableId;
  5. import com.baomidou.mybatisplus.annotation.TableName;
  6. import java.io.Serializable;
  7. import java.math.BigDecimal;
  8. import lombok.Data;
  9. /**
  10. * 订单和优惠券关联表
  11. * @TableName order_coupon
  12. */
  13. @TableName(value ="order_coupon")
  14. @Data
  15. public class OrderCoupon implements Serializable {
  16. /**
  17. * 订单id
  18. */
  19. @TableId
  20. private Long orderId;
  21. /**
  22. * 课程id
  23. */
  24. private Long couponId;
  25. /**
  26. * 优惠券
  27. */
  28. private BigDecimal discountAmount;
  29. @TableField(exist = false)
  30. private static final long serialVersionUID = 1L;
  31. @Override
  32. public boolean equals(Object that) {
  33. if (this == that) {
  34. return true;
  35. }
  36. if (that == null) {
  37. return false;
  38. }
  39. if (getClass() != that.getClass()) {
  40. return false;
  41. }
  42. OrderCoupon other = (OrderCoupon) that;
  43. return (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
  44. && (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId()))
  45. && (this.getDiscountAmount() == null ? other.getDiscountAmount() == null : this.getDiscountAmount().equals(other.getDiscountAmount()));
  46. }
  47. @Override
  48. public int hashCode() {
  49. final int prime = 31;
  50. int result = 1;
  51. result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
  52. result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode());
  53. result = prime * result + ((getDiscountAmount() == null) ? 0 : getDiscountAmount().hashCode());
  54. return result;
  55. }
  56. @Override
  57. public String toString() {
  58. StringBuilder sb = new StringBuilder();
  59. sb.append(getClass().getSimpleName());
  60. sb.append(" [");
  61. sb.append("Hash = ").append(hashCode());
  62. sb.append(", orderId=").append(orderId);
  63. sb.append(", couponId=").append(couponId);
  64. sb.append(", discountAmount=").append(discountAmount);
  65. sb.append(", serialVersionUID=").append(serialVersionUID);
  66. sb.append("]");
  67. return sb.toString();
  68. }
  69. }