学生宿舍管理系统23页.docx
- 文档编号:6944884
- 上传时间:2023-01-13
- 格式:DOCX
- 页数:16
- 大小:19.82KB
学生宿舍管理系统23页.docx
《学生宿舍管理系统23页.docx》由会员分享,可在线阅读,更多相关《学生宿舍管理系统23页.docx(16页珍藏版)》请在冰豆网上搜索。
学生宿舍管理系统23页
学生宿舍管理系统
专业:
软件技术
组员:
石胜华蒋霞张龙
班级:
1001
1.问题定义
随着中国大学普遍扩招,招收的大学生越来越多,而学生宿舍管理成为高校管理的很重要的一部分。
但目前,很多高校还是采用传统的人工记录的方法,需要记录的数据比较多,而且需要保存的数据也比较多,人工记录、查找信息等都比较麻烦,而且安全性不高.21世纪的今天,信息化占据着社会主流,计算机在各行各业的的应用越来越广泛,自动化信息化的管理被应用到越来越广泛的领域。
学生宿舍管理系统采用的是计算机化管理,系统做的尽量人性化,需要系统操作方便,管理人员需要做的就是将数据输入到系统的数据库中去。
管理员和学生利用该系统可完成如下功能:
1管理员可快速查询学生基本信息
2管理员可方便实现楼资源管理
3管理员可实现宿舍资源管理
4管理员可方便实现查询统计
该系统采用JAVA开发,后台数据库采用SQLServer2005。
二可行性分析
1问题
(1)目前宿舍管理还都采用人工记录的方法。
(2)需要手工记录很多信息,浪费人力财力,且操作麻烦。
(3)查询学生基本住宿信息时,查询效率低下,不能实现快速查询。
2项目目标:
开发一小型学生宿舍管理系统,要操作方便,并能满足学校学生宿舍管理基本需求。
3运行环境
(1)采用JAVA开发。
(2)后台数据库用SQLServer2005。
(3)硬件设备为pc机一台。
4开发风险
浪费人力资源时间资源,改变了原有的手工记录的宿舍管理方式,但对原有的管理制度没有任何影响,基本上不会有什么风险,但开发的项目可能过于简单。
5经济可行性
不需投入太多费用,由学生小组共同开发,利用课余时间开发。
只需投入使用几台pc机,以实现学生宿舍计算机化管理。
6技术可行性
该小组成员全部来自学校计算机系,学习了软件工程方面的课程,使所学知识用于实践.
7社会可行性
由于是学生小组开发,也锻炼了小组成员的实际动手能力,丰富了阅历,积累开发经验,且开发出的系统由学校内部使用,不涉及盈利方面的问题,不会和社会以及法律造成冲突。
8总体分析
改变了原有的人工记录的操作方式,提高了工作的效率,成本低,实现了学生宿舍计算机化管理。
具有可行性。
三系统功能分析
该系统的功能主要是针对学生宿舍管理员,可实现如下功能:
1管理员可以完成对学生学号、姓名、性别、班级、入住时间等学生基本信息的录入、调换寝室,查询学生信息等功能。
3管理员可完成对楼号、宿舍号、床位数、现住人数等宿舍信息的录入、删除、修改等功能。
4管理员可完成宿舍分配、退房处理等宿舍工作管理。
3表
(1)基本信息表(tb_userInfo)
字段名
意义
类型
宽度
NULL
PrimaryKey
Ss_number
寝室号
nchar
10
No
√
Ss_name
姓名
nchar
10
No
Ss_class
班号
nchar
10
No
Ss_sex
性别
nchar
2
Yes
Ss_time
入住时间
nchar
20
No
2寝室(tb_roomInfo)
字段名
意义
类型
宽度
NULL
PaimaryKey
Room_number
寝室号
nchar
10
No
√
Room_people
现住人数
Int
No
程序的基本界面:
详细的JAVA界面代码:
importjava.sql.CallableStatement;
importjava.sql.Connection;
importjava.sql.DriverManager;
importjava.sql.ResultSet;
importjava.sql.SQLException;
publicclassConneClass{
Connectionconn=null;
Stringtemp[]=newString[6];
publicConneClass(){
this.initDataBase();
//建立数据库连接
publicvoidinitDataBase(){
try{
//加载驱动程序jdbc-odbc桥
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//获取数据库连接
conn=DriverManager.getConnection("jdbc.sqlserver:
//localhost:
1433:
databaseName=ssglxt","sa","123");
}catch(ClassNotFoundExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}catch(SQLExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
//根据用户名查询一条记录
publicString[]selectInfo(Stringid){
StringBuffersb=newStringBuffer();
Stringdata[]=newString[4];
intindex=0;
if(conn!
=null){
try{
ResultSetrs=null;
//设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数
CallableStatementproc=conn.prepareCall("{callssgl_proc(?
)}");
//设置输入参数
proc.setString(1,id);
//调入存储过程
proc.execute();
booleanhasResult=true;
while(hasResult){
rs=proc.getResultSet();
while(rs.next()){
sb.append("\n"+(temp[0]=rs.getString
(1))+"");
sb.append(temp[1]=rs.getString
(2)+"");
sb.append(temp[2]=rs.getString(3)+"");
sb.append(temp[3]=rs.getString(4)+"");
sb.append(temp[4]=rs.getString(5));
data[index++]=sb.toString();
sb=newStringBuffer();
hasResult=proc.getMoreResults();
}catch(SQLExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}else{
System.out.println("数据库连接失败");
returndata;
//按名字来查询
publicString[]selectGerenInfo(Stringname){
Stringdata[]=newString[3];
if(conn!
=null){
try{
ResultSetrs=null;
//设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数
CallableStatementproc=conn.prepareCall("{callselectGeren(?
)}");
//设置输入参数
proc.setString(1,name);
//调入存储过程
proc.execute();
booleanhasResult=true;
while(hasResult){
rs=proc.getResultSet();
while(rs.next()){
data[0]=rs.getString("ss_number");
data[1]=rs.getString("ss_class");
data[2]=rs.getString("ss_time");
break;
hasResult=proc.getMoreResults();
}catch(SQLExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}else{
System.out.println("数据库连接失败");
returndata;
publicintselectAccount(Stringid){//查询寝室人数
intnumber=-1;
if(conn!
=null){
try{
ResultSetrs=null;
//设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数
CallableStatementproc=conn.prepareCall("{callselectAccount(?
)}");
//设置输入参数
proc.setString(1,id);
//调入存储过程
proc.execute();
booleanhasResult=true;
while(hasResult){
rs=proc.getResultSet();
while(rs.next()){
number=rs.getInt("ss_renshu");
break;
hasResult=proc.getMoreResults();
}catch(SQLExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}else{
System.out.println("数据库连接失败");
returnnumber;
publicvoidtiaohuan(Stringid,StringoldQs,StringnewQs){//调换寝室
intnumber=-1;
if(conn!
=null){
try{
ResultSetrs=null;
//设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数
CallableStatementproc=conn.prepareCall("{calltiaohuanQs(?
?
?
)}");
//设置输入参数
proc.setString(1,id);
proc.setString(2,oldQs);
proc.setString(3,newQs);
//调入存储过程
proc.executeUpdate();
}catch(SQLExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}else{
System.out.println("数据库连接失败");
//增加人数
publicvoidaddPeople(Stringid1){
if(conn!
=null){
try{
ResultSetrs=null;
//设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数
CallableStatementproc=conn.prepareCall("{calladdPeople(?
)}");
//设置输入参数
proc.setString(1,id1);
//调入存储过程
proc.executeUpdate();
System.out.println("添加人数成功");
}catch(SQLExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}else{
System.out.println("数据库连接失败");
//减一人
publicvoidjianPeople(Stringid2){
if(conn!
=null){
try{
ResultSetrs=null;
//设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数
CallableStatementproc=conn.prepareCall("{calljianPeople(?
)}");
//设置输入参数
proc.setString(1,id2);
//调入存储过程
proc.executeUpdate();
System.out.println("旧寝室减少人数成功");
}catch(SQLExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}else{
System.out.println("数据库连接失败");
//分配寝室,插入一条信息
publicvoidinsertStu(Stringid,Stringname,Stringsex,StringClass,Stringtime){
if(conn!
=null){
try{
ResultSetrs=null;
//设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数
CallableStatementproc=conn.prepareCall("{callinsertStu(?
?
?
?
?
)}");
//设置输入参数
proc.setString(1,id);
proc.setString(2,name);
proc.setString(3,sex);
proc.setString(4,Class);
proc.setString(5,time);
//调入存储过程
proc.executeUpdate();
System.out.println("插入成功");
}catch(SQLExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}else{
System.out.println("数据库连接失败");
//关闭数据库操作
publicvoidcloseConn(){
if(conn!
=null){
try{
conn.close();
}catch(SQLExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
主函数代码:
publicclassMainClass{
publicstaticvoidmain(String[]args){
mainFramemf=newmainFrame();
功能实现的代码:
importjava.awt.BorderLayout;
importjava.awt.GridLayout;
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjavax.swing.JButton;
importjavax.swing.JFrame;
importjavax.swing.JLabel;
importjavax.swing.JPanel;
importjavax.swing.JTextArea;
importjavax.swing.JTextField;
publicclassmainFrameextendsJFrameimplementsActionListener{
//上部面板的说明
JPaneljpanel=null;
JButtonJBroomid=null;
JButtonJBname=null;
JButtonJBalter=null;
JButtonJBinitStu=null;
JPanelcenterPanel=newJPanel();
//按寝室号查询
JLabelJL=null;
JTextFieldJFid=null;
JTextAreaJA=null;
//按姓名查询
JLabelJLname=null;
JTextFieldJFname=null;
JLabelJLid2=null;
JTextFieldJFid2=null;
JLabelJLclass=null;
JTextFieldJFclass=null;
JLabelJLtime=null;
JTextFieldJFtime=null;
//调换寝室变量
JLabelJLname2=null;
JTextFieldJFname2=null;
JLabelJLold=null;
JTextFieldJFold=null;
JLabelJLnew=null;
JTextFieldJFnew=null;
//分配寝室变量
JLabelJLid3=null;
JTextFieldJFid3=null;
JLabelJLname3=null;
JTextFieldJFname3=null;
JLabelJLsex=null;
JTextFieldJFsex=null;
JLabelJLclass2=null;
JTextFieldJFclass2=null;
JLabelJLdate=null;
JTextFieldJFdate=null;
//全局变量
JButtonJBsubmit=null;
ConneClassco=newConneClass();
intindex=0;
publicmainFrame(){
this.upPanel();
this.setTitle("寝室管理系统");
this.add(jpanel,"North");
this.add(centerPanel,"Center");
this.setSize(800,300);
this.setVisible(true);
publicvoidupPanel(){
jpanel=newJPanel();
JBroomid=newJButton("按寝室号查询");
JBname=newJButton("按名字查询");
JBalter=newJButton("调换寝室");
JBinitStu=newJButton("分配寝室");
JBroomid.addActionListener(this);
JBname.addActionListener(this);
JBalter.addActionListener(this);
JBinitStu.addActionListener(this);
jpanel.add(JBroomid);
jpanel.add(JBname);
jpanel.add(JBalter);
jpanel.add(JBinitStu);
publicvoidinitRoomid(){//按寝室号查询学生
JFid=newJTextField(10);
JL=newJLabel("清输入寝室号:
");
JBsubmit=newJButton("查询");
JBsubmit.addActionListener(this);
JA=newJTextArea("寝室号、学生姓名、学生性别、班级、总人数、入住时间",6,20);
centerPanel.removeAll();
centerPanel.add(JL);
centerPanel.add(JFid);
centerPanel.add(JBsubmit);
centerPanel.add(JA);
publicvoidinitName(){//按姓名查询
JBsubmit=newJButton("查询");
JBsubmit.addActionListener(this);
JLname=newJLabel("姓名");
JFname=newJTextField(10);
JLid2=newJLabel("寝室号");
JFid2=newJTextField(10);
JLclass=newJLabel("班级");
JFclass=newJTextField(10);
JLtime=newJLabel("入住时间");
JFtime=newJTextField(15);
//centerPanel.setLayout(newGridLayout(5,2));
centerPanel.removeAll();
centerPanel.add(JLname);
centerPanel.add(JFname);
centerPanel.add(JBsubmi
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 学生宿舍 管理 系统 23