学生宿舍管理系统23页Word文件下载.docx

上传人:b****5 文档编号:19966379 上传时间:2023-01-13 格式:DOCX 页数:16 大小:19.82KB
下载 相关 举报
学生宿舍管理系统23页Word文件下载.docx_第1页
第1页 / 共16页
学生宿舍管理系统23页Word文件下载.docx_第2页
第2页 / 共16页
学生宿舍管理系统23页Word文件下载.docx_第3页
第3页 / 共16页
学生宿舍管理系统23页Word文件下载.docx_第4页
第4页 / 共16页
学生宿舍管理系统23页Word文件下载.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

学生宿舍管理系统23页Word文件下载.docx

《学生宿舍管理系统23页Word文件下载.docx》由会员分享,可在线阅读,更多相关《学生宿舍管理系统23页Word文件下载.docx(16页珍藏版)》请在冰豆网上搜索。

学生宿舍管理系统23页Word文件下载.docx

6技术可行性

该小组成员全部来自学校计算机系,学习了软件工程方面的课程,使所学知识用于实践.

7社会可行性

由于是学生小组开发,也锻炼了小组成员的实际动手能力,丰富了阅历,积累开发经验,且开发出的系统由学校内部使用,不涉及盈利方面的问题,不会和社会以及法律造成冲突。

8总体分析

改变了原有的人工记录的操作方式,提高了工作的效率,成本低,实现了学生宿舍计算机化管理。

具有可行性。

三系统功能分析

该系统的功能主要是针对学生宿舍管理员,可实现如下功能:

1管理员可以完成对学生学号、姓名、性别、班级、入住时间等学生基本信息的录入、调换寝室,查询学生信息等功能。

3管理员可完成对楼号、宿舍号、床位数、现住人数等宿舍信息的录入、删除、修改等功能。

4管理员可完成宿舍分配、退房处理等宿舍工作管理。

3表

(1)基本信息表(tb_userInfo)

字段名

意义

类型

宽度

NULL

PrimaryKey

Ss_number

寝室号

nchar

10

No

Ss_name

姓名

Ss_class

班号

Ss_sex

性别

2

Yes

Ss_time

入住时间

20

2寝室(tb_roomInfo)

PaimaryKey

Room_number

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){

//根据用户名查询一条记录

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];

{callselectGeren(?

proc.setString(1,name);

while(hasResult){

while(rs.next()){

data[0]=rs.getString("

ss_number"

data[1]=rs.getString("

ss_class"

data[2]=rs.getString("

ss_time"

);

break;

publicintselectAccount(Stringid){//查询寝室人数

intnumber=-1;

if(conn!

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){//调换寝室

{calltiaohuanQs(?

?

proc.setString(2,oldQs);

proc.setString(3,newQs);

proc.executeUpdate();

//增加人数

publicvoidaddPeople(Stringid1){

if(conn!

ResultSetrs=null;

//设置调用的存储过程名及参数情况,注意的是存储过程不可以有输出参数

CallableStatementproc=conn.prepareCall("

{calladdPeople(?

//设置输入参数

proc.setString(1,id1);

//调入存储过程

proc.executeUpdate();

添加人数成功"

}else{

System.out.println("

//减一人

publicvoidjianPeople(Stringid2){

{calljianPeople(?

proc.setString(1,id2);

旧寝室减少人数成功"

//分配寝室,插入一条信息

publicvoidinsertStu(Stringid,Stringname,Stringsex,StringClass,Stringtime){

{callinsertStu(?

proc.setString(1,id);

proc.setString(2,name);

proc.setString(3,sex);

proc.setString(4,Class);

proc.setString(5,time);

插入成功"

//关闭数据库操作

publicvoidcloseConn(){

conn.close();

主函数代码:

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(){//按姓名查询

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.add(JLname);

centerPanel.add(JFname);

centerPanel.add(JBsubmi

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 语文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1