package com.dao;
import com.db.DBHelper;
import com.bean.StudentBean;
import java.util.*;
import java.sql.*;
public class StudentDao {
//验证登录
public String CheckLogin(String username, String password){
String id = null;
String sql="select * from Student where Student_Username='"+username+"' and Student_Password='"+password+"' and Student_State='入住'";
Statement stat = null;
ResultSet rs = null;
Connection conn = new DBHelper().getConn();
try{
stat = conn.createStatement();
rs = stat.executeQuery(sql);
while (rs.next()) {
id = rs.getString("Student_ID");
}
}
catch(SQLException ex){}
return id;
}
//验证密码
public boolean CheckPassword(String id, String password){
boolean ps = false;
String sql="select * from Student where Student_ID='"+id+"' and Student_Password='"+password+"'";
Statement stat = null;
ResultSet rs = null;
Connection conn = new DBHelper().getConn();
try{
stat = conn.createStatement();
rs = stat.executeQuery(sql);
while (rs.next()) {
ps=true;
}
}
catch(SQLException ex){}
return ps;
}
//获取所有列表
public List<StudentBean> GetAllList(String strwhere,String strorder){
String sql="select * from Student";
if(!(isInvalid(strwhere)))
{
sql+=" where "+strwhere;
}
if(!(isInvalid(strorder)))
{
sql+=" order by "+strorder;
}
// System.out.println(sql);
Statement stat = null;
ResultSet rs = null;
Connection conn = new DBHelper().getConn();
List<StudentBean> list=new ArrayList<StudentBean>();
try{
stat = conn.createStatement();
rs = stat.executeQuery(sql);
while(rs.next()){
StudentBean cnbean=new StudentBean();
cnbean.setStudent_ID(rs.getInt("Student_ID"));
cnbean.setStudent_DomitoryID(rs.getInt("Student_DomitoryID"));
cnbean.setStudent_Username(rs.getString("Student_Username"));
cnbean.setStudent_Password(rs.getString("Student_Password"));
cnbean.setStudent_Name(rs.getString("Student_Name"));
cnbean.setStudent_Sex(rs.getString("Student_Sex"));
cnbean.setStudent_Class(rs.getString("Student_Class"));
cnbean.setStudent_State(rs.getString("Student_State"));
list.add(cnbean);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (conn != null)
conn.close();
if (stat != null)
stat.close();
if (rs != null)
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return list;
}
//获取列表
public List<StudentBean> GetList(String strwhere,String strorder){
String sql="select * from Student,Domitory,Building where Student_DomitoryID=Domitory_ID and Domitory_BuildingID=Building_ID";
if(!(isInvalid(strwhere)))
{
sql+=" and "+strwhere;
}
if(!(isInvalid(strorder)))
{
sql+=" order by "+strorder;
}
// System.out.println(sql);
Statement stat = null;
ResultSet rs = null;
Connection conn = new DBHelper().getConn();
List<StudentBean> list=new ArrayList<StudentBean>();
try{
stat = conn.createStatement();
rs = stat.executeQuery(sql);
while(rs.next()){
StudentBean cnbean=new StudentBean();
cnbean.setStudent_ID(rs.getInt("Student_ID"));
cnbean.setStudent_DomitoryID(rs.getInt("Student_DomitoryID"));
cnbean.setStudent_Username(rs.getString("Student_Username"));
cnbean.setStudent_Password(rs.getString("Student_Password"));
cnbean.setStudent_Name(rs.getString("Student_Name"));
cnbean.setStudent_Sex(rs.getString("Student_Sex"));
cnbean.setStudent_Class(rs.getString("Student_Class"));
cnbean.setStudent_State(rs.getString("Student_State"));
cnbean.setDomitory_Name(rs.getString("Domitory_Name"));
cnbean.setBuilding_Name(rs.getString("Building_Name"));
cnbean.setDomitory_Type(rs.getString("Domitory_Type"));
cnbean.setDomitory_Number(rs.getString("Domitory_Number"));
cnbean.setDomitory_Tel(rs.getString("Domitory_Tel"));
list.add(cnbean);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (conn != null)
conn.close();
if (stat != null)
stat.close();
if (rs != null)
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return list;
}
//获取指定ID的实体Bean
public StudentBean GetAllFirstBean(String strwhere){
String sql="select * from Student where "+strwhere;
Statement stat = null;
ResultSet rs = null;
Connection conn = new DBHelper().getConn();
StudentBean cnbean=new StudentBean();
try{
stat = conn.createStatement();
rs = stat.executeQuery(sql);
if(rs.next()){
cnbean.setStudent_ID(rs.getInt("Student_ID"));
cnbean.setStudent_DomitoryID(rs.getInt("Student_DomitoryID"));
cnbean.setStudent_Username(rs.getString("Student_Username"));
cnbean.setStudent_Password(rs.getString("Student_Password"));
cnbean.setStudent_Name(rs.getString("Student_Name"));
cnbean.setStudent_Sex(rs.getString("Student_Sex"));
cnbean.setStudent_Class(rs.getString("Student_Class"));
cnbean.setStudent_State(rs.getString("Student_State"));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (conn != null)
conn.close();
if (stat != null)
stat.close();
if (rs != null)
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return cnbean;
}
//获取指定ID的实体Bean
public StudentBean GetFirstBean(String strwhere){
String sql="select * from Student,Domitory,Building where Student_DomitoryID=Domitory_ID and Domitory_BuildingID=Building_ID and "+strwhere;
Statement stat = null;
ResultSet rs = null;
Connection conn = new DBHelper().getConn();
StudentBean cnbean=new StudentBean();
try{
stat = conn.createStatement();
rs = stat.executeQuery(sql);
if(rs.next()){
cnbean.setStudent_ID(rs.getInt("Student_ID"));
cnbean.setStudent_DomitoryID(rs.getInt("Student_DomitoryID"));
cnbean.setStudent_Username(rs.getString("Student_Username"));
cnbean.setStudent_Password(rs.getString("Student_Password"));
cnbean.setStudent_Name(rs.getString("Student_Name"));
cnbean.setStudent_Sex(rs.getString("Student_Sex"));
cnbean.setStudent_Class(rs.getString("Student_Class"));
cnbean.setStudent_State(rs.getString("Student_State"));
cnbean.setDomitory_Name(rs.getString("Domitory_Name"));
cnbean.setBuilding_Name(rs.getString("Building_Name"));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (conn != null)
conn.close();
if (stat != null)
stat.close();
if (rs != null)
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return cnbean;
}
//获取指定ID的实体Bean
public StudentBean GetAllBean(int id){
String sql="select * from Student where Student_ID="+id;
Statement stat = null;
ResultSet rs = null;
Connection conn = new DBHelper().getConn();
StudentBean cnbean=new StudentBean();
try{
stat = conn.createStatement();
rs = stat.executeQuery(sql);
while(rs.next()){
cnbean.setStudent_ID(rs.getInt("Student_ID"));
cnbean.setStudent_DomitoryID(rs.getInt("Student_DomitoryID"));
cnbean.setStudent_Username(rs.getString("Student_Username"));
cnbean.setStudent_Password(rs.getString("Student_Password"));
cnbean.setStudent_Name(rs.getString("Student_Name"));
cnbean.setStudent_Sex(rs.getString("Student_Sex"));
cnbean.setStudent_Class(rs.getString("Student_Class"));
cnbean.setStudent_State(rs.getString("Student_State"));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (conn != null)
conn.close();
if (stat != null)
stat.close();
if (rs != null)
rs.close();
} catch (SQLException e) {
e.printStackTrace();
没有合适的资源?快使用搜索试试~ 我知道了~
javaweb项目校园宿舍管理系统源码.zip
共199个文件
java:60个
class:60个
jsp:31个
0 下载量 17 浏览量
2024-06-11
13:30:25
上传
评论
收藏 4.63MB ZIP 举报
温馨提示
javaweb项目校园宿舍管理系统源码.zip javaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zipjavaweb项目校园宿舍管理系统源码.zip
资源推荐
资源详情
资源评论
收起资源包目录
javaweb项目校园宿舍管理系统源码.zip (199个子文件)
StudentDao.class 13KB
LogDao.class 8KB
TeacherDao.class 8KB
AdminDao.class 8KB
DomitoryDao.class 7KB
OutDao.class 7KB
TBDao.class 7KB
BuildingDao.class 6KB
StudentTH.class 5KB
DomitoryUpdateSave.class 4KB
StudentUpdateSave.class 4KB
TeacherUpdateSave.class 4KB
MyStudentList.class 4KB
MyLogList.class 4KB
DomitoryAddSave.class 4KB
StudentRZSave.class 4KB
StudentAddSave.class 4KB
PasswordUpdateSave.class 4KB
DomitoryManager.class 4KB
TeacherAddSave.class 4KB
StudentRZ.class 4KB
AdminLog.class 4KB
BuildingUpdateSave.class 4KB
StudentQCSave.class 4KB
AdminLogList.class 4KB
StudentManager.class 4KB
TBAddSave.class 3KB
LogBean.class 3KB
BuildingAddSave.class 3KB
TBManager.class 3KB
TeacherManager.class 3KB
StudentBean.class 3KB
StudentQC.class 3KB
DomitoryUpdate.class 3KB
BuildingManager.class 3KB
LogAddSave.class 3KB
StudentTHSave.class 3KB
StudentLog.class 3KB
MyStudent.class 3KB
MyLog.class 3KB
TBDel.class 3KB
BuildingUpdate.class 3KB
StudentUpdate.class 3KB
TeacherUpdate.class 3KB
LogAdd.class 3KB
DomitoryAdd.class 3KB
OutList.class 2KB
GoLogin.class 2KB
DomitoryDel.class 2KB
BuildingDel.class 2KB
StudentDel.class 2KB
TeacherDel.class 2KB
TBBean.class 2KB
OutBean.class 2KB
DomitoryBean.class 2KB
TeacherBean.class 2KB
AdminBean.class 2KB
DBHelper.class 1KB
BuildingBean.class 1KB
Quit.class 1KB
.classpath 836B
org.eclipse.wst.common.component 445B
org.eclipse.wst.jsdt.ui.superType.container 49B
datepicker.css 4KB
datepicker.css 4KB
Style.css 923B
WdatePicker.css 158B
ic.gif 13KB
img.gif 2KB
img.gif 2KB
datePicker.gif 1KB
My97DatePicker.htm 1KB
freemarker-2.3.19.jar 909KB
struts2-core-2.3.8.jar 775KB
jackson-mapper-asl-1.9.2.jar 748KB
xwork-core-2.3.8.jar 604KB
javassist-3.11.0.GA.jar 600KB
mysql-connector-java-3.1.12-bin.jar 436KB
commons-lang3-3.1.jar 308KB
ognl-3.0.6.jar 223KB
commons-io-2.0.1.jar 156KB
commons-logging-1.1.1.jar 59KB
commons-fileupload-1.2.2.jar 58KB
StudentDao.java 12KB
LogDao.java 6KB
TeacherDao.java 6KB
AdminDao.java 6KB
DomitoryDao.java 5KB
OutDao.java 4KB
TBDao.java 4KB
BuildingDao.java 4KB
PasswordUpdateSave.java 4KB
DomitoryUpdateSave.java 3KB
StudentUpdateSave.java 3KB
TeacherUpdateSave.java 3KB
StudentTH.java 3KB
DomitoryAddSave.java 3KB
StudentAddSave.java 3KB
TeacherAddSave.java 3KB
StudentRZSave.java 3KB
共 199 条
- 1
- 2
资源评论
盈梓的博客
- 粉丝: 9237
- 资源: 2197
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功