├── .DS_Store
├── README.md
├── lib
└── mysql-connector-java-5.1.7-bin.jar
└── src
└── student
├── SQL.java
├── land.java
└── system.java
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JavaGraduationProject/StudentDormitoryManagementSystem3/8ea9d98cc4de45a228993f36de9955f57986ebb4/.DS_Store
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 全目录
2 |
3 | [更多系统、论文,供君选择 ~~>](https://www.yuque.com/wisebit/blog)
4 |
5 | # 318.StudentDormitoryManagementSystem3
6 |
7 |
群: 983063232(入群获取sql文件)
8 | QQ: 206157502(入群获取sql文件)
9 |
10 | 318.学生宿舍管理系统
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | # 简介
19 |
20 | > 本代码来源于网络,仅供学习参考使用,请入群(983063232)后联系群主索要sql文件!
21 | >
22 | > 提供1.远程部署/2.修改代码/3.设计文档指导/4.框架代码讲解等服务
23 | >
24 | > 管理员: admin 密码: 123456
25 |
26 |
27 | # 环境
28 |
29 | - IntelliJ IDEA 2021.3
30 |
31 | - Mysql 5.7.26
32 |
33 | - Tomcat 7.0.73
34 |
35 | - JDK 1.8
36 |
37 |
38 |
39 |
40 | ## 缩略图
41 |
42 | 
43 | 
44 | 
45 | 
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/lib/mysql-connector-java-5.1.7-bin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JavaGraduationProject/StudentDormitoryManagementSystem3/8ea9d98cc4de45a228993f36de9955f57986ebb4/lib/mysql-connector-java-5.1.7-bin.jar
--------------------------------------------------------------------------------
/src/student/SQL.java:
--------------------------------------------------------------------------------
1 | //sql代码
2 | package student;
3 |
4 | import java.sql.Connection;
5 | import java.sql.DriverManager;
6 | import java.sql.ResultSet;
7 | import java.sql.SQLException;
8 | import java.sql.Statement;
9 | import java.util.Vector;
10 |
11 | public class SQL {
12 | public Connection conn;
13 | //Connection接口是构造类的基础,其他接口出现需要它
14 | public Statement st;
15 | //Statement是执行数据库操作的接口,其对象也就是st用于执行简单的sql语句
16 | public ResultSet rs;
17 | //ResultSet结果集接口
18 |
19 | //获取链接
20 | public Connection getConn() throws SQLException, ClassNotFoundException {
21 | String driverClassName = "com.mysql.jdbc.Driver";
22 | String url = "jdbc:mysql://127.0.0.1:3306/graduation_318_student?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false";
23 | //数据库默认端口号,一般为3306(我的可能特殊,可以改成3306)学生是数据库名字
24 | String user = "root"; //登录用的用户名,下面是密码,可以自己改。
25 | String password = "123456";
26 | try {
27 | Class.forName(driverClassName);
28 | conn = DriverManager.getConnection(url, user, password);
29 | System.out.println("数据库连接成功");
30 | } catch (SQLException ex1) {
31 | System.out.println("数据库连接失败");
32 | }
33 | return conn;
34 | }
35 |
36 | //关闭链接
37 | //几个接口就捕捉异常几次,(用其对象)
38 | public void Close() {
39 | try {
40 | rs.close();
41 | } catch (SQLException e) {
42 | e.printStackTrace();
43 | }
44 | try {
45 | st.close();
46 | } catch (SQLException e1) {
47 | e1.printStackTrace();
48 | }
49 | try {
50 | conn.close();
51 | } catch (SQLException e) {
52 | e.printStackTrace();
53 | }
54 | }
55 |
56 | //登录
57 | public int landing(String name1, String password1) {
58 | int num = 0;
59 | String sql = "select *from user";
60 | try {
61 | getConn();
62 | st = conn.createStatement();
63 | rs = st.executeQuery(sql);//Statement接口对象rs执行上面的查询用户表sql操作
64 | while (rs.next()) {
65 | String name = rs.getString(1).trim();//得到用户名
66 | //trim函数清除单元格中的空格
67 | String password = rs.getString(2).trim();//得到密码
68 | if (name.equals(name1) && password.equals(password1)) {
69 | num = 1;//a
70 | }
71 |
72 | }
73 | } catch (SQLException e) {
74 | // TODO: handle exception
75 | } catch (ClassNotFoundException e) {
76 | // TODO Auto-generated catch block
77 | e.printStackTrace();
78 | //查询异常 固定的
79 | }
80 | Close();//关闭
81 | return num;//注意初始是0,如果用户名和密码符合就变成了1在上面a处,后面同理
82 | }
83 |
84 | //查询
85 | public Vector> query(String tableName, int column) {
86 | int num = 0;
87 | String sql = "select * from " + tableName;
88 | Vector> data = new Vector>();//利用vector创建存数据对象
89 | try {
90 | getConn();
91 | st = conn.createStatement();
92 | rs = st.executeQuery(sql);
93 | while (rs.next()) {
94 | Vector