user.java

来自「此项目以JSP、servlet、JavaBean实现MVC三层架构.」· Java 代码 · 共 119 行

JAVA
119
字号
package bean;

public class User {
	
	//定义两个常量,表示用户类型
	private final int COMMON_USER = 1;//普通用户
	private final int ADMIN_USER = 2;//管理员
	
	private int userID;
	private String userName;
	private String userTrueName;
	private String address;
	private String telephone;
	private String postalCode;
	private int userRole;
	private String password;
	
	public User(){
		this.userID = 0;
		this.userName = "";
		this.userTrueName = "";
		this.address = "";
		this.telephone = "";
		this.postalCode = "";
		this.userRole = 1;
		this.password = "";
	}	
	
	public User(String username,String password){
		this.userID = 0;
		this.userName = username;
		this.userTrueName = "";
		this.address = "";
		this.telephone = "";
		this.postalCode = "";
		this.userRole = 1;
		this.password = password;
	}	
	
	public User(String userName,String password,String userTrueName,String address,
			String telephone,String postalCode ){		
		
		this.userName = userName;
		this.password = password;
		this.userTrueName = userTrueName;
		this.address = address;
		this.telephone = telephone;
		this.postalCode = postalCode;		
	}
	
	public int getUserID(){
		return userID;
	}

	public String getUserName(){
		return userName;
	}
	
	public String getUserTrueName(){
		return userTrueName;
	}
	
	public String getAddress(){
		return address;
	}
	
	public String getTelephone(){
		return telephone;
	}
	
	public String getPostalCode(){
		return postalCode;
	}
	
	public int getUserRole(){
		return userRole;
	}
	
	public String getPassword(){
		return password;
	}
	
	
	public void setUserID(int userID){
		this.userID = userID;
	}
	
	public void setUserName(String userName){
		this.userName = userName;
	}
	
	public void setUserTrueName(String userTrueName){
		this.userTrueName = userTrueName;
	}
	
	public void setAddress(String address){
		this.address = address;
	}
	
	public void setTelephone(String telephone){
		this.telephone = telephone;
	}
	
	public void setPostalCode(String postalCode){
		this.postalCode = postalCode;
	}
	
	public void setUserRole(int userRole){
		if(userRole == ADMIN_USER)
			this.userRole = ADMIN_USER;
		else
			this.userRole = COMMON_USER;
	}
	
	public void setPassword(String password){
		this.password = password;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?