package bookshop.utils;
import java.sql.ResultSet;
import java.util.Date;
public class Users extends Execute_DB {
//定义成员变量
private int userID; //用户ID
private String usrName; //用户登录名
private String passwd; //用户登录密码
private String createTime; //用户账号创建时间
private String realName; //用户真实姓名
private String telephone; //用户电话
private String email; //用户邮箱
private int sysRole; //用户具有的权限
private String sql; //要执行的sql语句
//初始化成员变量
public Users() {
this.userID = 0;
this.usrName = "";
this.passwd = "";
this.sysRole = 0;
this.realName = "";
this.telephone = "";
this.email = "";
Date nowTime = new Date();
this.createTime = nowTime.toString();
this.sql = "";
}
//向users数据表中插入一条记录
public boolean add_user() {
System.out.println("开始插入--->");
// String sqltest = "select * from users;";
//if (super.exeSql(sqltest)) {
// System.out.println("执行成功!");
// }else System.out.println("插入失败!!!!");
// System.out.println("插入结束!---");
this.sql = "insert into users (userName ,password ,sysRole ,realName ,telephone ,email) values ('" + this.getUsrName() + "',";
this.sql += "'" + this.getPasswd() + "',";
this.sql += this.sysRole + ",";
this.sql += "'" + this.getRealName() + "',";
this.sql += "'" + this.getTelephone() + "',";
this.sql += "'" + this.getEmail() + "'";//,";
// this.sql += "'" + this.getCreateTime() + "'";
this.sql += ")";
// String sqltest = "insert into users (userName,password,sysRole,realName,telephone,email,createTime)"
// + " values ('" + this.getUsrName() + "','" + this.getPasswd() + "'," + this.getSysRole() + ",'" + this.getRealName()
// + "','" + this.getTelephone() + "','" + this.getEmail() + "','" + this.getCreateTime() + "')";
System.out.println("执行的此处了!");
// sql = "insert into users (userName,password,realName) values('zk12fsdfa3','12344abc','ZAJSH')";
// this.sql = sqltest;
boolean isInsertSuccess = super.exeSql(this.sql);
// boolean isInsertSuccess = super.exeSql(this.sql);
System.out.println(isInsertSuccess);
System.out.println("sql执行完毕!");
return isInsertSuccess;
}
//验证用户名,密码和用户身份信息是否正确
public boolean user_valid() {
this.sql = "select userName,password,sysRole from users ";
this.sql += "where userName='" + this.getUsrName() + "'";
this.sql += "and password='" + this.getPasswd() + "'";
this.sql += "and sysRole=" + this.getSysRole();
try {
ResultSet rs = super.exeSqlQuery(this.sql);
if (rs.next()) {
System.out.println(rs.getString(1));
return true;
} else {
System.out.println("验证失败!");
return false;
}
} catch (Exception ex) {
System.out.println(ex.toString());
System.out.println("查询失败!");
return false;
}
}
//判断用户名是否存在
public boolean is_exist() {
this.sql = "select * from users ";
this.sql += "where userName='" + this.getUsrName() + "'";
try {
ResultSet rs = super.exeSqlQuery(this.sql);
if (rs.next()) {
return true;
} else {
return false;
}
} catch (Exception ex) {
System.out.println(ex.toString());
return false;
}
}
//修改成员变量userID对应的用户信息
public boolean modify_info() {
this.sql = "update users set ";
this.sql += "realName='" + this.getRealName() + "',";
this.sql += "telephone='" + this.getTelephone() + "',";
this.sql += "email='" + this.getEmail() + "' where userID=" + this.userID;
boolean isUpdate = super.exeSql(this.sql);
return isUpdate;
}
//修改类成员变量userID对应的用户密码
public boolean modify_password() {
this.sql = "update users set ";
this.sql += "password='" + this.getPasswd() + "'";
this.sql += " where userID=" + this.getUserID();
boolean isUpdate = super.exeSql(this.sql);
return isUpdate;
}
//获取成员变量userID对应的用户信息
public boolean init() {
this.sql = "select * from users where userID=";
this.sql += this.getUserID();
try {
ResultSet rs = super.exeSqlQuery(this.sql);
if (rs.next()) {
this.setUsrName(rs.getString("userName"));
this.setPasswd(rs.getString("password"));
this.setRealName(rs.getString("realName"));
this.setEmail(rs.getString("email"));
this.setCreateTime(rs.getString("createTime"));
this.setSysRole(rs.getInt("sysRole"));
this.setUserID(rs.getInt("userID"));
return true;
} else {
return false;
}
} catch (Exception ex) {
System.out.println(ex.toString());
return false;
}
}
//获取userName对应的用户信息
public boolean init(String userName) {
this.sql = "select * from users where userName like '" + userName + "'";
try {
ResultSet rs = super.exeSqlQuery(this.sql);
if (rs.next()) {
this.userID = rs.getInt("userID");
System.out.println(userID);
this.setUsrName(rs.getString("userName"));
this.setPasswd(rs.getString("password"));
this.setRealName(rs.getString("realName"));
this.setEmail(rs.getString("email"));
this.setCreateTime(rs.getString("createTime"));
int sysRole1 = rs.getInt("sysRole");
this.setSysRole(sysRole1);
// this.setUserID(UserID);
System.out.println(this);
return true;
} else {
return false;
}
} catch (Exception ex) {
System.out.println(ex.toString());
return false;
}
}
//获取所有普通用户信息,返回一个ResultSet类型对象
public ResultSet show_users() {
//this.sql = "select * from users ";
// this.sql += "where sysRole=" + this.getSysRole();
this.sql = "select * from users";
ResultSet rs = null;
try {
rs = super.exeSqlQuery(this.sql);
} catch (Exception ex) {
System.out.println(ex.toString());
}
return rs;
}
/**
* @param usrName the usrName to set
*/
public void setUsrName(String usrName) {
this.usrName = usrName;
}
/**
* @param passwd the passwd to set
*/
public void setPasswd(String passwd) {
this.passwd = passwd;
}
/**
* @param createTime the createTime to set
*/
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
/**
* @param realName the realName to set
*/
public void setRealName(String realName) {
this.realName = realName;
}
/**
* @param telephone the telephone to set
*/
public void setTelephone(String telephone) {
this.telephone = telephone;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the usrNam
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
网上图书管理系统的要求有: 1. 能按各种方式(比如书名、编号、作者、出版社)查询销售系统的存书情况 2. 管理者能够查询订购人的基本资料、订购图书情况以及自身的基本信息。 3. 管理员可以查看所有的图书订单信息以及系统所有注册用户的信息。 4、管理员可以查看,添加,修改和删除图书和图书类别信息。 5、客户可以浏览所有图书信息,并可以执行图书订购操作。 本版本是最终答辩版本,修正了前一版本的一些bug,如图书信息检索和图书类别修改和删除存在问题等等,希望能给大家带来帮助,同时也希望大家能批评指正,谢谢!
资源详情
资源评论
收起资源包目录
网上图书管理系统 网上图书销售系统 (132个子文件)
Books.class 7KB
Users.class 6KB
Sorts.class 4KB
Goods.class 4KB
LoginCheck.class 3KB
Words.class 3KB
UserRegSave.class 3KB
GetUserPassword.class 2KB
EncodingFilter.class 2KB
Open_DB.class 2KB
BaseConn.class 2KB
Execute_DB.class 2KB
PasswordChangeHandle.class 1KB
ConTest.class 461B
sqljdbc.jar 570KB
sqljdbc.jar 570KB
msbase.jar 280KB
mssqlserver.jar 66KB
msutil.jar 63KB
Users.java 10KB
Books.java 8KB
Sorts.java 6KB
Goods.java 5KB
LoginCheck.java 5KB
UserRegSave.java 4KB
GetUserPassword.java 4KB
Words.java 3KB
PasswordChangeHandle.java 3KB
Execute_DB.java 2KB
Open_DB.java 2KB
BaseConn.java 1KB
EncodingFilter.java 1KB
ConTest.java 144B
search_book_result.jsp 9KB
search_book_result.jsp 9KB
goods_management.jsp 6KB
goods_management.jsp 6KB
search_book_form.jsp 5KB
search_book_form.jsp 5KB
my_goods_management.jsp 5KB
my_goods_management.jsp 5KB
modify_book_form.jsp 4KB
modify_book_form.jsp 4KB
user_detail.jsp 4KB
user_detail.jsp 4KB
add_book_form.jsp 4KB
add_book_form.jsp 4KB
book_list.jsp 4KB
book_list.jsp 4KB
user_reg_save.jsp 4KB
user_reg_save.jsp 4KB
book_detail.jsp 3KB
book_detail.jsp 3KB
books_management.jsp 3KB
books_management.jsp 3KB
add_book_save.jsp 3KB
add_book_save.jsp 3KB
sorts_management.jsp 3KB
sorts_management.jsp 3KB
index.jsp 3KB
index.jsp 3KB
user_reg.jsp 3KB
user_reg.jsp 3KB
add_goods_form.jsp 3KB
add_goods_form.jsp 3KB
recommend_book_list.jsp 3KB
recommend_book_list.jsp 3KB
add_sort_save.jsp 2KB
add_sort_save.jsp 2KB
user_login_check.jsp 2KB
user_login_check.jsp 2KB
modify_book_save.jsp 2KB
modify_book_save.jsp 2KB
delete_book.jsp 2KB
delete_book.jsp 2KB
modify_sort_from_sorts.jsp 2KB
modify_sort_from_sorts.jsp 2KB
modify_sort_save.jsp 2KB
modify_sort_save.jsp 2KB
newSearchBookForm.jsp 2KB
newSearchBookForm.jsp 2KB
add_goods_save.jsp 2KB
add_goods_save.jsp 2KB
delete_goods.jsp 2KB
delete_goods.jsp 2KB
recommend_book.jsp 2KB
recommend_book.jsp 2KB
delete_sorts.jsp 2KB
delete_sorts.jsp 2KB
delete_goods.jsp 2KB
delete_goods.jsp 2KB
index.jsp 1KB
index.jsp 1KB
password_change_form.jsp 1KB
password_change_form.jsp 1KB
get_userpassword_form.jsp 1KB
get_userpassword_form.jsp 1KB
top.jsp 1KB
top.jsp 1KB
index.jsp 1KB
共 132 条
- 1
- 2
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论30
最新资源