Javaweb 项目编写
----留言板的设计
指导教师:
小组成员:
1.归纳项目的功能(宏观)--UML 的 UseCase(用例图)
在本项目中,共有 8 个模块,小组成员分配如下:
:注册,登录,浏览;
:发表主题,分页查看;
:删除主题,修改主题,发表评论。
2.根据用例图,确定功能所需要的信息(确定数据字典)
U
ser 表
信息 数据类型
用户编号
Uid int
用户名
username String
性别
sex String
密码
Password String
昵称
Lovername String
创建时间
Regtime Timestape
T
opic 表
信息 数据类型
主题编号
tid Int
主题名称
Tname String
主题内容
Tcontext Text
发表时间
Ttime Timestape
Context 表
信息 数据类型
评论内容
Ccontext Text
评论时间
Ctime Timestape
评论编号
cid Int
数据建模
数据模型之间的关系
将其转换成为真实的表
生成 sql 脚本
/*==================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2010/11/28 14:48:07 */
/*===================================================*/
drop table if exists Context; /如果存在 context 表将它删除
drop table if exists Topic; //如果存在 topic 表将它删除
drop table if exists User; //如果存在 user 表将它删除
/*======================================================*/
/* Table: Context */
/*======================================================*/
create table Context
(
cid int auto_increment not null, //定义整形变量 cid,非空
tid int, //定义整形变量 tid
uid int, //定义整型变量 uid
ccontext text not null, //定义文本区 ccontext,非空
ctime timestamp not null, //定义一个时间戳,非空
primary key (cid) //主键为 cid
);
/*====================================================*/
/* Table: Topic */
/*===================================================*/
create table Topic
(
tid int auto_increment not null, //定义整形变量 tid,非空
uid int, //定义整型变量 uid
tname varchar(20) not null,//定义字符串 tname,非空
tcontext text not null, //定义文本区,非空
ttime timestamp not null, //定义一个时间戳,非空
primary key (tid) //主键为 tid
);
/*====================================================*/
/* Table: User */
/*====================================================*/
create table User
(
uid int auto_increment not null, //定义整形变量 uid,非空
username varchar(10) not null,//定义字符串 username,非空
sex varchar(4) not null, //定义字符串 sex,非空
password varchar(20) not null, //定义字符串 password,非空
lovername varchar(10) not null, //定义字符串 password,非空
regtime timestamp not null, //定义一个时间戳,非空
primary key (uid) //主键为 uid
);