package com.qmth.qrzk.repository.user.model;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.qmth.qrzk.repository.common.enumeration.PaperType;
import com.qmth.qrzk.repository.common.enumeration.PrintType;

/**
 * 打印日志
 * @author zhengmin
 *
 */
@Entity
@Table(name="qr_print_log")
public class PrintLog {

	@Id
	@GeneratedValue
	private long id;
	
	@Column(name="batch_id")
	private Integer batchId;
	
	@Column(name="user_id")
	private Integer userId;
	
	private String username;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="created_time")
	private Date createdTime;
	
	@Enumerated(EnumType.STRING)
	@Column(name="paper_type")
	private PaperType paperType;
	
	@Transient
	private String paperTypeLabel;
	
	@Enumerated(EnumType.STRING)
	@Column(name="print_type")
	private PrintType printType;

	@Transient
	private String printTypeLabel;
	
	@Column(name="prov_name")
	private String provName;
	
	@Column(name="course_code")
	private String courseCode;
	
	@Column(name="course_name")
	private String courseName;
	
	@Column(name="paper_code")
	private String paperCode;
	
	@Column(name="print_count")
	private int printCount;
	
	private String remark;

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public PrintLog() {
		super();
		this.createdTime = new Date();
	}

	public PrintLog(Integer batchId, Integer userId,String username,
			PaperType paperType, PrintType printType,int printCount,
			String provName, String courseCode, String courseName, String paperCode) {
		super();
		this.batchId = batchId;
		this.userId = userId;
		this.username = username;
		this.paperType = paperType;
		this.printType = printType;
		this.printCount = printCount;
		this.createdTime = new Date();
		this.provName = provName;
		this.courseCode = courseCode;
		this.courseName = courseName;
		this.paperCode = paperCode;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Integer getBatchId() {
		return batchId;
	}

	public void setBatchId(Integer batchId) {
		this.batchId = batchId;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public String getCreatedTimeStr(){
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return formatter.format(createdTime);
	}
	
	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	public PaperType getPaperType() {
		return paperType;
	}

	public void setPaperType(PaperType paperType) {
		this.paperType = paperType;
	}

	public String getPaperTypeLabel() {
		return this.paperType != null?paperType.getValue():null;
	}

	public void setPaperTypeLabel(String paperTypeLabel) {
		this.paperTypeLabel = paperTypeLabel;
	}

	public PrintType getPrintType() {
		return printType;
	}

	public void setPrintType(PrintType printType) {
		this.printType = printType;
	}

	public String getPrintTypeLabel() {
		return printType != null?printType.getValue():null;
	}

	public void setPrintTypeLabel(String printTypeLabel) {
		this.printTypeLabel = printTypeLabel;
	}

	public int getPrintCount() {
		return printCount;
	}

	public void setPrintCount(int printCount) {
		this.printCount = printCount;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getProvName() {
		return provName;
	}

	public void setProvName(String provName) {
		this.provName = provName;
	}

	public String getCourseCode() {
		return courseCode;
	}

	public void setCourseCode(String courseCode) {
		this.courseCode = courseCode;
	}

	public String getCourseName() {
		return courseName;
	}

	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}

	public String getPaperCode() {
		return paperCode;
	}

	public void setPaperCode(String paperCode) {
		this.paperCode = paperCode;
	}
}
