zoukankan      html  css  js  c++  java
  • 作业5

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

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

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

    ER图

    数据库脚本

    -- MySQL dump 10.13  Distrib 8.0.11, for Win64 (x86_64)
    --
    -- Host: localhost    Database: mydb
    -- ------------------------------------------------------
    -- Server version	8.0.11
    
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
     SET NAMES utf8mb4 ;
    /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
    /*!40103 SET TIME_ZONE='+00:00' */;
    /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
    /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
    /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
    
    --
    -- Table structure for table `hotel`
    --
    
    DROP TABLE IF EXISTS `hotel`;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
     SET character_set_client = utf8mb4 ;
    CREATE TABLE `hotel` (
      `id` int(11) NOT NULL,
      `name` varchar(45) DEFAULT NULL,
      `location_code` int(11) NOT NULL,
      PRIMARY KEY (`id`,`location_code`),
      KEY `fk_hotel_location1_idx` (`location_code`),
      CONSTRAINT `fk_hotel_location1` FOREIGN KEY (`location_code`) REFERENCES `location` (`code`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Dumping data for table `hotel`
    --
    
    LOCK TABLES `hotel` WRITE;
    /*!40000 ALTER TABLE `hotel` DISABLE KEYS */;
    /*!40000 ALTER TABLE `hotel` ENABLE KEYS */;
    UNLOCK TABLES;
    
    --
    -- Table structure for table `location`
    --
    
    DROP TABLE IF EXISTS `location`;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
     SET character_set_client = utf8mb4 ;
    CREATE TABLE `location` (
      `code` int(11) NOT NULL,
      `name` varchar(45) DEFAULT NULL,
      `hot` int(11) DEFAULT NULL,
      PRIMARY KEY (`code`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Dumping data for table `location`
    --
    
    LOCK TABLES `location` WRITE;
    /*!40000 ALTER TABLE `location` DISABLE KEYS */;
    /*!40000 ALTER TABLE `location` ENABLE KEYS */;
    UNLOCK TABLES;
    
    --
    -- Table structure for table `reservation`
    --
    
    DROP TABLE IF EXISTS `reservation`;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
     SET character_set_client = utf8mb4 ;
    CREATE TABLE `reservation` (
      `id` int(11) NOT NULL,
      `price` float DEFAULT NULL,
      `date` date DEFAULT NULL,
      `traveler_id` int(11) NOT NULL,
      PRIMARY KEY (`id`,`traveler_id`),
      KEY `fk_reservation_traveler1_idx` (`traveler_id`),
      CONSTRAINT `fk_reservation_traveler1` FOREIGN KEY (`traveler_id`) REFERENCES `traveler` (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Dumping data for table `reservation`
    --
    
    LOCK TABLES `reservation` WRITE;
    /*!40000 ALTER TABLE `reservation` DISABLE KEYS */;
    /*!40000 ALTER TABLE `reservation` ENABLE KEYS */;
    UNLOCK TABLES;
    
    --
    -- Table structure for table `room`
    --
    
    DROP TABLE IF EXISTS `room`;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
     SET character_set_client = utf8mb4 ;
    CREATE TABLE `room` (
      `id` int(11) NOT NULL,
      `price` float DEFAULT NULL,
      `isVal` tinyint(4) DEFAULT NULL,
      `date` date DEFAULT NULL,
      `reservation_id` int(11) NOT NULL,
      `hotel_id` int(11) NOT NULL,
      PRIMARY KEY (`id`,`reservation_id`,`hotel_id`),
      KEY `fk_room_reservation1_idx` (`reservation_id`),
      KEY `fk_room_hotel1_idx` (`hotel_id`),
      CONSTRAINT `fk_room_hotel1` FOREIGN KEY (`hotel_id`) REFERENCES `hotel` (`id`),
      CONSTRAINT `fk_room_reservation1` FOREIGN KEY (`reservation_id`) REFERENCES `reservation` (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Dumping data for table `room`
    --
    
    LOCK TABLES `room` WRITE;
    /*!40000 ALTER TABLE `room` DISABLE KEYS */;
    /*!40000 ALTER TABLE `room` ENABLE KEYS */;
    UNLOCK TABLES;
    
    --
    -- Table structure for table `traveler`
    --
    
    DROP TABLE IF EXISTS `traveler`;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
     SET character_set_client = utf8mb4 ;
    CREATE TABLE `traveler` (
      `id` int(11) NOT NULL,
      `name` varchar(45) DEFAULT NULL,
      `address` varchar(45) DEFAULT NULL,
      `phone_number` int(11) DEFAULT NULL,
      `postcode` int(6) DEFAULT NULL,
      `country` varchar(45) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Dumping data for table `traveler`
    --
    
    LOCK TABLES `traveler` WRITE;
    /*!40000 ALTER TABLE `traveler` DISABLE KEYS */;
    /*!40000 ALTER TABLE `traveler` ENABLE KEYS */;
    UNLOCK TABLES;
    /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
    
    /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
    /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
    /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
    
    -- Dump completed on 2018-04-28  15:09:57
    
    

    数据库逻辑模型 与 领域模型 的异同

      • 领域模型主要是需求阶段产生的产物,通过对需求进行分析总结提炼出来的用以描述业务需求的概念性产物。
      • 数据库逻辑模型更偏向开发过程,考虑到了数据库层面真正要存储的表格等等,便于后续的程序设计。
      • 都将软件的概念类用图形化表示出来了,都展现了各个概念类的名字、属性以及彼此之间的关系。
  • 相关阅读:
    js基础整理总结
    pyinstaller打包django项目成exe以及遇到的一些问题
    Django对接SQL Server服务
    死锁
    python 之路
    Python注释
    Django2.1迁移数据库出错
    一行 Python 代码实现并行
    【转载】Python 类定义与对象
    关于盒模型布局在UC上的兼容处理
  • 原文地址:https://www.cnblogs.com/iamxiaoyubei/p/8972407.html
Copyright © 2011-2022 走看看