阅读 Asg_RH 文档,按用例构建领域模型。
- 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸
- 说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体)
- 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关
- 在java web 应用中,E 一般与数据库构建有关, M 一般与 session 有关
数据库建模(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/29 11:21:50 */
/*==============================================================*/
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_HOTEL_REFERENCE_CITY') then
alter table Hotel
delete foreign key FK_HOTEL_REFERENCE_CITY
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_RESERVAT_REFERENCE_CUSTOMER') then
alter table Reservation
delete foreign key FK_RESERVAT_REFERENCE_CUSTOMER
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_SHOPPING_REFERENCE_RESERVAT') then
alter table ShoppingBasket
delete foreign key FK_SHOPPING_REFERENCE_RESERVAT
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_SHOPPING_REFERENCE_CUSTOMER') then
alter table ShoppingBasket
delete foreign key FK_SHOPPING_REFERENCE_CUSTOMER
end if;
drop table if exists City;
drop table if exists Customer;
drop table if exists Hotel;
drop table if exists Reservation;
drop table if exists Room;
drop table if exists ShoppingBasket;
/*==============================================================*/
/* Table: City */
/*==============================================================*/
create table City
(
cityName long varchar not null,
constraint PK_CITY primary key clustered (cityName)
);
/*==============================================================*/
/* Table: Customer */
/*==============================================================*/
create table Customer
(
name long varchar not null,
email long varchar null,
phone long varchar null,
constraint PK_CUSTOMER primary key clustered (name)
);
/*==============================================================*/
/* Table: Hotel */
/*==============================================================*/
create table Hotel
(
name long varchar not null,
roomType long varchar null,
cityName long varchar null,
constraint PK_HOTEL primary key clustered (name)
);
/*==============================================================*/
/* Table: Reservation */
/*==============================================================*/
create table Reservation
(
CheckInDate date null,
CheckOutDate date null,
RoomType long varchar null,
HotelName long varchar null,
ReservationId integer not null,
name long varchar null,
Hot_name long varchar null,
CustomerName long varchar null,
constraint PK_RESERVATION primary key clustered (ReservationId)
);
/*==============================================================*/
/* Table: Room */
/*==============================================================*/
create table Room
(
roomType long varchar not null,
quantity integer null,
constraint PK_ROOM primary key clustered (roomType)
);
/*==============================================================*/
/* Table: ShoppingBasket */
/*==============================================================*/
create table ShoppingBasket
(
CustomerName long varchar null,
ReservationId integer not null,
name long varchar null,
constraint PK_SHOPPINGBASKET primary key clustered (ReservationId)
);
alter table Hotel
add constraint FK_HOTEL_REFERENCE_ROOM foreign key (roomType)
references Room (roomType)
on update restrict
on delete restrict;
alter table Hotel
add constraint FK_HOTEL_REFERENCE_CITY foreign key (cityName)
references City (cityName)
on update restrict
on delete restrict;
alter table Reservation
add constraint FK_RESERVAT_REFERENCE_CUSTOMER foreign key (name)
references Customer (name)
on update restrict
on delete restrict;
alter table Reservation
add constraint FK_RESERVAT_REFERENCE_HOTEL foreign key (Hot_name)
references Hotel (name)
on update restrict
on delete restrict;
alter table ShoppingBasket
add constraint FK_SHOPPING_REFERENCE_RESERVAT foreign key (ReservationId)
references Reservation (ReservationId)
on update restrict
on delete restrict;
alter table ShoppingBasket
add constraint FK_SHOPPING_REFERENCE_CUSTOMER foreign key (name)
references Customer (name)
on update restrict
on delete restrict;
数据库逻辑模型于领域模型的异同:
领域模型是一个商业建模范畴的概念,它和软件开发无关系。即使一个企业不开发软件也应该有业务模型。
数据模型是系统设计以及实现的一部分。描述的是对用户需求在技术上的实现方法,用户不需要关心系统的数据模型,但必须关注领域模型。