1.领域建模
a.阅读 Asg_RH 文档,按用例构建领域模型。

b.数据库建模(E-R 模型)
E-R模型

物理模型

导出 Mysql 物理数据库的脚本
/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2018/4/28 19:11:06 */
/*==============================================================*/
drop table if exists CreditCard;
drop table if exists Destination;
drop table if exists Hotel;
drop table if exists Reservation;
drop table if exists Room;
drop table if exists Traveller;
/*==============================================================*/
/* Table: CreditCard */
/*==============================================================*/
create table CreditCard
(
CardNumber varchar(20) not null,
userid int,
cardid int not null,
primary key (CardNumber)
);
/*==============================================================*/
/* Table: Destination */
/*==============================================================*/
create table Destination
(
cutyName varchar(20) not null,
primary key (cutyName)
);
/*==============================================================*/
/* Table: Hotel */
/*==============================================================*/
create table Hotel
(
hotelid int not null,
cutyName varchar(20),
hotelname varchar(20),
primary key (hotelid)
);
/*==============================================================*/
/* Table: Reservation */
/*==============================================================*/
create table Reservation
(
resid int not null,
userid int,
CheckinDate date,
CheckoutDate date,
primary key (resid)
);
/*==============================================================*/
/* Table: Room */
/*==============================================================*/
create table Room
(
roomid int not null,
hotelid int,
resid int,
roomType varchar(20),
primary key (roomid)
);
/*==============================================================*/
/* Table: Traveller */
/*==============================================================*/
create table Traveller
(
userid int not null,
"E-mail" varchar(20),
Name varchar(20),
primary key (userid)
);
alter table CreditCard add constraint FK_Relationship_1 foreign key (userid)
references Traveller (userid) on delete restrict on update restrict;
alter table Hotel add constraint FK_Relationship_5 foreign key (cutyName)
references Destination (cutyName) on delete restrict on update restrict;
alter table Reservation add constraint FK_Relationship_2 foreign key (userid)
references Traveller (userid) on delete restrict on update restrict;
alter table Room add constraint FK_Relationship_3 foreign key (resid)
references Reservation (resid) on delete restrict on update restrict;
alter table Room add constraint FK_Relationship_4 foreign key (hotelid)
references Hotel (hotelid) on delete restrict on update restrict;
简单叙说 数据库逻辑模型 与 领域模型 的异同
数据逻辑模型是一种图形化的展现方式,一般采用面向对象的设计方法,有效组织来源多样的各种业务数据,使用统一的逻辑语言描述业务。
领域模型是对领域内的概念类或现实世界中对象的可视化表示。它专注于分析问题领域本身,发掘重要的业务领域概念,并建立业务领域概念之间的关系。
数据库逻辑模型需要考虑一些更加细节的东西,而数据库逻辑建模会更偏向于实践而不再是概念的建模。用户不需要关心系统的数据模型,但是必须关注领域模型,因为领域模型反映的是问题域的相关业务概念以及其关系,领域模型是用户业务描述的高度抽象,来源于业务需求的描述,同时又可以帮助用户和需求分析人员更好的理解业务需求。