系统分析与设计作业5
- a. 阅读 Asg_RH 文档,按用例构建领域模型。
- 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸
- 说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体)
- 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关
- 在 java web 应用中,E 一般与数据库构建有关, M 一般与 session 有关


/==============================================================/
/==============================================================/
drop table if exists CreditCard;
drop table if exists Customer;
drop table if exists Hotel;
drop table if exists "Order";
drop table if exists Room;
/==============================================================/
/==============================================================/
create table CreditCard
(
account int(18) not null,
orderID int(15),
password int(6),
information char,
primary key (account)
);
/==============================================================/
/==============================================================/
create table Customer
(
id int(15) not null,
account int(18),
orderID int(15),
name char(50),
email varchar,
"is smoke" boolean,
hotelID int(15),
primary key (id)
);
/==============================================================/
/==============================================================/
create table Hotel
(
hotelID int(15) not null,
roomID int(5),
city char,
information char,
primary key (hotelID)
);
/==============================================================/
/==============================================================/
create table "Order"
(
orderID int(15) not null,
"check in" char,
"check out" char,
roomID int(5),
price float,
primary key (orderID)
);
/==============================================================/
/==============================================================/
create table Room
(
type char,
roomID int(5) not null,
hotelID int(15),
primary key (roomID)
);
alter table CreditCard add constraint FK_Reference_5 foreign key (orderID)
references "Order" (orderID) on delete restrict on update restrict;
alter table Customer add constraint FK_Reference_1 foreign key (account)
references CreditCard (account) on delete restrict on update restrict;
alter table Customer add constraint FK_Reference_4 foreign key (orderID)
references "Order" (orderID) on delete restrict on update restrict;
alter table Hotel add constraint FK_Reference_3 foreign key (roomID)
references Room (roomID) on delete restrict on update restrict;
alter table "Order" add constraint FK_Reference_6 foreign key (roomID)
references Room (roomID) on delete restrict on update restrict;
- 数据库逻辑模型与领域模型的异同:两者都是类的抽象,抽象出主要的类,描述不同类之间的关系。
领域模型只是一个概念的描述,其中的属性不涉及到其具体类型与实现。数据库逻辑模型涉及到更多的细节部分,涉及到数据库的具体实现,而领域模型与数据库的具体实现没有很大的联系。