/*CopyRright (c)2014: <www.usoftchina.com>
 */
package com.uas.platform.b2b.model;

import java.io.Serializable;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 企业简洁信息，只含UU号和企业名称
 * 
 * @author suntg
 * @date 2015年9月25日14:28:58
 */
@Entity
@Table(name = "sec$enterprises")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region = "com.uas.platform.b2b.model.EnterpriseInfo")
public class EnterpriseInfo implements Serializable {

	/**
	 * 序列号
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "en_uu")
	private Long uu;
	
	/**
	 * 公司名称
	 */
	@NotNull
	@Column(name = "en_name")
	private String enName;
	
	/**
	 * 公司电话
	 */
	@Column(name = "en_tel")
	private String enTel;
	
	/**
	 * 注册地址
	 */
	@Column(name = "en_address")
	private String enAddress;

	/**
	 * 营业执照号
	 */
	@Column(name = "en_businesscode")
	private  String businesscode;

	public Long getUu() {
		return uu;
	}

	public void setUu(Long uu) {
		this.uu = uu;
	}

	public String getEnName() {
		return enName;
	}

	public void setEnName(String enName) {
		this.enName = enName;
	}

	public String getEnTel() {
		return enTel;
	}

	public void setEnTel(String enTel) {
		this.enTel = enTel;
	}

	public String getEnAddress() {
		return enAddress;
	}

	public void setEnAddress(String enAddress) {
		this.enAddress = enAddress;
	}

	public String getBusinesscode() {
		return businesscode;
	}

	public void setBusinesscode(String businesscode) {
		this.businesscode = businesscode;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((uu == null) ? 0 : uu.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
            return true;
        }
		if (obj == null) {
            return false;
        }
		if (getClass() != obj.getClass()) {
            return false;
        }
		EnterpriseInfo other = (EnterpriseInfo) obj;
		if (uu == null) {
			if (other.uu != null) {
                return false;
            }
		} else if (!uu.equals(other.uu)) {
            return false;
        }
		return true;
	}
	
	public EnterpriseInfo(Enterprise enterprise) {
		this.uu = enterprise.getUu();
		this.enTel = enterprise.getEnTel();
		this.enName = enterprise.getEnName();
		this.enAddress = enterprise.getEnAddress();
		this.businesscode = enterprise.getEnBussinessCode();
	}
	
	public EnterpriseInfo() {}
}
