系统分析与设计——作业5

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)数据库逻辑模型 与 领域模型 的异同:

数据库逻辑模型是一个抽象的宏观层次的业务模型,在概念模型中最重要的对象是实体和关系。

领域模型是一个商业建模范畴的概念,他和软件开发并无一丝一毫的关系,即使一个企业他不开发软件,他也具备他的业务模型,所有的同行业的企业他们的业务模型必定有非常大的共性和内在的规律性,由这个行业内的各个企业的业务模型再向上抽象出来整个行业的业务模型,这个东西即“领域模型”。

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

posted @ 2018-04-27 22:18  fengzw  阅读(526)  评论(0编辑  收藏  举报