学生基本信息管理系统团队博客
项目git地址
https://git.oschina.net/Java_goddess/kechengsheji
项目git提交记录截图
项目功能架构图与主要功能流程图
项目功能构架图:
主要功能流程图:
项目运行截图
项目关键代码
连接数据库的类代码:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DBUtil {
private static final String URL = "jdbc:mysql://localhost:3306/student";
private static final String NAME = "root";
private static final String PASSWORD = "123456";
public static void exec(String str) throws ClassNotFoundException, SQLException {
// 1.加载驱动程序
Class.forName("com.mysql.jdbc.Driver");
// 2.获得数据库的连接
Connection conn = DriverManager.getConnection(URL, NAME, PASSWORD);
// 3.通过数据库的连接操作数据库,实现增删改查
Statement stmt = conn.createStatement();
stmt.execute(str);
stmt.close();
conn.close();
}
static ResultSet query(String sql) throws SQLException, ClassNotFoundException {
Class.forName("com.mysql.jdbc.Driver");
// 1.获得数据库的连接
Connection conn = DriverManager.getConnection(URL, NAME, PASSWORD);
// 2.通过数据库的连接操作数据库,实现增删改查
Statement stmt = conn.createStatement();
try {
return stmt.executeQuery(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
增加方法的函数:
package database;
import database.DBUtil;
import java.sql.*;
public class ADD{
public static void add(String number,String name,String gender,String birthdate,String politics,String address,String telephone,String dormitory){
String str = "insert into students(number,name,gender,birthdate,politics,address,telephone,dormitory)"
+ " values("+"'"+number+"'"+"," + "'"+name+"'"+"," +"'"+ gender+"'"+"," +"'"+ birthdate+"'"+"," +"'"+ politics+"'" +","+"'"+ address+"'"+"," +"'"+telephone+"'"+"," +"'"+ dormitory+"'"+")";
try {
DBUtil.exec(str);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
更改的函数:
public class CHANGE {
public static void change(String number, String name, String gender, String birthdate, String politics,
String address, String telephone, String dormitory) {
String str = "update students set number='" + number + "',gender='" + gender + "'," + "birthdate='" + birthdate
+ "'," + "politics='" + politics + "'," + "address='" + address + "'," + "telephone='" + telephone
+ "'," + "dormitory='" + dormitory + "' " + "where name=" + "'" + name + "';";
try {
System.out.println(str);
DBUtil.exec(str);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
删除的函数:
public class DELETE {
public static String[][] delete(String name){
String str ="delete from students where name="+"'"+name+"'"+";";
String[][] strs = new String[100][8];
try{
DBUtil.exec(str);
}catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return strs;
}
}
搜索的函数:
public class SEARCH {
public static String[][] serach(String name){
String str = "select * from students where name="+"'"+name+"'"+";";
String[][] strs = new String[100][8];
try{
ResultSet resultSet = DBUtil.query(str);
int cnt = 0;
while (resultSet.next()) {
for (int i = 0; i < 8; i++) {
strs[cnt][i] = resultSet.getString(i + 1);
}
cnt++;
}
}catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return strs;
}
}
尚待改进或者新的想法
尚待改进的:
①由于时间太少,所以界面做的很粗糙and 丑。
②可以在新增加一个注册管理员的功能,注册管理员然后用注册的账号登陆信息管理系统。
③在更改数据库信息的时候可以只更新部分信息,不更新全部的信息,然而在设计的系统里面只能更改全部的信息。
④最后打包成jar包可以在包装成exe。
团队成员任务分配,团队成员课程设计博客链接(以表格形式呈现),标明组长
成员 | 任务分配 | 博客链接 |
---|---|---|
黄腾龙(组长) | 串联整合各模块代码,将其整理为一个可顺利运行的项目 | http://www.cnblogs.com/Java-goddess/p/7067826.html |
梁林 | 负责部分界面设计并且构造数据库的删除函数 | http://www.cnblogs.com/ll321/p/7067170.html |
李心宇 | 部分显示界面设计和add函数的构造 | http://www.cnblogs.com/llxyy/p/7065134.html |