一、需求描述与分析
1.功能性需求
用户类型有教务管理员、学生和教师。
⑴管理员后台模块
主要用于系统的数据管理,包括学生管理、教师管理、班级管理和课程管理。具体功能
①学生信息管理
②教师信息管理
③课程信息管理
④班级信息管理
⑵学生使用模块
包含三个功能
①查询功能
②浏览所选课程
③查询成绩
⑶教师使用模块
主要有两个功能
①我的课程
②登分
2.非功能性需求
采用B/S结构。还需要质量要求

二、系统设计
通过自顶向下的设计方法,将在线选课系统设计成模块结构图。
1.功能模块设计

①登录验证模块
②管理员后台模块
有学生信息管理、教师信息管理、课程信息管理、班级信息管理。

③学生使用模块

④教师使用模块

2.数据库设计
①确定实体
根据前期的设计,确定实体有:学生、教师、课程、院系、班级和系统管理员。所包含的属性信息设计如下:
i)学生实体用于描述学生的基本信息,包括学号、姓名、性别、密码等信息。
ii)教师实体用于描述教师的基本信息,包括教师工号、姓名、性别、年龄、职称、密码等信息。
iii)课程实体用于描述课程的基本信息,包括课程号、课程名、学分、时间、地点、类别、开课学院、限选人数等信息。
iv)院系实体用于描述院系的基本信息,包括院系名称、办公地点、教师人数等信息。
v)系统管理员实体用于描述系统管理员的基本信息,包括姓名、ID 号、密码等信息
需要注意的是:在数据库设计时,实体的描述信息可根据实际需求进行增加或删减,如果实体的属性较多,在构建 E-R模型时不一定需要把所有的属性都标识在E-R模型上,可以另外用文字说明,这样也使得 E-R 模型简明清晰,便于分析。
②局部信息结构
i ) 学生-课程E-R图(多对多M-N)

ii) 教师-课程E-R图(1:N)

iii) 教师-院系E-R图(1:N)

iv) 学生-院系E-R图(1:N)

v) 系统管理员-学生E-R图(多对多M-N)

vi) 系统管理员-教师E-R图(多对多M-N)

vii) 系统管理员-课程E-R图(多对多M-N)

viii) 系统管理员-院系E-R图(多对多M-N)

③全局信息结构
i) 首先将学生-课程E-R图、教师-课程E-R图、教师-院系E-R图、学生-院系E-R图合并成为一个较大的局部信息结构。

ii) 再将系统管理员-学生E-R图、系统管理员-教师E-R图、系统管理员-课程E-R图、系统管理员-院系E-R图合并成为一个较大的局部信息结构。

iii) 最后,将两个合并成为一个全局E-R

④逻辑结构与规范化设计
将E-R图转换为关系模式,
学生(学号(主码)、姓名、性别、登录密码、院系编号)
院系(院系编号(主码)、系名、学生人数、教师人数、办公地点)
教师(职工号(主码)、姓名、性别、年龄、职称、登录密码、院系编号)
课程(课程号(主码)、课程名称、课程类别、学分、上课时间、上课地点、开课学院、限选人数、职工号)
系统管理员(ID 号(主码)、姓名、登录密码)
选修(学号(主码)、课程号(主码)、成绩)
管理学生(管理员 ID 号(主码)、学号(主码)、操作时间)
管理院系(管理员ID号(主码)、院系编号(主码)、操作时间)
管理教师(管理员ID号(主码)、职工号(主码)、操作时间)
管理教师(管理员ID号(主码)、课程号(主码)、操作时间)
三、系统实现
①数据库的实现
创建数据库db_xuanke;
mysql> create database db_xuanke;
Query OK, 1 row affected (0.00 sec)
根据应用数据库逻辑结构设计得出的关系模式,创建12张数据表。



