




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、.学生宿舍管理系统 专业:软件技术组员: 石胜华 蒋霞 张龙班级:1001 1. 问题定义随着中国大学普遍扩招,招收的大学生越来越多,而学生宿舍管理成为高校管理的很重要的一部分。但目前,很多高校还是采用传统的人工记录的方法, 需要记录的数据比较多,而且需要保存的数据也比较多,人工记录、查找信息等都比较费事,而且平安性不高. 21世纪的今天,信息化占据着社会主流,计算机在各行各业的的应用越来越广泛,自动化信息化的管理被应用到越来越广泛的领域。学生宿舍管理系统采用的是计算机化管理,系统做的尽量人性化,需要系统操作方便,管理人员需要做的就是将数据输入到系统的数据库中去。管理员和学生利用该系统可完成如
2、下功能:1 管理员可快速查询学生根本信息2 管理员可方便实现楼资源管理3 管理员可实现宿舍资源管理4 管理员可方便实现查询统计 该系统采用JAVA开发,后台数据库采用SQL Server 2005。二 可行性分析 1 问题1目前宿舍管理还都采用人工记录的方法。2需要手工记录很多信息,浪费人力财力,且操作费事。3查询学生根本住宿信息时,查询效率低下,不能实现快速查询。 2 工程目的:开发一小型学生宿舍管理系统,要操作方便,并能满足学校学生宿舍管理根本需求。 3 运行环境 1采用JAVA开发。 2后台数据库用SQL Server 2005。3硬件设备为pc机一台。 4 开发风险浪费人力资源时间资源
3、,改变了原有的手工记录的宿舍管理方式,但对原有的管理制度没有任何影响,根本上不会有什么风险,但开发的工程可能过于简单。5 经济可行性 不需投入太多费用,由学生小组共同开发,利用课余时间开发。只需投入使用几台pc机,以实现学生宿舍计算机化管理。6 技术可行性 该小组成员全部来自学校计算机系,学习了软件工程方面的课程,使所学知识用于理论.7 社会可行性 由于是学生小组开发,也锻炼了小组成员的实际动手才能,丰富了阅历,积累开发经历,且开发出的系统由学校内部使用,不涉及盈利方面的问题,不会和社会以及法律造成冲突。8 总体分析 改变了原有的人工记录的操作方式,进步了工作的效率,本钱低,实现了学生宿舍计算
4、机化管理。具有可行性。三 系统功能分析 该系统的功能主要是针对学生宿舍管理员,可实现如下功能:1 管理员可以完成对学生学号、姓名、性别、班级、入住时间等学生根本信息的录入、调换寝室,查询学生信息等功能。3 管理员可完成对楼号、宿舍号、床位数、现住人数等宿舍信息的录入、删除、修改等功能。4 管理员可完成宿舍分配、退房处理等宿舍工作管理。3 表1根本信息表tb_userInfo字段名意义类型宽度NULLPrimaryKeySs_number寝室号nchar10NoSs_name姓名nchar10NoSs_class班号nchar10NoSs_sex性别nchar2YesSs_time入住时间nch
5、ar20No2 寝室tb_roomInfo字段名意义类型宽度NULLPaimaryKeyRoom_number寝室号nchar10NoRoom_people现住人数IntNo 程序的根本界面: 详细的JAVA界面代码: import java.sql.CallableStatement;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;public class ConneClass Connection conn = nu
6、ll;String temp=new String6;public ConneClass this.initDataBase;/ 建立数据库连接public void initDataBase try /加载驱动程序jdbc-odbc桥 Class.forName"com.microsoft.sqlserver.jdbc.SQLServerDriver"/获取数据库连接 conn=DriverManager.getConnection"jdbc.sqlserver:/localhost:1433:databaseName=ssglxt","sa
7、","123" catch ClassNotFoundException e / TODO Auto-generated catch blocke.printStackTrace; catch SQLException e / TODO Auto-generated catch blocke.printStackTrace; /根据用户名查询一条记录public String selectInfoString idStringBuffer sb=new StringBuffer;String data=new String4;int index=0;ifconn!
8、=nulltry ResultSet rs = null; / 设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数 CallableStatement proc = conn.prepareCall" call ssgl_proc?" / 设置输入参数 proc.setString1,id; / 调入存储过程 proc.execute; boolean hasResult = true; while hasResult rs = proc.getResultSet; whilers.next sb.append"n"+temp0=rs.ge
9、tString1+" " sb.appendtemp1=rs.getString2+" " sb.appendtemp2=rs.getString3+" " sb.appendtemp3=rs.getString4+" " sb.appendtemp4=rs.getString5; dataindex+=sb.toString; sb=new StringBuffer; hasResult = proc.getMoreResults; catch SQLException e / TODO Auto-generat
10、ed catch blocke.printStackTrace;elseSystem.out.println"数据库连接失败"return data;/按名字来查询public String selectGerenInfoString nameString data=new String3;ifconn!=nulltry ResultSet rs = null; / 设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数 CallableStatement proc = conn.prepareCall" call selectGeren?"
11、/ 设置输入参数 proc.setString1,name; / 调入存储过程 proc.execute; boolean hasResult = true; while hasResult rs = proc.getResultSet; whilers.next data0=rs.getString"ss_number" data1=rs.getString"ss_class" data2=rs.getString"ss_time" ; break; hasResult = proc.getMoreResults; catch SQ
12、LException e / TODO Auto-generated catch blocke.printStackTrace;elseSystem.out.println"数据库连接失败"return data;public int selectAccountString id/查询寝室人数int number=-1;ifconn!=nulltry ResultSet rs = null; / 设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数 CallableStatement proc = conn.prepareCall" call sele
13、ctAccount?" / 设置输入参数 proc.setString1,id; / 调入存储过程 proc.execute; boolean hasResult = true; while hasResult rs = proc.getResultSet; whilers.next number=rs.getInt"ss_renshu" break; hasResult = proc.getMoreResults; catch SQLException e / TODO Auto-generated catch blocke.printStackTrace;el
14、seSystem.out.println"数据库连接失败"return number;public void tiaohuanString id,String oldQs,String newQs/调换寝室int number=-1;ifconn!=nulltry ResultSet rs = null; / 设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数 CallableStatement proc = conn.prepareCall" call tiaohuanQs?,?,?" / 设置输入参数 proc.setString1,i
15、d; proc.setString2, oldQs; proc.setString3, newQs; / 调入存储过程 proc.executeUpdate; catch SQLException e / TODO Auto-generated catch blocke.printStackTrace;elseSystem.out.println"数据库连接失败"/增加人数public void addPeopleString id1 ifconn!=nulltry ResultSet rs = null; / 设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参
16、数 CallableStatement proc = conn.prepareCall" call addPeople?" / 设置输入参数 proc.setString1,id1; / 调入存储过程 proc.executeUpdate; System.out.println"添加人数成功" ; catch SQLException e / TODO Auto-generated catch blocke.printStackTrace;elseSystem.out.println"数据库连接失败"/减一人public void j
17、ianPeopleString id2 ifconn!=nulltry ResultSet rs = null; / 设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数 CallableStatement proc = conn.prepareCall" call jianPeople?" / 设置输入参数 proc.setString1,id2; / 调入存储过程 proc.executeUpdate; System.out.println"旧寝室减少人数成功" ; catch SQLException e / TODO Auto-gen
18、erated catch blocke.printStackTrace;elseSystem.out.println"数据库连接失败"/分配寝室,插入一条信息public void insertStuString id,String name,String sex,String Class,String time ifconn!=nulltry ResultSet rs = null; / 设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数 CallableStatement proc = conn.prepareCall" call insertS
19、tu?,?,?,?,?" / 设置输入参数 proc.setString1,id; proc.setString2,name; proc.setString3,sex; proc.setString4,Class; proc.setString5,time; / 调入存储过程 proc.executeUpdate; System.out.println"插入成功" ; catch SQLException e / TODO Auto-generated catch blocke.printStackTrace;elseSystem.out.println"
20、;数据库连接失败"/关闭数据库操作public void closeConnifconn!=nulltry conn.close; catch SQLException e / TODO Auto-generated catch blocke.printStackTrace;主函数代码:public class MainClass public static void mainString argsmainFrame mf=new mainFrame;功能实现的代码:import java.awt.BorderLayout;import java.awt.GridLayout;imp
21、ort java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextArea;import javax.swing.JTextField;public class mainFrame extends JFrame implements ActionListener /上部面
22、板的说明 JPanel jpanel=null; JButton JBroomid=null; JButton JBname=null; JButton JBalter=null; JButton JBinitStu=null; JPanel centerPanel=new JPanel; /按寝室号查询 JLabel JL=null; JTextField JFid=null; JTextArea JA=null; /按姓名查询 JLabel JLname=null; JTextField JFname=null; JLabel JLid2=null; JTextField JFid2=nu
23、ll; JLabel JLclass=null; JTextField JFclass=null; JLabel JLtime=null; JTextField JFtime=null; /调换寝室变量 JLabel JLname2=null; JTextField JFname2=null; JLabel JLold=null; JTextField JFold=null; JLabel JLnew=null; JTextField JFnew=null; /分配寝室变量 JLabel JLid3=null; JTextField JFid3=null; JLabel JLname3=nul
24、l; JTextField JFname3=null; JLabel JLsex=null; JTextField JFsex=null; JLabel JLclass2=null; JTextField JFclass2=null; JLabel JLdate=null; JTextField JFdate=null; /全局变量 JButton JBsubmit=null; ConneClass co=new ConneClass; int index=0; public mainFrame this.upPanel; this.setTitle"寝室管理系统" thi
25、s.addjpanel,"North" this.addcenterPanel,"Center" this.setSize800,300; this.setVisibletrue; public void upPanel jpanel=new JPanel; JBroomid=new JButton"按寝室号查询" JBname=new JButton"按名字查询" JBalter=new JButton"调换寝室" JBinitStu=new JButton"分配寝室" J
26、Broomid.addActionListenerthis; JBname.addActionListenerthis; JBalter.addActionListenerthis; JBinitStu.addActionListenerthis; jpanel.addJBroomid; jpanel.addJBname; jpanel.addJBalter; jpanel.addJBinitStu; public void initRoomid/按寝室号查询学生 JFid=new JTextField10; JL=new JLabel"清输入寝室号:" ; JBsubmi
27、t=new JButton"查询" JBsubmit.addActionListenerthis; JA=new JTextArea"寝室号、学生姓名、学生性别、班级、总人数、入住时间",6,20; centerPanel.removeAll; centerPanel.addJL; centerPanel.addJFid; centerPanel.addJBsubmit; centerPanel.addJA; public void initName/按姓名查询 JBsubmit=new JButton"查询" JBsubmit.ad
28、dActionListenerthis; JLname=new JLabel"姓名" JFname=new JTextField10; JLid2=new JLabel"寝室号" JFid2=new JTextField10; JLclass=new JLabel"班级" JFclass=new JTextField10; JLtime=new JLabel"入住时间" JFtime=new JTextField15; /centerPanel.setLayoutnew GridLayout5,2; centerP
29、anel.removeAll; centerPanel.addJLname; centerPanel.addJFname; centerPanel.addJBsubmit; centerPanel.addJLid2; centerPanel.addJFid2; centerPanel.addJLclass; centerPanel.addJFclass; centerPanel.addJLtime; centerPanel.addJFtime; public void initOldToNew/调换寝室 JBsubmit=new JButton"调换" JBsubmit.a
30、ddActionListenerthis; JLname2=new JLabel"姓名" JFname2=new JTextField10; JLold=new JLabel"旧寝室号" JFold=new JTextField10; JLnew=new JLabel"新寝室号" JFnew=new JTextField10; centerPanel.removeAll; centerPanel.addJLname2; centerPanel.addJFname2; centerPanel.addJLold; centerPanel.
31、addJFold; centerPanel.addJLnew; centerPanel.addJFnew; centerPanel.addJBsubmit; public void initfenpei/分配寝室 JBsubmit=new JButton"添加" JBsubmit.addActionListenerthis; JLid3=new JLabel"寝室号" JFid3=new JTextField10; JLname3=new JLabel"姓名" JFname3=new JTextField10; JLsex=new J
32、Label"性别" JFsex=new JTextField2; JLclass2=new JLabel"班级" JFclass2=new JTextField10; JLdate=new JLabel"入住时间" JFdate=new JTextField15; centerPanel.removeAll ; centerPanel.addJLid3; centerPanel.addJFid3; centerPanel.addJLname3; centerPanel.addJFname3; centerPanel.addJLsex; centerPanel.addJFsex; centerPanel.addJLclass2; centerPanel.addJFclass2; centerPanel.addJLdate; centerPanel.addJFdate; centerPanel.addJBsubmit; public void actionPerformedActionEvent eife.getSource =JBroomidindex=1;this.initRoomid;else ife.getSource =JBn
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 供热公司收购合同范本
- 买方单方面违约合同范本
- 上海租赁牌照合同范本
- 2024年遵义市赤水市公益性岗位人员招聘考试真题
- Unit 1 A new start:Understanding ideas ① 教学设计 -2024-2025学年外研版(2024年)英语七年级 上册
- 出售大型废船合同范本
- 临时供电协议合同范本
- 2024年民主与科学杂志社招聘考试真题
- 劳务合同范本修灶台
- 上海疫情物质供货合同范本
- 《人工智能导论》(第2版)高职全套教学课件
- 39 《出师表》对比阅读-2024-2025中考语文文言文阅读专项训练(含答案)
- 蛇胆川贝液在动物模型中的药理作用研究
- GB/T 44260-2024虚拟电厂资源配置与评估技术规范
- 中国煤炭地质总局公开招聘报名表
- AQ 1064-2008 煤矿用防爆柴油机无轨胶轮车安全使用规范(正式版)
- 电子商务数据分析基础(第二版) 课件 模块1、2 电子商务数据分析概述、基础数据采集
- YB-T+4190-2018工程用机编钢丝网及组合体
- 高大模板安全施工施工安全保证措施
- 比亚迪公司应收账款管理的问题及对策分析
- 【高考真题】2024年新课标全国Ⅱ卷高考语文真题试卷(含答案)
评论
0/150
提交评论