package com.quantgroup.asset.distribution.service.jpa.entity;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;

import lombok.Data;

/**
 * 
 * @author liwenbin
 *
 */
@Table(name = "finance_product_hit_log")
@Entity
@Data
public class FinanceProductHitLog implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
		
	@Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	
	@Column(name = "biz_channel")
	private String bizChannel;
	
	@Column(name = "uuid")
	private String uuid;
	
	@Column(name = "asset_no")
	private String assetNo;
	
	@Column(name = "biz_no")
	private String bizNo;
	
	@Column(name = "old_finance_product")
	private String oldFinanceProduct;
	
	@Column(name = "new_finance_product")
	private String newFinanceProduct;
	
	@Column(name = "old_audit_result")
	private String oldAuditResult;
	
	@Column(name = "new_audit_result")
	private String newAuditResult;
	
	@Column(name = "equals")
	private Boolean equals;
	
	@Column(name = "enable")
	private Boolean enable;
	
	@Column(name = "execute_type")
	private Integer executeType;
	
	@Column(name = "created_at")
	private Timestamp createdAt;
	
	@Column(name = "updated_at")
	private Timestamp updatedAt;
	
	@PrePersist
    public void prePersist() {
        Timestamp timestamp = new Timestamp(System.currentTimeMillis());
        createdAt = timestamp;
        updatedAt = timestamp;
    }

    @PreUpdate
    public void preUpdate() {
        updatedAt = new Timestamp(System.currentTimeMillis());
    }
}
