1、 領域建模
- a. 閱讀 Asg_RH 文檔,按用例構建領域模型。
- 按 Task2 要求,請使用工具 UMLet,截圖格式務必是 png 並控制尺寸
- 說明:請不要受 PCMEF 層次結構影響。你需要識別實體(E)和 中介實體(M,也稱狀態實體)
- 在單頁面應用(如 vue)中,E 一般與數據庫構建有關, M 一般與 store 模式 有關
- 在 java web 應用中,E 一般與數據庫構建有關, M 一般與 session 有關
- b. 數據庫建模(E-R 模型)
- 按 Task 3 要求,給出系統的 E-R 模型(數據邏輯模型)
- 建模工具 PowerDesigner(簡稱PD) 或開源工具 OpenSystemArchitect
- 不負責的鏈接 http://www.cnblogs.com/mcgrady/archive/2013/05/25/3098588.html
- 導出 Mysql 物理數據庫的腳本
- 簡單敘說 數據庫邏輯模型 與 領域模型 的異同
/*==============================================================*/
/* DBMS name: Sybase SQL Anywhere 12 */
/* Created on: 2018/4/28 21:23:29 */
/*==============================================================*/
if exists(select 1 from sys.sysforeignkey where role='FK_HOTEL_REFERENCE_ROOM') then
alter table hotel
delete foreign key FK_HOTEL_REFERENCE_ROOM
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_RESERVAT_REFERENCE_HOTEL') then
alter table reservation
delete foreign key FK_RESERVAT_REFERENCE_HOTEL
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_RESERVAT_REFERENCE_PAYMENT') then
alter table reservation
delete foreign key FK_RESERVAT_REFERENCE_PAYMENT
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_RESERVAT_REFERENCE_TRAVELLE') then
alter table reservation
delete foreign key FK_RESERVAT_REFERENCE_TRAVELLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_TRAVELLE_REFERENCE_PAYMENT') then
alter table traveller
delete foreign key FK_TRAVELLE_REFERENCE_PAYMENT
end if;
drop table if exists hotel;
drop table if exists payment;
drop table if exists reservation;
drop table if exists room;
drop table if exists traveller;
/*==============================================================*/
/* Table: hotel */
/*==============================================================*/
create table hotel
(
name text not null,
location text not null,
roomNum int not null,
phoneNum int not null,
constraint PK_HOTEL primary key clustered (name)
);
/*==============================================================*/
/* Table: payment */
/*==============================================================*/
create table payment
(
payId int not null,
price float not null,
payTime datetime not null,
constraint PK_PAYMENT primary key clustered (payId)
);
/*==============================================================*/
/* Table: reservation */
/*==============================================================*/
create table reservation
(
reservationId int not null,
name text null,
payId int null,
accountId text null,
startDate date not null,
endDate date not null,
travellerId text not null,
travellerPhone int not null,
price float not null,
state text not null,
constraint PK_RESERVATION primary key clustered (reservationId)
);
/*==============================================================*/
/* Table: room */
/*==============================================================*/
create table room
(
roomNum int not null,
state char not null,
constraint PK_ROOM primary key clustered (roomNum)
);
/*==============================================================*/
/* Table: traveller */
/*==============================================================*/
create table traveller
(
accountId text not null,
payId int null,
password text not null,
phoneNum int not null,
constraint PK_TRAVELLER primary key clustered (accountId)
);
alter table hotel
add constraint FK_HOTEL_REFERENCE_ROOM foreign key (roomNum)
references room (roomNum)
on update restrict
on delete restrict;
alter table reservation
add constraint FK_RESERVAT_REFERENCE_HOTEL foreign key (name)
references hotel (name)
on update restrict
on delete restrict;
alter table reservation
add constraint FK_RESERVAT_REFERENCE_PAYMENT foreign key (payId)
references payment (payId)
on update restrict
on delete restrict;
alter table reservation
add constraint FK_RESERVAT_REFERENCE_TRAVELLE foreign key (accountId)
references traveller (accountId)
on update restrict
on delete restrict;
alter table traveller
add constraint FK_TRAVELLE_REFERENCE_PAYMENT foreign key (payId)
references payment (payId)
on update restrict
on delete restrict;
相同點:都能簡明清晰地表明數據表之間的關係,關注用例。
不同點:領域模型更關注功能,數據庫更關注數據。