系统分析与设计 Homework(lesson 7)

系统分析与设计 Homework(lesson 7)


领域建模

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

  • 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸
  • 说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体)
    • 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关
    • 在 java web 应用中,E 一般与数据库构建有关, M 一般与 session 有关

RH_DM

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

  • 按 Task 3 要求,给出系统的 E-R 模型(数据逻辑模型)
  • 建模工具 PowerDesigner(简称PD) 或开源工具 OpenSystemArchitect
    RH(ER)
    RH_ERModel

  • 导出 Mysql 物理数据库的脚本

               /*==============================================================*/
    /* DBMS name:      MySQL 5.0                                    */
    /* Created on:     2018-04-29 12:14:58                          */
    /*==============================================================*/
    
    
    drop table if exists Hotel;
    
    drop table if exists Location;
    
    drop table if exists Reservation;
    
    drop table if exists Room;
    
    drop table if exists Traveler;
    
    /*==============================================================*/
    /* Table: Hotel                                                 */
    /*==============================================================*/
    create table Hotel
    (
      hotel_id             int not null,
      lid                  int not null,
      Region               char(256),
      star                 int,
      address              char(256),
      primary key (hotel_id)
    );
    
    /*==============================================================*/
    /* Table: Location                                              */
    /*==============================================================*/
    create table Location
    (
      lid                  int not null,
      Region               char(256),
      Region_code          int,
      City                 char(256),
      City_code            int,
      City_Capital         bool,
      Town                 char(256),
      primary key (lid)
    );
    
    /*==============================================================*/
    /* Table: Reservation                                           */
    /*==============================================================*/
    create table Reservation
    (
      reserve_id           int not null,
      user_id              int not null,
      hotel_id             int not null,
      check_in_date        date,
      check_out_date       date,
      nights_num           int,
      room_num             int,
      total_due            numeric(8,0),
      isPay                bool,
      make_time            datetime,
      primary key (reserve_id)
    );
    
    /*==============================================================*/
    /* Table: Room                                                  */
    /*==============================================================*/
    create table Room
    (
      room_id              int not null,
      hotel_id             int not null,
      reserve_id           int,
      type                 char(256),
      list_price           int,
      isAvailable          bool,
      primary key (room_id)
    );
    
    /*==============================================================*/
    /* Table: Traveler                                              */
    /*==============================================================*/
    create table Traveler
    (
      user_id              int not null,
      "full name"          char(256),
      "email address"      char(256),
      primary key (user_id)
    );
    
    alter table Hotel add constraint FK_exist foreign key (lid)
         references Location (lid) on delete restrict on update restrict;
    
    alter table Reservation add constraint FK_at foreign key (hotel_id)
         references Hotel (hotel_id) on delete restrict on update restrict;
    
    alter table Reservation add constraint FK_make foreign key (user_id)
         references Traveler (user_id) on delete restrict on update restrict;
    
    alter table Room add constraint FK_Has foreign key (hotel_id)
         references Hotel (hotel_id) on delete restrict on update restrict;
    
    alter table Room add constraint FK_reserve foreign key (reserve_id)
         references Reservation (reserve_id) on delete restrict on update restrict;
  • 简单叙说数据库逻辑模型领域模型的异同

    • 相同点
      • 都是反映不同实体之间的关系
      • 常用于系统分析与设计,特别是涉及数据表的设计
    • 不同点
      • 领域模型反映的是问题域的相关业务概念以及其关系,来源于业务需求的描述,同时可帮助用户和需求分析人员更好的理解业务需求
      • 数据库逻辑模型适用于软件开发者,需考虑系统内数据的具体存放方式,比领域模型考虑方面需要更加细致
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值