📄 usermodel.java
字号:
package cn.javass.bookmgr.user.valueobject;/** * 用户实体的值对象 * * <p>Title: Java私塾第一个Java项目——图书进销存系统(单机版)</p> * <p>Description: 网址:<a href="http://www.javass.cn">http://www.javass.cn</a> * 新电话:010-86835215 新地址:北京市海淀区厂洼路5号院深博达商务楼5层</p> * <p>Copyright: Copyright (c) 2008</p> * <p>Company: Java私塾</p> * @author Java私塾 * @version 1.0 */public class UserModel implements java.io.Serializable{ private String id,name,pwd; private int type; public final static String TYPE_1 = "admin"; public final static String TYPE_2 = "可操作用户模块"; public final static String TYPE_3 = "可操作图书模块"; public final static String TYPE_4 = "可操作进货模块"; public final static String TYPE_5 = "可操作销售模块"; public final static String TYPE_6 = "可操作库存模块"; public final static int TYPE_INT_1 = 1; public final static int TYPE_INT_2 = 2; public final static int TYPE_INT_3 = 3; public final static int TYPE_INT_4 = 4; public final static int TYPE_INT_5 = 5; public final static int TYPE_INT_6 = 6; /** * 对用户类型的值转换成为对应的int * @param str 需要转换的用户类型的值 * @return 对应的int的值 */ public static int typeStringToInt(String str){ if(str!=null && str.equals(TYPE_1)){ return TYPE_INT_1; }else if(str!=null && str.equals(TYPE_2)){ return TYPE_INT_2; }else if(str!=null && str.equals(TYPE_3)){ return TYPE_INT_3; }else if(str!=null && str.equals(TYPE_4)){ return TYPE_INT_4; }else if(str!=null && str.equals(TYPE_5)){ return TYPE_INT_5; }else if(str!=null && str.equals(TYPE_6)){ return TYPE_INT_6; } return 0; } /** * 对用户类型的int值转换成为对应的String * @param a 需要转换的用户类型的int值 * @return 对应的用户类型的值 */ public static String typeIntToString(int a){ if(a == TYPE_INT_1){ return TYPE_1; }else if(a == TYPE_INT_2){ return TYPE_2; }else if(a == TYPE_INT_3){ return TYPE_3; }else if(a == TYPE_INT_4){ return TYPE_4; }else if(a == TYPE_INT_5){ return TYPE_5; }else if(a == TYPE_INT_6){ return TYPE_6; } return ""; } public UserModel(){ } public UserModel(String str){ String strs[] = str.split(","); this.id = strs[0]; this.name = strs[1]; this.type = Integer.parseInt(strs[2]); this.pwd = strs[3]; } public String getId() { return id; } public String getName() { return name; } public String getPwd() { return pwd; } public int getType() { return type; } public void setType(int type) { this.type = type; } public void setPwd(String pwd) { this.pwd = pwd; } public void setName(String name) { this.name = name; } public void setId(String id) { this.id = id; } public String toMyString(){ return id+","+name+","+type+","+pwd; } public String toString(){ return "id="+id+",name="+name+",type="+type+",pwd="+pwd; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -