homework5

homework5

标签(空格分隔): 系统分析与设计


a. 阅读 Asg_RH 文档,按用例构建领域模型。
寻找旅馆的用例对应的领域模型
这里写图片描述
b. 数据库建模(E-R 模型)
这里写图片描述
导出的mysql的脚本

/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2018/4/29 22:06:33                           */
/*==============================================================*/


drop table if exists creditCard;

drop table if exists hotel;

drop table if exists payment;

drop table if exists reservation;

drop table if exists room;

drop table if exists shoppingBasket;

drop table if exists travler;

/*==============================================================*/
/* Table: creditCard                                            */
/*==============================================================*/
create table creditCard
(
   type                 text,
   "NO."                int not null,
   sid                  int,
   tid                  int,
   securityCode         char(30),
   primary key ("NO.")
);

/*==============================================================*/
/* Table: hotel                                                 */
/*==============================================================*/
create table hotel
(
   hid                  int not null,
   rid                  int,
   tid                  int,
   name                 text,
   star                 text,
   hotIndex             varchar(40),
   city                 text,
   primary key (hid)
);

/*==============================================================*/
/* Table: payment                                               */
/*==============================================================*/
create table payment
(
   "NO."                int not null,
   sid                  int not null,
   numOfReservation     char(10),
   totalPrice           char(10),
   primary key ("NO.", sid)
);

/*==============================================================*/
/* Table: reservation                                           */
/*==============================================================*/
create table reservation
(
   rid                  int not null,
   sid                  int,
   tid                  int,
   arriavalDate         date,
   depatureDate         date,
   numOfRoom            int,
   numOfAdult           int,
   numOfChildren        int,
   primary key (rid)
);

/*==============================================================*/
/* Table: room                                                  */
/*==============================================================*/
create table room
(
   hid                  int,
   rid                  int,
   type                 text,
   price                float
);

/*==============================================================*/
/* Table: shoppingBasket                                        */
/*==============================================================*/
create table shoppingBasket
(
   sid                  int not null,
   "NO."                int,
   primary key (sid)
);

/*==============================================================*/
/* Table: travler                                               */
/*==============================================================*/
create table travler
(
   tid                  int not null,
   rid                  int,
   name                 text,
   "e-mail"             text,
   primary key (tid)
);

alter table creditCard add constraint FK_has2 foreign key (tid)
      references travler (tid) on delete restrict on update restrict;

alter table creditCard add constraint FK_use2 foreign key (sid)
      references shoppingBasket (sid) on delete restrict on update restrict;

alter table hotel add constraint FK_realtedTo foreign key (rid)
      references reservation (rid) on delete restrict on update restrict;

alter table hotel add constraint FK_search foreign key (tid)
      references travler (tid) on delete restrict on update restrict;

alter table payment add constraint FK_payment foreign key ("NO.")
      references creditCard ("NO.") on delete restrict on update restrict;

alter table payment add constraint FK_payment2 foreign key (sid)
      references shoppingBasket (sid) on delete restrict on update restrict;

alter table reservation add constraint FK_contain1 foreign key (sid)
      references shoppingBasket (sid) on delete restrict on update restrict;

alter table reservation add constraint FK_make foreign key (tid)
      references travler (tid) on delete restrict on update restrict;

alter table room add constraint FK_contain foreign key (rid)
      references reservation (rid) on delete restrict on update restrict;

alter table room add constraint FK_has foreign key (hid)
      references hotel (hid) on delete restrict on update restrict;

alter table shoppingBasket add constraint FK_use foreign key ("NO.")
      references creditCard ("NO.") on delete restrict on update restrict;

alter table travler add constraint FK_make2 foreign key (rid)
      references reservation (rid) on delete restrict on update restrict;

简单叙说数据库逻辑模型与领域模型的异同

大体上来讲数据库模型与领域模型是十分相似的,两者描述的东西都是大致相同的,但是使用了不同的方式以不同的角度来对系统进行描述,最终面对的受众不同。
数据库模型采用面向对象的设计方法,有效组织了业务数据,采取了统一的逻辑语言来描述业务,最终可以转换成正确的结果,其最终结果是为了生成相应的数据库中的各种模式和表因而更加偏向于形式化的数据表示。
而领域模型同样采用面向对象的设计方法,注重于业务流程的显示和用例的表示,注重于问题领域本身,更加注重业务本身及其职责。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值