package com.ssm.manage.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;

@Table(name = "pay_list")

@JsonIgnoreProperties(ignoreUnknown = true)
public class PayList implements Serializable {
    /**
     * 主键ID
     */
    @Id
    private Long id;

    /**
     * 单据ID
     */
    @Column(name = "doc_id")
    private String docId;

    /**
     * 支付方式ID
     */
    @Column(name = "pay_id")
    private Long payId;

    /**
     * 支付方式名称
     */
    @Column(name = "pay_name")
    private String payName;

    /**
     * 支付金额
     */
    @Column(name = "pay_money")
    private BigDecimal payMoney;
    /**
     * 门店Id
     */
    @Column(name = "store_id")
    private Long storeId;

    @Column(name = "pay_date")
    private Date payDate;

    /**
     * 单据类别
     */
    private String type;

    @Column(name = "is_cancel")
    @Getter
    @Setter
    private Integer isCancel;

    @Transient
    private BigDecimal payMoneyAmount;
//
//    public Date getPayDate() {
//        return payDate;
//    }
//
//    public void setPayDate(Date payDate) {
//        this.payDate = payDate;
//    }
//
//    @Column(name = "pay_date")
////    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
//    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
//    private Date payDate;

    public Long getStoreId() {
        return storeId;
    }

    public void setStoreId(Long storeId) {
        this.storeId = storeId;
    }

    private static final long serialVersionUID = 1L;

    /**
     * 获取主键ID
     *
     * @return id - 主键ID
     */
    public Long getId() {
        return id;
    }

    /**
     * 设置主键ID
     *
     * @param id 主键ID
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * 获取单据ID
     *
     * @return doc_id - 单据ID
     */
    public String getDocId() {
        return docId;
    }

    /**
     * 设置单据ID
     *
     * @param docId 单据ID
     */
    public void setDocId(String docId) {
        this.docId = docId;
    }

    /**
     * 获取支付方式ID
     *
     * @return pay_id - 支付方式ID
     */
    public Long getPayId() {
        return payId;
    }

    /**
     * 设置支付方式ID
     *
     * @param payId 支付方式ID
     */
    public void setPayId(Long payId) {
        this.payId = payId;
    }

    /**
     * 获取支付方式名称
     *
     * @return pay_name - 支付方式名称
     */
    public String getPayName() {
        return payName;
    }

    /**
     * 设置支付方式名称
     *
     * @param payName 支付方式名称
     */
    public void setPayName(String payName) {
        this.payName = payName;
    }

    /**
     * 获取支付金额
     *
     * @return pay_money - 支付金额
     */
    public BigDecimal getPayMoney() {
        return payMoney;
    }

    /**
     * 设置支付金额
     *
     * @param payMoney 支付金额
     */
    public void setPayMoney(BigDecimal payMoney) {
        this.payMoney = payMoney;
    }

    /**
     * 获取单据类别
     *
     * @return type - 单据类别
     */
    public String getType() {
        return type;
    }

    /**
     * 设置单据类别
     *
     * @param type 单据类别
     */
    public void setType(String type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        PayList other = (PayList) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getDocId() == null ? other.getDocId() == null : this.getDocId().equals(other.getDocId()))
            && (this.getPayId() == null ? other.getPayId() == null : this.getPayId().equals(other.getPayId()))
            && (this.getPayName() == null ? other.getPayName() == null : this.getPayName().equals(other.getPayName()))
            && (this.getPayMoney() == null ? other.getPayMoney() == null : this.getPayMoney().equals(other.getPayMoney()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getDocId() == null) ? 0 : getDocId().hashCode());
        result = prime * result + ((getPayId() == null) ? 0 : getPayId().hashCode());
        result = prime * result + ((getPayName() == null) ? 0 : getPayName().hashCode());
        result = prime * result + ((getPayMoney() == null) ? 0 : getPayMoney().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", docId=").append(docId);
        sb.append(", payId=").append(payId);
        sb.append(", payName=").append(payName);
        sb.append(", payMoney=").append(payMoney);
        sb.append(", type=").append(type);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    public Date getPayDate() {
        return payDate;
    }

    public void setPayDate(Date payDate) {
        this.payDate = payDate;
    }
}