mysql> use db_xuanke;
Database changed
--创建学生信息表
mysql> create table student
-> (
-> StuNo int(8) not null auto_increment,
-> StuName varchar(10) not null,
-> StuSex char(1) default 'M',
-> Pwd varchar(8) not null default '00000000',
-> DeptNo int(8) not null,
-> primary key(StuNo)
-> );
Query OK, 0 rows affected (0.01 sec)
--创建院系编码表
mysql> create table deptcode
-> (
-> DeptNo int(8) not null primary key auto_increment,
-> DeptName varchar(10) not null
-> );
Query OK, 0 rows affected (0.03 sec)
--创建院系表
mysql> create table department
-> (
-> DeptNo int(8) not null primary key auto_increment,
-> Numofstudent int(10),
-> Numofteather int(10),
-> DeptAddr varchar(10)
-> );
Query OK, 0 rows affected (0.01 sec)
--创建教师表
mysql> create table teacher
-> (
-> TeachNo int(8) not null primary key auto_increment,
-> TeachName varchar(10) not null,
-> TeachSex char(1),
-> TeachAge int(4),
-> TeachTitle varchar(6),
-> Pwd varchar(8) not null default '00000000',
-> DeptNo int(8) not null
-> );
Query OK, 0 rows affected (0.04 sec)
--创建课程编码表
mysql> create table coursecode
-> (
-> CourseNo int(8) not null primary key auto_increment,
-> CourseName varchar(10) not null
-> );
Query OK, 0 rows affected (0.01 sec)
--创建课程表
mysql> create table course
-> (
-> CourseNo int(8) not null primary key auto_increment,
-> CourseType varchar(6) not null,
-> Credit int(2) not null,
-> CourseTime date,
-> CourseAddr varchar(10),
-> DeptName varchar(10) not null,
-> Limitofnum int(4) not null,
-> TeachNo int(8) not null
-> );
Query OK, 0 rows affected (0.01 sec)
--创建系统管理员表
mysql> create table administrator
-> (
-> AdminNo int(8) not null primary key auto_increment,
-> AdminName varchar(10) not null,
-> Pwd varchar(8) not null default '00000000'
-> );
Query OK, 0 rows affected (0.01 sec)
--创建选修表
mysql> create table electing
-> (
-> StuNo int(8) not null auto_increment,
-> CourseNo int(8) not null,
-> Score int(4),
-> primary key(StuNo,CourseNo)
-> );
Query OK, 0 rows affected (0.01 sec)
--创建管理学生表
mysql> create table adminstu
-> (
-> AdminNo int(8) not null auto_increment,
-> StuNo int(8) not null,
-> OpTime date,
-> primary key(AdminNo,StuNo)
-> );
Query OK, 0 rows affected (0.01 sec)
--创建管理院系表
mysql> create table admindept
-> (
-> AdminNo int(8) not null auto_increment,
-> DeptNo int(8) not null,
-> OpTime date,
-> primary key(AdminNo,DeptNo)
-> );
Query OK, 0 rows affected (0.01 sec)
--创建管理教师表
mysql> create table adminteacher
-> (
-> AdminNo int(8) not null auto_increment,
-> TeachNo int(8) not null,
-> OpTime date,
-> primary key(AdminNo,TeachNo)
-> );
Query OK, 0 rows affected (0.06 sec)
--创建课程表
mysql> create table admincourse
-> (
-> AdminNo int(8) not null auto_increment,
-> CourseNo int(8) not null,
-> OpTime date,
-> primary key(AdminNo,CourseNo)
-> );
Query OK, 0 rows affected (0.01 sec)
②系统功能的实现
包括实现必要的数据库行为和应用软件的业务逻辑
⑴实现数据库行为
是实现数据库行为设计的结果,主要完成增、删、改、查等操作。
i) 安全控制
⑵实现应用软件的业务逻辑
四、系统测试与维护
1.登录验证功能测试

2.管理员后台主要功能测试
⑴学生信息管理功能

⑵课程信息管理功能

3.学生使用模块功能测试

4.教师使用模块功能测试

网友评论