1、項目截圖
整體截圖:
教務管理子系統:
圖書館管理子系統:
2、主要代碼解析
classdao.java
package cn.com.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import cn.com.entity.Class;
import cn.com.entity.Student;
import cn.com.utils.DBUtils;
public class ClassDao {
Connection conn;
PreparedStatement pst;
ResultSet rs;
public List<Class> classByshow(String sid) {
// TODO Auto-generated method stub
try {
conn = DBUtils.getConn();
String sql = "select * from student s,teacher t,class c where s.cid = c.cid and c.tid = t.tid and s.sid = ?";
pst = conn.prepareStatement(sql);
pst.setString(1, sid);
rs = pst.executeQuery();
List<Class> bylist = new ArrayList();
while(rs.next()){
Class cl = new Class();
cl.setCid(rs.getInt("cid"));
cl.setCname(rs.getString("cname"));
cl.setCqq(rs.getString("cqq"));
cl.setCxc(rs.getString("cxc"));
cl.setTid(rs.getString("Tid"));
cl.setTname(rs.getString("tname"));
cl.setTphone(rs.getString("tphone"));
bylist.add(cl);
System.out.println(bylist+"???");
}
return bylist;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
DBUtils.closeResouce(conn, pst, rs);
}
return null;
}
public List<Class> showClass() {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
try {
conn = DBUtils.getConn();
String sql = "select * from class c,teacher t where t.tid = c.tid";
pst = conn.prepareStatement(sql);
rs = pst.executeQuery();
List<Class> bylist = new ArrayList();
while(rs.next()){
Class cl = new Class();
cl.setCid(rs.getInt("cid"));
cl.setCname(rs.getString("cname"));
cl.setCqq(rs.getString("cqq"));
cl.setCxc(rs.getString("cxc"));
cl.setTid(rs.getString("Tid"));
cl.setTname(rs.getString("tname"));
cl.setTphone(rs.getString("tphone"));
bylist.add(cl);
System.out.println(bylist+"???+++++++++++++++++++++++");
}
return bylist;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
DBUtils.closeResouce(conn, pst, rs);
}
return null;
}
}
class.java
package cn.com.entity;
public class Class {
private int cid;
private String cname;
private String cqq;
private String cxc;
private String tid;
private String tname;
private String tphone;
public String getTphone() {
return tphone;
}
public void setTphone(String tphone) {
this.tphone = tphone;
}
public int getCid() {
return cid;
}
public void setCid(int cid) {
this.cid = cid;
}
public String getCname() {
return cname;
}
public void setCname(String cname) {
this.cname = cname;
}
public String getCqq() {
return cqq;
}
public void setCqq(String cqq) {
this.cqq = cqq;
}
public String getCxc() {
return cxc;
}
public void setCxc(String cxc) {
this.cxc = cxc;
}
public String getTid() {
return tid;
}
public void setTid(String tid) {
this.tid = tid;
}
public String getTname() {
return tname;
}
public void setTname(String tname) {
this.tname = tname;
}
public Class(int cid, String cname, String cqq, String cxc, String tid, String tname) {
super();
this.cid = cid;
this.cname = cname;
this.cqq = cqq;
this.cxc = cxc;
this.tid = tid;
this.tname = tname;
}
public Class() {
super();
// TODO Auto-generated constructor stub
}
@Override
public String toString() {
return "Class [cid=" + cid + ", cname=" + cname + ", cqq=" + cqq + ", cxc=" + cxc + ", tid=" + tid + ", tname="
+ tname + "]";
}
}
classservice.java
package cn.com.services;
import java.util.List;
import cn.com.dao.ClassDao;
import cn.com.entity.Class;
public class ClassService {
ClassDao dao = new ClassDao();
public List<Class> classByshow(String sid) {
// TODO Auto-generated method stub
List<Class> bylist = dao.classByshow(sid);
return bylist;
}
public List<Class> showclass() {
// TODO Auto-generated method stub
List<Class> clist = dao.showClass();
return clist;
}
}
3、項目說明
有兩種登錄方式(圖書館子系統登陸和教務管理子系統登陸)
其中教務管理子系統
學生 賬號20172612350023 姓名:最代碼 密碼:123456
教師 工號:lizhiwei 姓名:李志偉 密碼:123456
圖書館子系統
超級管理員 賬號:liubing 密碼:123456
其中有忘記密碼郵箱驗證修改密碼部分:
需手動填寫,郵件客戶端授權碼獲取方法轉https://jingyan.baidu.com/article/425e69e61e9178be15fc168a.html
運行環境:
jdk1.8+tomcat9.0+mysql5.7+myeclipse
數據庫文件:
鏈接:https://pan.baidu.com/s/106oz0O3cy1swUhFwz55uLg
提取碼:5keg
如需導入項目成功運行需要在本地新建數據庫,然後修改兩個數據連接工具類:
MyUniversity\src\cn\com\utils\DBUtils.java
MyUniversity\src\cn\hp\utils\DButils.java
將其中的主機名,用戶名,密碼三個參數改成你自己的即可。
4、運行截圖
首頁面:
教務系統部分功能演示:
教務子系統管理員部分功能:
教務子系統學生部分功能演示:
如果需要忘記密碼可以選擇郵箱驗證修改:
需要qq郵箱開啓郵件客戶端授權 詳見:https://jingyan.baidu.com/article/425e69e61e9178be15fc168a.html
圖書館子系統功能演示:
鏈接:https://pan.baidu.com/s/1gR7c0RD2RWcRr0VfufNrHA
提取碼:*****