系统分析与设计——lesson7

本文介绍了系统分析与设计过程中的领域建模和数据库E-R模型构建。在领域建模中,通过阅读Asg_RH文档,按照用例构建了领域模型,区分了实体(E)和中介实体(M)。在数据库建模中,使用PowerDesigner或OpenSystemArchitect工具创建了E-R模型,并导出了MySQL物理数据库脚本。同时,阐述了领域模型和数据库逻辑模型的主要异同,强调领域模型关注功能全面性,而数据库模型更注重数据约束。
摘要由CSDN通过智能技术生成

1、 领域建模

  • a. 阅读 Asg_RH 文档,按用例构建领域模型。
    • 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸
    • 说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体)
      • 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关
      • 在 java web 应用中,E 一般与数据库构建有关, M 一般与 session 有关
  • b. 数据库建模(E-R 模型)
    - 按 Task 3 要求,给出系统的 E-R 模型(数据逻辑模型)
    - 建模工具 PowerDesigner(简称PD) 或开源工具 OpenSystemArchitect
    - 不负责的链接 http://www.cnblogs.com/mcgrady/archive/2013/05/25/3098588.html
    - 导出 Mysql 物理数据库的脚本
    - 简单叙说 数据库逻辑模型 与 领域模型 的异同

a.



b.


/*==============================================================*/
/* DBMS name:      Sybase SQL Anywhere 12                       */
/* Created on:     2018/4/29 0:57:49                            */
/*==============================================================*/




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_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_RESERVAT_REFERENCE_PAYMENT') then
    alter table reservation
       delete foreign key FK_RESERVAT_REFERENCE_PAYMENT
end if;


if exists(select 1 from sys.sysforeignkey where role='FK_RESERVAT_REFERENCE_TRAVELLE') then
    alter table reservation
       delete foreign key FK_RESERVAT_REFERENCE_TRAVELLE
end if;


if exists(select 1 from sys.sysforeignkey where role='FK_TRAVELLE_REFERENCE_PAYMENT') then
    alter table traveller
       delete foreign key FK_TRAVELLE_REFERENCE_PAYMENT
end if;


drop table if exists hotel;


drop table if exists payment;


drop table if exists reservation;


drop table if exists room;


drop table if exists traveller;


/*==============================================================*/
/* Table: hotel                                                 */
/*==============================================================*/
create table hotel 
(
   name                 text                           not null,
   location             text                           not null,
   roomNum              int                            not null,
   phoneNum             int                            not null,
   constraint PK_HOTEL primary key clustered (name)
);


/*==============================================================*/
/* Table: payment                                               */
/*==============================================================*/
create table payment 
(
   payId                int                            not null,
   price                float                          not null,
   payTime              datetime                       not null,
   constraint PK_PAYMENT primary key clustered (payId)
);


/*==============================================================*/
/* Table: reservation                                           */
/*==============================================================*/
create table reservation 
(
   reservationId        int                            not null,
   name                 text                           null,
   payId                int                            null,
   accountId            text                           null,
   startDate            date                           not null,
   endDate              date                           not null,
   travellerId          text                           not null,
   travellerPhone       int                            not null,
   price                float                          not null,
   state                text                           not null,
   constraint PK_RESERVATION primary key clustered (reservationId)
);


/*==============================================================*/
/* Table: room                                                  */
/*==============================================================*/
create table room 
(
   roomNum              int                            not null,
   state                char                           not null,
   constraint PK_ROOM primary key clustered (roomNum)
);


/*==============================================================*/
/* Table: traveller                                             */
/*==============================================================*/
create table traveller 
(
   accountId            text                           not null,
   payId                int                            null,
   password             text                           not null,
   phoneNum             int                            not null,
   constraint PK_TRAVELLER primary key clustered (accountId)
);


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


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


alter table reservation
   add constraint FK_RESERVAT_REFERENCE_PAYMENT foreign key (payId)
      references payment (payId)
      on update restrict
      on delete restrict;


alter table reservation
   add constraint FK_RESERVAT_REFERENCE_TRAVELLE foreign key (accountId)
      references traveller (accountId)
      on update restrict
      on delete restrict;


alter table traveller
   add constraint FK_TRAVELLE_REFERENCE_PAYMENT foreign key (payId)
      references payment (payId)
      on update restrict
      on delete restrict;

在实体的概念上相似,都运用了实体间的关系,实体都有属性,都能简明清晰地表明数据表之间的关系。

领域模型更注重全面的表达功能,数据库更关注数据,并且存在主键外键等约束信息。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值