系统分析与设计4

1、 领域建模

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

领域模型:

这里写图片描述

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

(1)系统的 E-R 模型(数据逻辑模型):
这里写图片描述

(2)导出 Mysql 物理数据库的脚本:

/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2018/4/28 10:59:48                           */
/*==============================================================*/


drop table if exists City_Table;

drop table if exists Customer_Table;

drop table if exists Hotel_Table;

drop table if exists Reservation_Table;

drop table if exists Room_Table;

drop table if exists Shopping_Busket_Table;

/*==============================================================*/
/* Table: City_Table                                            */
/*==============================================================*/
create table City_Table
(
   name                 longtext not null,
   primary key (name)
);

/*==============================================================*/
/* Table: Customer_Table                                        */
/*==============================================================*/
create table Customer_Table
(
   name                 longtext not null,
   phone                longtext,
   email                longtext,
   primary key (name)
);

/*==============================================================*/
/* Table: Hotel_Table                                           */
/*==============================================================*/
create table Hotel_Table
(
   name                 longtext not null,
   roomType             longtext,
   cityName             longtext not null,
   primary key (name)
);

/*==============================================================*/
/* Table: Reservation_Table                                     */
/*==============================================================*/
create table Reservation_Table
(
   CheckInDate          date,
   CheckOutDate         date,
   HotelName            longtext,
   RoomType             longtext,
   Id                   int not null,
   CustomerName         varchar(1),
   primary key (Id)
);

/*==============================================================*/
/* Table: Room_Table                                            */
/*==============================================================*/
create table Room_Table
(
   type                 longtext not null,
   amount               int,
   primary key (type)
);

/*==============================================================*/
/* Table: Shopping_Busket_Table                                 */
/*==============================================================*/
create table Shopping_Busket_Table
(
   Owner_name           longtext,
   ReservationId        int
);

alter table Hotel_Table add constraint FK_Reference_6 foreign key (cityName)
      references City_Table (name) on delete restrict on update restrict;

alter table Hotel_Table add constraint FK_Reference_8 foreign key (roomType)
      references Room_Table (type) on delete restrict on update restrict;

alter table Reservation_Table add constraint FK_Reference_3 foreign key (HotelName)
      references Hotel_Table (name) on delete restrict on update restrict;

alter table Reservation_Table add constraint FK_Reference_7 foreign key (CustomerName)
      references Customer_Table (name) on delete restrict on update restrict;

alter table Shopping_Busket_Table add constraint FK_Reference_2 foreign key (ReservationId)
      references Reservation_Table (Id) on delete restrict on update restrict;

alter table Shopping_Busket_Table add constraint FK_Reference_9 foreign key (Owner_name)
      references Customer_Table (name) on delete restrict on update restrict;

(3)数据库逻辑模型与领域模型的异同:
逻辑数据模型 (LogicDataModel,LDM)是一种图形化的展现方式,一般采用面向对象的设计方法,有效组织来源多样的各种业务数据,使用统一的逻辑语言描述业务。

领域模型是对领域内的概念类或现实世界中对象的可视化表示。又称概念模型、领域对象模型、分析对象模型。它专注于分析问题领域本身,发掘重要的业务领域概念,并建立业务领域概念之间的关系。

用户不需要关心系统的数据模型,但是必须关注领域模型,因为领域模型反映的是问题域的相关业务概念以及其关系,领域模型是用户业务描述的高度抽象,来源于业务需求的描述,同时又可以帮助用户和需求分析人员更好的理解业务需求。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值