⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 users.java

📁 JSP常用模块源代码之用户管理模块的全部源代码
💻 JAVA
字号:
package entity;

import java.util.*;

import service.DBManager;

/**
 * @author myte
 *
 * 实体类:用户
 */
public class Users {
	private Integer intUID;//用户编号
	private String strUserName="";//用户名
	private String strPassword="";//用户密码
	private String setRoles="";//用户角色集
	private Integer intUGID; //用户组编号
	private static class UsersDB extends DBManager {

		private String tableName="Users";//表名
		private UsersDB() {
		}

		protected String getTableName() {
			return tableName;
		}

		protected String[] getFields() {//该表中的所有字段
			return new String[] { "intUID", "strUserName",
					"strPassword", "setRoles", "intUGID"};
		}

		protected Object[] getFieldValues(Object o) {//该表中各个字段对应的取值方法
			Users u = (Users) o;
			return new Object[] {u.getIntUID(),u.getStrUserName(),u.getStrPassword()
					,u.getSetRoles(),u.getIntUGID()};
		}

		protected String getKeyFields() {
			return KEY_FIELD_NAME;
		}

		protected Object[] getKeyValues(Object o) {
			return new Object[] { ((Users) o).getIntUID() };
		}
	}
	private static final String KEY_FIELD_NAME = "intUID";//该表的主键
	private static UsersDB entityDB = new UsersDB();
	public void insert(){//添加方法
		try {
			entityDB.insert(this);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public void update(){//更新方法
		try {
			entityDB.update(this);			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public void delete(){//删除方法
		try {
			entityDB.delete(this);			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public List select(String sql){ //查询方法
		try {
			return entityDB.executeSelect(sql);			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return new ArrayList();
	}
	/**
	 * @return Returns the intUGID.
	 */
	public Integer getIntUGID() {
		return intUGID;
	}
	/**
	 * @param intUGID The intUGID to set.
	 */
	public void setIntUGID(Integer intUGID) {
		this.intUGID = intUGID;
	}
	/**
	 * @return Returns the intUID.
	 */
	public Integer getIntUID() {
		return intUID;
	}
	/**
	 * @param intUID The intUID to set.
	 */
	public void setIntUID(Integer intUID) {
		this.intUID = intUID;
	}
	/**
	 * @return Returns the setRoles.
	 */
	public String getSetRoles() {
		return setRoles;
	}
	/**
	 * @param setRoles The setRoles to set.
	 */
	public void setSetRoles(String setRoles) {
		this.setRoles = setRoles;
	}
	/**
	 * @return Returns the strPassword.
	 */
	public String getStrPassword() {
		return strPassword;
	}
	/**
	 * @param strPassword The strPassword to set.
	 */
	public void setStrPassword(String strPassword) {
		this.strPassword = strPassword;
	}
	/**
	 * @return Returns the strUserName.
	 */
	public String getStrUserName() {
		return strUserName;
	}
	/**
	 * @param strUserName The strUserName to set.
	 */
	public void setStrUserName(String strUserName) {
		this.strUserName = strUserName;
	}
}

⌨️ 快捷键说明

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