package cn.com.capcloud.core.system.user;

import com.fasterxml.jackson.annotation.JsonBackReference;
import cn.com.capcloud.core.system.role.Role;

import javax.persistence.*;
import java.util.List;

/**
 * 用户实体类
 * @author zgsheng
 *
 */
@Entity
@Table(name="tbl_system_user")
public class User {
	@Id
	@GeneratedValue
	private long id; //id,主键

	/**用户姓名*/
	private String userName;
	/**用户登陆名*/
	private String userLoginName;
	/**用户密码*/
	private String userPassword;
	
	/**用户当前状态,0为正常,1为禁用*/
	private String userStatus;
	private String status;//用户当前状态,0为正常,1为删除
	/**创建时间*/
	private String userCreateTime;
	/**用户生日*/
	private String userBirthday;
	/**手机号*/
	private String userMobile;
	/**Email*/
	private String userMail;
	/**用户qq**/
	private String userQq;//没用
	/**家庭地址**/
	private String userFamily;  
	/**身份证号码**/
	private String userIdCard;//没用
	/**用户类型,分为个人用户和企业用户**/
	private long userType;
	private String userRoleCode;
	
	private String userRoleName;
	
	private String createUserName;
	
	private long createUserId;
	
	private String userPic;
	
	private String soldTo;
	
	private String userArea;

	
	private long companyId;
	private long orgId;
	private String orgName;
	private String orgCode;
	private String isConfirm;
	private String isSourceLimit;
	private String sourceIp;
	private String redirectUrl;
	private String parentId;
	private String isMultiDeviceLogin;

	public String getOrgName() {
		return orgName;
	}
	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}

	private long loginCount;
	
	public long getLoginCount() {
		return loginCount;
	}
	public void setLoginCount(long loginCount) {
		this.loginCount = loginCount;
	}
	
	public long getCompanyId() {
		return companyId;
	}
	public void setCompanyId(long companyId) {
		this.companyId = companyId;
	}
	public long getOrgId() {
		return orgId;
	}
	public void setOrgId(long orgId) {
		this.orgId = orgId;
	}
	public String getUserArea() {
		return userArea;
	}
	public void setUserArea(String userArea) {
		this.userArea = userArea;
	}
	public String getSoldTo() {
		return soldTo;
	}
	public void setSoldTo(String soldTo) {
		this.soldTo = soldTo;
	}
	public String getUserPic() {
		return userPic;
	}
	public void setUserPic(String userPic) {
		this.userPic = userPic;
	}

	@Transient
	private List<Role> viewRoleList;
	
	
	public List<Role> getViewRoleList() {
		return viewRoleList;
	}
	public void setViewRoleList(List<Role> viewRoleList) {
		this.viewRoleList = viewRoleList;
	}
	public String getCreateUserName() {
		return createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	public long getCreateUserId() {
		return createUserId;
	}
	public void setCreateUserId(long createUserId) {
		this.createUserId = createUserId;
	}
	public String getUserRoleCode() {
		return userRoleCode;
	}
	public void setUserRoleCode(String userRoleCode) {
		this.userRoleCode = userRoleCode;
	}
	public String getUserRoleName() {
		return userRoleName;
	}
	public void setUserRoleName(String userRoleName) {
		this.userRoleName = userRoleName;
	}
	public long getUserType() {
		return userType;
	}
	public void setUserType(long userType) {
		this.userType = userType;
	}
	public String getUserQq() {
		return userQq;
	}
	public void setUserQq(String userQq) {
		this.userQq = userQq;
	}
	public String getUserFamily() {
		return userFamily;
	}
	public void setUserFamily(String userFamily) {
		this.userFamily = userFamily;
	}
	public String getUserIdCard() {
		return userIdCard;
	}
	public void setUserIdCard(String userIdCard) {
		this.userIdCard = userIdCard;
	}
	public String getUserMail() {
		return userMail;
	}
	public void setUserMail(String userMail) {
		this.userMail = userMail;
	}
	
	@ManyToMany(mappedBy = "users", fetch = FetchType.LAZY)
	private List<Role> roles;
	@JsonBackReference
	public List<Role> getRoles() {
		return roles;
	}
	@JsonBackReference
	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}
	
	public String getUserMobile() {
		return userMobile;
	}
	public void setUserMobile(String userMobile) {
		this.userMobile = userMobile;
	}
	public String getUserStatus() {
		return userStatus;
	}
	public void setUserStatus(String userStatus) {
		this.userStatus = userStatus;
	}
	public String getUserCreateTime() {
		return userCreateTime;
	}
	public void setUserCreateTime(String userCreateTime) {
		this.userCreateTime = userCreateTime;
	}

	public long getId() {
		return id;
	}

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

	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserLoginName() {
		return userLoginName;
	}
	public void setUserLoginName(String userLoginName) {
		this.userLoginName = userLoginName;
	}
	public String getUserPassword() {
		return userPassword;
	}
	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}
	public String getUserBirthday() {
		return userBirthday;
	}
	public void setUserBirthday(String userBirthday) {
		this.userBirthday = userBirthday;
	}

	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}

	public String getIsConfirm() {
		return isConfirm;
	}

	public void setIsConfirm(String isConfirm) {
		this.isConfirm = isConfirm;
	}

	public String getIsSourceLimit() {
		return isSourceLimit;
	}

	public void setIsSourceLimit(String isSourceLimit) {
		this.isSourceLimit = isSourceLimit;
	}

	public String getSourceIp() {
		return sourceIp;
	}

	public void setSourceIp(String sourceIp) {
		sourceIp = sourceIp;
	}

	public String getRedirectUrl() {
		return redirectUrl;
	}

	public void setRedirectUrl(String redirectUrl) {
		this.redirectUrl = redirectUrl;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getIsMultiDeviceLogin() {
		return isMultiDeviceLogin;
	}

	public void setIsMultiDeviceLogin(String isMultiDeviceLogin) {
		this.isMultiDeviceLogin = isMultiDeviceLogin;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", userName=" + userName + ", userLoginName=" + userLoginName + ", userPassword="
				+ userPassword + ", userStatus=" + userStatus + ", userCreateTime=" + userCreateTime + ", userBirthday="
				+ userBirthday + ", userMobile=" + userMobile + ", userMail=" + userMail + ", userQq=" + userQq
				+ ", userFamily=" + userFamily + ", userIdCard=" + userIdCard + ", userType=" + userType
				+ ", userRoleCode=" + userRoleCode + ", userRoleName=" + userRoleName + ", createUserName="
				+ createUserName + ", createUserId=" + createUserId + ", userPic=" + userPic + ", soldTo=" + soldTo
				+ ", userArea=" + userArea + ", companyId=" + companyId + ", orgId=" + orgId + ", orgName=" + orgName
				+ ", orgCode=" + orgCode + ", isConfirm=" + isConfirm + ", loginCount=" + loginCount + ", roles=" + roles + "]";
	}
	
}
