学生公寓管理系统
- 格式:doc
- 大小:521.00 KB
- 文档页数:9
1. 需求分析
需求分析的任务是通过详细调查现实世界要处理的对象(组织、部门、企业等),充分了解原系统(手工系统或计算机系统)的工作概况,明确用户的各种需求,然后在此基础上确定新系统的功能。
学生公寓管理系统
学校有若干公寓,每栋5层,每层18个房间,每个房间4个学生,需要一个管理系统实现管理。
(1)寝室分配:根据系别、年纪、班级分配寝室,查询寝室状态和入住信息(2)学生管理:实现入住学生信息的维护和查询功能
(3)信息查询:按公寓楼号、学生姓名等查询住宿信息
(4)出入登记:实现对外来人员进行登记功能
1.1 数据流图(DFD)
数据流图用于表达和描述系统的数据流向和对数据的处理功能。
画数据流图
图1-1公寓管理系统1层数据流图
图1-2公寓管理系统1层数据流图
图1-3学生管理2层数据流图
图1-4访客管理2层数据流图
1.2 数据字典(DD)
数据字典是数据库中各类数据描述的集合,是进行详细的数据收集和数据分析所获得的主要结果。
数据文件:学生信息
信息组成:系别、年级、班级、姓名
数据项:系别
数据类型:字符型
数据长度:2
数据项:年级
数据类型:字符型
数据长度:2
数据组成:班级
数据类型:字符型
数据长度:2
数据项:姓名
数据类型:可变字符类型
数据长度:20
数据文件:信息查询
信息组成:公寓楼号、学生姓名
数据组成:公寓楼号
数据类型:整型
数据长度:1
数据项:学生姓名
数据类型:可变字符类型
数据长度:20
数据文件:访客信息
信息组成:访客姓名、学生姓名、日期
数据项:访客姓名
数据类型:可变字符类型
数据长度:20
数据项:学生姓名
数据类型:可变字符类型
数据长度:20
数据项:日期
数据类型:日期类型
数据长度:10
2. 概念结构设计
概念结构设计阶段的任务就是把这些实际需求抽象成计算机能够识别的信息世界的结构,这种将需求分析阶段得到的用户需求抽象为信息结构即概念模型的过程就是概念结构设计。
E-R图(在Powerdesigner中创建概念模型,粘贴图)
图2-1 E-R图
3. 逻辑结构设计
关系模式((在Powerdesigner中由概念模型转化为物理数据模型,粘图))
图3-1物理数据模型图
4. 建表SQL语句
由物理数据模型生成SQL Server 2008数据库的建表语句。
/*==============================================================*/ /* DBMS name: Microsoft SQL Server 2008 */ /* Created on: 2013-12-6 22:36:42 */ /*==============================================================*/
if exists (select 1
from sysindexes
where id = object_id('学生')
and name = '入住_FK'
and indid > 0
and indid < 255)
drop index 学生.入住_FK
go
if exists (select 1
from sysobjects
where id = object_id('学生')
and type = 'U')
drop table 学生
go
if exists (select 1
from sysobjects
where id = object_id('宿舍')
and type = 'U')
drop table 宿舍
go
if exists (select 1
from sysindexes
where id = object_id('访客')
and name = '探访_FK'
and indid > 0
and indid < 255)
drop index 访客.探访_FK
go
if exists (select 1
from sysobjects
where id = object_id('访客')
and type = 'U')
drop table 访客
go
/*==============================================================*/
/* Table: 学生
*/
/*==============================================================*/
create table 学生 (
姓名 varchar(20) not null,
公寓楼号 int null,
学生姓名 varchar(20) null,
系别 char(2) not null,
班级 char(2) not null,
年级 char(2) not null,
constraint PK_学生 primary key nonclustered (姓名)
)
go
/*==============================================================*/
/* Index: 入住_FK */
/*==============================================================*/
create index 入住_FK on 学生 (
公寓楼号 ASC,
学生姓名 ASC
)
go
/*==============================================================*/
/* Table: 宿舍
*/
/*==============================================================*/
create table 宿舍 (
学生姓名 varchar(20) not null,
公寓楼号 int not null,
constraint PK_宿舍 primary key nonclustered (公寓楼号, 学生姓名)
)
go
/*==============================================================*/
/* Table: 访客
*/
/*==============================================================*/
create table 访客 (
访客姓名 varchar(20) not null,
日期 datetime not null,
姓名 varchar(20) null,
constraint PK_访客 primary key nonclustered (访客姓名, 日期)
)
go
/*==============================================================*/
/* Index: 探访_FK */
/*==============================================================*/
create index 探访_FK on 访客 (
姓名 ASC
)
go。