软件工程:结构化分析方法

📌目录



⚖️ 结构化分析方法:自顶向下的需求分析技术

结构化分析(Structured Analysis, SA)是一种经典的软件需求分析方法,它采用自顶向下、逐步求精的策略,通过数据流图、数据字典等工具建立系统的逻辑模型。本文将详细介绍结构化分析方法的基本概念、工具和实施步骤。

🎯 一、结构化分析概述

(一)结构化分析的定义

结构化分析(SA) 是一种面向数据流的需求分析方法,由Yourdon和Constantine于1979年提出。

SA概念:
#mermaid-svg-q2lHVClb1LemavQo{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-q2lHVClb1LemavQo .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-q2lHVClb1LemavQo .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-q2lHVClb1LemavQo .error-icon{fill:#552222;}#mermaid-svg-q2lHVClb1LemavQo .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-q2lHVClb1LemavQo .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-q2lHVClb1LemavQo .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-q2lHVClb1LemavQo .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-q2lHVClb1LemavQo .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-q2lHVClb1LemavQo .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-q2lHVClb1LemavQo .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-q2lHVClb1LemavQo .marker{fill:#333333;stroke:#333333;}#mermaid-svg-q2lHVClb1LemavQo .marker.cross{stroke:#333333;}#mermaid-svg-q2lHVClb1LemavQo svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-q2lHVClb1LemavQo p{margin:0;}#mermaid-svg-q2lHVClb1LemavQo .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-q2lHVClb1LemavQo .cluster-label text{fill:#333;}#mermaid-svg-q2lHVClb1LemavQo .cluster-label span{color:#333;}#mermaid-svg-q2lHVClb1LemavQo .cluster-label span p{background-color:transparent;}#mermaid-svg-q2lHVClb1LemavQo .label text,#mermaid-svg-q2lHVClb1LemavQo span{fill:#333;color:#333;}#mermaid-svg-q2lHVClb1LemavQo .node rect,#mermaid-svg-q2lHVClb1LemavQo .node circle,#mermaid-svg-q2lHVClb1LemavQo .node ellipse,#mermaid-svg-q2lHVClb1LemavQo .node polygon,#mermaid-svg-q2lHVClb1LemavQo .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-q2lHVClb1LemavQo .rough-node .label text,#mermaid-svg-q2lHVClb1LemavQo .node .label text,#mermaid-svg-q2lHVClb1LemavQo .image-shape .label,#mermaid-svg-q2lHVClb1LemavQo .icon-shape .label{text-anchor:middle;}#mermaid-svg-q2lHVClb1LemavQo .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-q2lHVClb1LemavQo .rough-node .label,#mermaid-svg-q2lHVClb1LemavQo .node .label,#mermaid-svg-q2lHVClb1LemavQo .image-shape .label,#mermaid-svg-q2lHVClb1LemavQo .icon-shape .label{text-align:center;}#mermaid-svg-q2lHVClb1LemavQo .node.clickable{cursor:pointer;}#mermaid-svg-q2lHVClb1LemavQo .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-q2lHVClb1LemavQo .arrowheadPath{fill:#333333;}#mermaid-svg-q2lHVClb1LemavQo .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-q2lHVClb1LemavQo .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-q2lHVClb1LemavQo .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-q2lHVClb1LemavQo .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-q2lHVClb1LemavQo .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-q2lHVClb1LemavQo .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-q2lHVClb1LemavQo .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-q2lHVClb1LemavQo .cluster text{fill:#333;}#mermaid-svg-q2lHVClb1LemavQo .cluster span{color:#333;}#mermaid-svg-q2lHVClb1LemavQo div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-q2lHVClb1LemavQo .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-q2lHVClb1LemavQo rect.text{fill:none;stroke-width:0;}#mermaid-svg-q2lHVClb1LemavQo .icon-shape,#mermaid-svg-q2lHVClb1LemavQo .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-q2lHVClb1LemavQo .icon-shape p,#mermaid-svg-q2lHVClb1LemavQo .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-q2lHVClb1LemavQo .icon-shape .label rect,#mermaid-svg-q2lHVClb1LemavQo .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-q2lHVClb1LemavQo .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-q2lHVClb1LemavQo .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-q2lHVClb1LemavQo :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 结构化分析
自顶向下
逐步求精
建立模型
从顶层开始
逐层分解
细化功能
细化数据
数据流图
数据字典
加工说明

(二)结构化分析的特点

SA特点:

特点 说明
面向数据流 以数据流为中心进行分析
自顶向下 从顶层逐步分解
逐步求精 逐层细化功能
图形化 使用图形工具描述
形式化 有严格的规范和标准

(三)SA与其他方法的比较

方法比较:

方法 核心 工具 适用场景
结构化分析 数据流 DFD、数据字典 数据处理系统
面向对象分析 对象 UML图 复杂系统
原型法 原型 原型工具 需求不明确

📦 二、结构化分析的基本步骤

(一)分析步骤

SA步骤:
#mermaid-svg-awUkWyHYFsWEr1HY{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-awUkWyHYFsWEr1HY .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-awUkWyHYFsWEr1HY .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-awUkWyHYFsWEr1HY .error-icon{fill:#552222;}#mermaid-svg-awUkWyHYFsWEr1HY .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-awUkWyHYFsWEr1HY .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-awUkWyHYFsWEr1HY .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-awUkWyHYFsWEr1HY .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-awUkWyHYFsWEr1HY .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-awUkWyHYFsWEr1HY .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-awUkWyHYFsWEr1HY .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-awUkWyHYFsWEr1HY .marker{fill:#333333;stroke:#333333;}#mermaid-svg-awUkWyHYFsWEr1HY .marker.cross{stroke:#333333;}#mermaid-svg-awUkWyHYFsWEr1HY svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-awUkWyHYFsWEr1HY p{margin:0;}#mermaid-svg-awUkWyHYFsWEr1HY .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-awUkWyHYFsWEr1HY .cluster-label text{fill:#333;}#mermaid-svg-awUkWyHYFsWEr1HY .cluster-label span{color:#333;}#mermaid-svg-awUkWyHYFsWEr1HY .cluster-label span p{background-color:transparent;}#mermaid-svg-awUkWyHYFsWEr1HY .label text,#mermaid-svg-awUkWyHYFsWEr1HY span{fill:#333;color:#333;}#mermaid-svg-awUkWyHYFsWEr1HY .node rect,#mermaid-svg-awUkWyHYFsWEr1HY .node circle,#mermaid-svg-awUkWyHYFsWEr1HY .node ellipse,#mermaid-svg-awUkWyHYFsWEr1HY .node polygon,#mermaid-svg-awUkWyHYFsWEr1HY .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-awUkWyHYFsWEr1HY .rough-node .label text,#mermaid-svg-awUkWyHYFsWEr1HY .node .label text,#mermaid-svg-awUkWyHYFsWEr1HY .image-shape .label,#mermaid-svg-awUkWyHYFsWEr1HY .icon-shape .label{text-anchor:middle;}#mermaid-svg-awUkWyHYFsWEr1HY .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-awUkWyHYFsWEr1HY .rough-node .label,#mermaid-svg-awUkWyHYFsWEr1HY .node .label,#mermaid-svg-awUkWyHYFsWEr1HY .image-shape .label,#mermaid-svg-awUkWyHYFsWEr1HY .icon-shape .label{text-align:center;}#mermaid-svg-awUkWyHYFsWEr1HY .node.clickable{cursor:pointer;}#mermaid-svg-awUkWyHYFsWEr1HY .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-awUkWyHYFsWEr1HY .arrowheadPath{fill:#333333;}#mermaid-svg-awUkWyHYFsWEr1HY .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-awUkWyHYFsWEr1HY .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-awUkWyHYFsWEr1HY .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-awUkWyHYFsWEr1HY .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-awUkWyHYFsWEr1HY .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-awUkWyHYFsWEr1HY .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-awUkWyHYFsWEr1HY .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-awUkWyHYFsWEr1HY .cluster text{fill:#333;}#mermaid-svg-awUkWyHYFsWEr1HY .cluster span{color:#333;}#mermaid-svg-awUkWyHYFsWEr1HY div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-awUkWyHYFsWEr1HY .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-awUkWyHYFsWEr1HY rect.text{fill:none;stroke-width:0;}#mermaid-svg-awUkWyHYFsWEr1HY .icon-shape,#mermaid-svg-awUkWyHYFsWEr1HY .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-awUkWyHYFsWEr1HY .icon-shape p,#mermaid-svg-awUkWyHYFsWEr1HY .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-awUkWyHYFsWEr1HY .icon-shape .label rect,#mermaid-svg-awUkWyHYFsWEr1HY .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-awUkWyHYFsWEr1HY .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-awUkWyHYFsWEr1HY .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-awUkWyHYFsWEr1HY :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 了解现状
建立顶层DFD
逐层分解
定义数据字典
编写加工说明
建立其他模型
需求验证

步骤详解:

步骤 任务 产出
了解现状 了解现有系统 现状分析报告
建立顶层DFD 建立顶层数据流图 顶层DFD
逐层分解 逐层分解功能 多层DFD
定义数据字典 定义数据元素 数据字典
编写加工说明 描述加工逻辑 加工说明
建立其他模型 建立ER图、状态图等 其他模型
需求验证 验证需求正确性 验证报告

(二)分析策略

分析策略:
#mermaid-svg-ZOBtIcmu5Q7DxGJ1{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .error-icon{fill:#552222;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .marker.cross{stroke:#333333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 p{margin:0;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .cluster-label text{fill:#333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .cluster-label span{color:#333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .cluster-label span p{background-color:transparent;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .label text,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 span{fill:#333;color:#333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .node rect,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .node circle,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .node ellipse,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .node polygon,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .rough-node .label text,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .node .label text,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .image-shape .label,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .icon-shape .label{text-anchor:middle;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .rough-node .label,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .node .label,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .image-shape .label,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .icon-shape .label{text-align:center;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .node.clickable{cursor:pointer;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .arrowheadPath{fill:#333333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .cluster text{fill:#333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .cluster span{color:#333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 rect.text{fill:none;stroke-width:0;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .icon-shape,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .icon-shape p,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .icon-shape .label rect,#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-ZOBtIcmu5Q7DxGJ1 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 分析策略
自顶向下
由外向内
分层细化
从顶层开始
逐层分解
从外部开始
向内扩展
逐层细化
逐步完善

🌐 三、数据流图(DFD)

(一)数据流图概述

数据流图(Data Flow Diagram, DFD) 是结构化分析的核心工具,它描述系统的数据流动和处理过程。

DFD组成:
#mermaid-svg-0pgcUdYLtvZkjwtJ{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-0pgcUdYLtvZkjwtJ .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-0pgcUdYLtvZkjwtJ .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-0pgcUdYLtvZkjwtJ .error-icon{fill:#552222;}#mermaid-svg-0pgcUdYLtvZkjwtJ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-0pgcUdYLtvZkjwtJ .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-0pgcUdYLtvZkjwtJ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-0pgcUdYLtvZkjwtJ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-0pgcUdYLtvZkjwtJ .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-0pgcUdYLtvZkjwtJ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-0pgcUdYLtvZkjwtJ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-0pgcUdYLtvZkjwtJ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-0pgcUdYLtvZkjwtJ .marker.cross{stroke:#333333;}#mermaid-svg-0pgcUdYLtvZkjwtJ svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-0pgcUdYLtvZkjwtJ p{margin:0;}#mermaid-svg-0pgcUdYLtvZkjwtJ .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-0pgcUdYLtvZkjwtJ .cluster-label text{fill:#333;}#mermaid-svg-0pgcUdYLtvZkjwtJ .cluster-label span{color:#333;}#mermaid-svg-0pgcUdYLtvZkjwtJ .cluster-label span p{background-color:transparent;}#mermaid-svg-0pgcUdYLtvZkjwtJ .label text,#mermaid-svg-0pgcUdYLtvZkjwtJ span{fill:#333;color:#333;}#mermaid-svg-0pgcUdYLtvZkjwtJ .node rect,#mermaid-svg-0pgcUdYLtvZkjwtJ .node circle,#mermaid-svg-0pgcUdYLtvZkjwtJ .node ellipse,#mermaid-svg-0pgcUdYLtvZkjwtJ .node polygon,#mermaid-svg-0pgcUdYLtvZkjwtJ .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-0pgcUdYLtvZkjwtJ .rough-node .label text,#mermaid-svg-0pgcUdYLtvZkjwtJ .node .label text,#mermaid-svg-0pgcUdYLtvZkjwtJ .image-shape .label,#mermaid-svg-0pgcUdYLtvZkjwtJ .icon-shape .label{text-anchor:middle;}#mermaid-svg-0pgcUdYLtvZkjwtJ .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-0pgcUdYLtvZkjwtJ .rough-node .label,#mermaid-svg-0pgcUdYLtvZkjwtJ .node .label,#mermaid-svg-0pgcUdYLtvZkjwtJ .image-shape .label,#mermaid-svg-0pgcUdYLtvZkjwtJ .icon-shape .label{text-align:center;}#mermaid-svg-0pgcUdYLtvZkjwtJ .node.clickable{cursor:pointer;}#mermaid-svg-0pgcUdYLtvZkjwtJ .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-0pgcUdYLtvZkjwtJ .arrowheadPath{fill:#333333;}#mermaid-svg-0pgcUdYLtvZkjwtJ .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-0pgcUdYLtvZkjwtJ .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-0pgcUdYLtvZkjwtJ .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-0pgcUdYLtvZkjwtJ .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-0pgcUdYLtvZkjwtJ .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-0pgcUdYLtvZkjwtJ .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-0pgcUdYLtvZkjwtJ .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-0pgcUdYLtvZkjwtJ .cluster text{fill:#333;}#mermaid-svg-0pgcUdYLtvZkjwtJ .cluster span{color:#333;}#mermaid-svg-0pgcUdYLtvZkjwtJ div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-0pgcUdYLtvZkjwtJ .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-0pgcUdYLtvZkjwtJ rect.text{fill:none;stroke-width:0;}#mermaid-svg-0pgcUdYLtvZkjwtJ .icon-shape,#mermaid-svg-0pgcUdYLtvZkjwtJ .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-0pgcUdYLtvZkjwtJ .icon-shape p,#mermaid-svg-0pgcUdYLtvZkjwtJ .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-0pgcUdYLtvZkjwtJ .icon-shape .label rect,#mermaid-svg-0pgcUdYLtvZkjwtJ .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-0pgcUdYLtvZkjwtJ .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-0pgcUdYLtvZkjwtJ .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-0pgcUdYLtvZkjwtJ :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} DFD组成
外部实体
加工
数据存储
数据流
数据来源/去向
矩形表示
数据处理
圆形表示
数据存储
双线表示
数据流动
箭头表示

DFD符号:

符号 名称 说明 图形
□ 外部实体 数据来源或去向 矩形
○ 加工 数据处理 圆形
= 数据存储 数据存储 双线/开口矩形
→ 数据流 数据流动 箭头

(二)数据流图的层次

DFD层次:
#mermaid-svg-vRQ4yajgY6D65DwC{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-vRQ4yajgY6D65DwC .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-vRQ4yajgY6D65DwC .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-vRQ4yajgY6D65DwC .error-icon{fill:#552222;}#mermaid-svg-vRQ4yajgY6D65DwC .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-vRQ4yajgY6D65DwC .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-vRQ4yajgY6D65DwC .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-vRQ4yajgY6D65DwC .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-vRQ4yajgY6D65DwC .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-vRQ4yajgY6D65DwC .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-vRQ4yajgY6D65DwC .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-vRQ4yajgY6D65DwC .marker{fill:#333333;stroke:#333333;}#mermaid-svg-vRQ4yajgY6D65DwC .marker.cross{stroke:#333333;}#mermaid-svg-vRQ4yajgY6D65DwC svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-vRQ4yajgY6D65DwC p{margin:0;}#mermaid-svg-vRQ4yajgY6D65DwC .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-vRQ4yajgY6D65DwC .cluster-label text{fill:#333;}#mermaid-svg-vRQ4yajgY6D65DwC .cluster-label span{color:#333;}#mermaid-svg-vRQ4yajgY6D65DwC .cluster-label span p{background-color:transparent;}#mermaid-svg-vRQ4yajgY6D65DwC .label text,#mermaid-svg-vRQ4yajgY6D65DwC span{fill:#333;color:#333;}#mermaid-svg-vRQ4yajgY6D65DwC .node rect,#mermaid-svg-vRQ4yajgY6D65DwC .node circle,#mermaid-svg-vRQ4yajgY6D65DwC .node ellipse,#mermaid-svg-vRQ4yajgY6D65DwC .node polygon,#mermaid-svg-vRQ4yajgY6D65DwC .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-vRQ4yajgY6D65DwC .rough-node .label text,#mermaid-svg-vRQ4yajgY6D65DwC .node .label text,#mermaid-svg-vRQ4yajgY6D65DwC .image-shape .label,#mermaid-svg-vRQ4yajgY6D65DwC .icon-shape .label{text-anchor:middle;}#mermaid-svg-vRQ4yajgY6D65DwC .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-vRQ4yajgY6D65DwC .rough-node .label,#mermaid-svg-vRQ4yajgY6D65DwC .node .label,#mermaid-svg-vRQ4yajgY6D65DwC .image-shape .label,#mermaid-svg-vRQ4yajgY6D65DwC .icon-shape .label{text-align:center;}#mermaid-svg-vRQ4yajgY6D65DwC .node.clickable{cursor:pointer;}#mermaid-svg-vRQ4yajgY6D65DwC .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-vRQ4yajgY6D65DwC .arrowheadPath{fill:#333333;}#mermaid-svg-vRQ4yajgY6D65DwC .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-vRQ4yajgY6D65DwC .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-vRQ4yajgY6D65DwC .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-vRQ4yajgY6D65DwC .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-vRQ4yajgY6D65DwC .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-vRQ4yajgY6D65DwC .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-vRQ4yajgY6D65DwC .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-vRQ4yajgY6D65DwC .cluster text{fill:#333;}#mermaid-svg-vRQ4yajgY6D65DwC .cluster span{color:#333;}#mermaid-svg-vRQ4yajgY6D65DwC div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-vRQ4yajgY6D65DwC .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-vRQ4yajgY6D65DwC rect.text{fill:none;stroke-width:0;}#mermaid-svg-vRQ4yajgY6D65DwC .icon-shape,#mermaid-svg-vRQ4yajgY6D65DwC .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-vRQ4yajgY6D65DwC .icon-shape p,#mermaid-svg-vRQ4yajgY6D65DwC .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-vRQ4yajgY6D65DwC .icon-shape .label rect,#mermaid-svg-vRQ4yajgY6D65DwC .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-vRQ4yajgY6D65DwC .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-vRQ4yajgY6D65DwC .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-vRQ4yajgY6D65DwC :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} DFD层次
顶层DFD
0层DFD
1层DFD
2层DFD
系统整体
一个加工
主要功能
多个加工
子功能
详细加工
基本加工
最详细

层次说明:

层次 内容 加工数量
顶层 系统整体 1个
0层 主要功能 3-9个
1层 子功能 每个分解为3-9个
2层 基本加工 不能再分解

(三)顶层数据流图

顶层DFD:

顶层DFD描述系统的整体轮廓,只有一个加工。

示例:
#mermaid-svg-JRaK8YxLfeyxs8Ew{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-JRaK8YxLfeyxs8Ew .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-JRaK8YxLfeyxs8Ew .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-JRaK8YxLfeyxs8Ew .error-icon{fill:#552222;}#mermaid-svg-JRaK8YxLfeyxs8Ew .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-JRaK8YxLfeyxs8Ew .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-JRaK8YxLfeyxs8Ew .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-JRaK8YxLfeyxs8Ew .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-JRaK8YxLfeyxs8Ew .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-JRaK8YxLfeyxs8Ew .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-JRaK8YxLfeyxs8Ew .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-JRaK8YxLfeyxs8Ew .marker{fill:#333333;stroke:#333333;}#mermaid-svg-JRaK8YxLfeyxs8Ew .marker.cross{stroke:#333333;}#mermaid-svg-JRaK8YxLfeyxs8Ew svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-JRaK8YxLfeyxs8Ew p{margin:0;}#mermaid-svg-JRaK8YxLfeyxs8Ew .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-JRaK8YxLfeyxs8Ew .cluster-label text{fill:#333;}#mermaid-svg-JRaK8YxLfeyxs8Ew .cluster-label span{color:#333;}#mermaid-svg-JRaK8YxLfeyxs8Ew .cluster-label span p{background-color:transparent;}#mermaid-svg-JRaK8YxLfeyxs8Ew .label text,#mermaid-svg-JRaK8YxLfeyxs8Ew span{fill:#333;color:#333;}#mermaid-svg-JRaK8YxLfeyxs8Ew .node rect,#mermaid-svg-JRaK8YxLfeyxs8Ew .node circle,#mermaid-svg-JRaK8YxLfeyxs8Ew .node ellipse,#mermaid-svg-JRaK8YxLfeyxs8Ew .node polygon,#mermaid-svg-JRaK8YxLfeyxs8Ew .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-JRaK8YxLfeyxs8Ew .rough-node .label text,#mermaid-svg-JRaK8YxLfeyxs8Ew .node .label text,#mermaid-svg-JRaK8YxLfeyxs8Ew .image-shape .label,#mermaid-svg-JRaK8YxLfeyxs8Ew .icon-shape .label{text-anchor:middle;}#mermaid-svg-JRaK8YxLfeyxs8Ew .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-JRaK8YxLfeyxs8Ew .rough-node .label,#mermaid-svg-JRaK8YxLfeyxs8Ew .node .label,#mermaid-svg-JRaK8YxLfeyxs8Ew .image-shape .label,#mermaid-svg-JRaK8YxLfeyxs8Ew .icon-shape .label{text-align:center;}#mermaid-svg-JRaK8YxLfeyxs8Ew .node.clickable{cursor:pointer;}#mermaid-svg-JRaK8YxLfeyxs8Ew .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-JRaK8YxLfeyxs8Ew .arrowheadPath{fill:#333333;}#mermaid-svg-JRaK8YxLfeyxs8Ew .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-JRaK8YxLfeyxs8Ew .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-JRaK8YxLfeyxs8Ew .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-JRaK8YxLfeyxs8Ew .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-JRaK8YxLfeyxs8Ew .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-JRaK8YxLfeyxs8Ew .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-JRaK8YxLfeyxs8Ew .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-JRaK8YxLfeyxs8Ew .cluster text{fill:#333;}#mermaid-svg-JRaK8YxLfeyxs8Ew .cluster span{color:#333;}#mermaid-svg-JRaK8YxLfeyxs8Ew div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-JRaK8YxLfeyxs8Ew .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-JRaK8YxLfeyxs8Ew rect.text{fill:none;stroke-width:0;}#mermaid-svg-JRaK8YxLfeyxs8Ew .icon-shape,#mermaid-svg-JRaK8YxLfeyxs8Ew .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-JRaK8YxLfeyxs8Ew .icon-shape p,#mermaid-svg-JRaK8YxLfeyxs8Ew .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-JRaK8YxLfeyxs8Ew .icon-shape .label rect,#mermaid-svg-JRaK8YxLfeyxs8Ew .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-JRaK8YxLfeyxs8Ew .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-JRaK8YxLfeyxs8Ew .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-JRaK8YxLfeyxs8Ew :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 订单
订单确认
发货单
库存信息
采购单
供货信息
顾客
电商系统
仓库
供应商

顶层DFD要素:

要素 说明
外部实体 系统的数据来源和去向
加工 系统整体(一个加工)
数据流 系统与外部的数据交换

(四)0层数据流图

0层DFD:

0层DFD对顶层加工进行分解,描述系统的主要功能。

示例:
#mermaid-svg-SCR9j3ubYijQLLQ1{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-SCR9j3ubYijQLLQ1 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-SCR9j3ubYijQLLQ1 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-SCR9j3ubYijQLLQ1 .error-icon{fill:#552222;}#mermaid-svg-SCR9j3ubYijQLLQ1 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-SCR9j3ubYijQLLQ1 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-SCR9j3ubYijQLLQ1 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-SCR9j3ubYijQLLQ1 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-SCR9j3ubYijQLLQ1 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-SCR9j3ubYijQLLQ1 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-SCR9j3ubYijQLLQ1 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-SCR9j3ubYijQLLQ1 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-SCR9j3ubYijQLLQ1 .marker.cross{stroke:#333333;}#mermaid-svg-SCR9j3ubYijQLLQ1 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-SCR9j3ubYijQLLQ1 p{margin:0;}#mermaid-svg-SCR9j3ubYijQLLQ1 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-SCR9j3ubYijQLLQ1 .cluster-label text{fill:#333;}#mermaid-svg-SCR9j3ubYijQLLQ1 .cluster-label span{color:#333;}#mermaid-svg-SCR9j3ubYijQLLQ1 .cluster-label span p{background-color:transparent;}#mermaid-svg-SCR9j3ubYijQLLQ1 .label text,#mermaid-svg-SCR9j3ubYijQLLQ1 span{fill:#333;color:#333;}#mermaid-svg-SCR9j3ubYijQLLQ1 .node rect,#mermaid-svg-SCR9j3ubYijQLLQ1 .node circle,#mermaid-svg-SCR9j3ubYijQLLQ1 .node ellipse,#mermaid-svg-SCR9j3ubYijQLLQ1 .node polygon,#mermaid-svg-SCR9j3ubYijQLLQ1 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-SCR9j3ubYijQLLQ1 .rough-node .label text,#mermaid-svg-SCR9j3ubYijQLLQ1 .node .label text,#mermaid-svg-SCR9j3ubYijQLLQ1 .image-shape .label,#mermaid-svg-SCR9j3ubYijQLLQ1 .icon-shape .label{text-anchor:middle;}#mermaid-svg-SCR9j3ubYijQLLQ1 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-SCR9j3ubYijQLLQ1 .rough-node .label,#mermaid-svg-SCR9j3ubYijQLLQ1 .node .label,#mermaid-svg-SCR9j3ubYijQLLQ1 .image-shape .label,#mermaid-svg-SCR9j3ubYijQLLQ1 .icon-shape .label{text-align:center;}#mermaid-svg-SCR9j3ubYijQLLQ1 .node.clickable{cursor:pointer;}#mermaid-svg-SCR9j3ubYijQLLQ1 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-SCR9j3ubYijQLLQ1 .arrowheadPath{fill:#333333;}#mermaid-svg-SCR9j3ubYijQLLQ1 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-SCR9j3ubYijQLLQ1 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-SCR9j3ubYijQLLQ1 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-SCR9j3ubYijQLLQ1 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-SCR9j3ubYijQLLQ1 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-SCR9j3ubYijQLLQ1 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-SCR9j3ubYijQLLQ1 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-SCR9j3ubYijQLLQ1 .cluster text{fill:#333;}#mermaid-svg-SCR9j3ubYijQLLQ1 .cluster span{color:#333;}#mermaid-svg-SCR9j3ubYijQLLQ1 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-SCR9j3ubYijQLLQ1 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-SCR9j3ubYijQLLQ1 rect.text{fill:none;stroke-width:0;}#mermaid-svg-SCR9j3ubYijQLLQ1 .icon-shape,#mermaid-svg-SCR9j3ubYijQLLQ1 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-SCR9j3ubYijQLLQ1 .icon-shape p,#mermaid-svg-SCR9j3ubYijQLLQ1 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-SCR9j3ubYijQLLQ1 .icon-shape .label rect,#mermaid-svg-SCR9j3ubYijQLLQ1 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-SCR9j3ubYijQLLQ1 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-SCR9j3ubYijQLLQ1 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-SCR9j3ubYijQLLQ1 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 订单
支付
订单数据
支付数据
发货通知
支付确认
库存信息
顾客
订单处理
支付处理
订单库
支付库
仓库

(五)详细数据流图

详细DFD:

对0层DFD中的加工进一步分解。

订单处理分解:
#mermaid-svg-A0FnRxEtW0tMuznQ{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-A0FnRxEtW0tMuznQ .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-A0FnRxEtW0tMuznQ .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-A0FnRxEtW0tMuznQ .error-icon{fill:#552222;}#mermaid-svg-A0FnRxEtW0tMuznQ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-A0FnRxEtW0tMuznQ .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-A0FnRxEtW0tMuznQ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-A0FnRxEtW0tMuznQ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-A0FnRxEtW0tMuznQ .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-A0FnRxEtW0tMuznQ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-A0FnRxEtW0tMuznQ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-A0FnRxEtW0tMuznQ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-A0FnRxEtW0tMuznQ .marker.cross{stroke:#333333;}#mermaid-svg-A0FnRxEtW0tMuznQ svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-A0FnRxEtW0tMuznQ p{margin:0;}#mermaid-svg-A0FnRxEtW0tMuznQ .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-A0FnRxEtW0tMuznQ .cluster-label text{fill:#333;}#mermaid-svg-A0FnRxEtW0tMuznQ .cluster-label span{color:#333;}#mermaid-svg-A0FnRxEtW0tMuznQ .cluster-label span p{background-color:transparent;}#mermaid-svg-A0FnRxEtW0tMuznQ .label text,#mermaid-svg-A0FnRxEtW0tMuznQ span{fill:#333;color:#333;}#mermaid-svg-A0FnRxEtW0tMuznQ .node rect,#mermaid-svg-A0FnRxEtW0tMuznQ .node circle,#mermaid-svg-A0FnRxEtW0tMuznQ .node ellipse,#mermaid-svg-A0FnRxEtW0tMuznQ .node polygon,#mermaid-svg-A0FnRxEtW0tMuznQ .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-A0FnRxEtW0tMuznQ .rough-node .label text,#mermaid-svg-A0FnRxEtW0tMuznQ .node .label text,#mermaid-svg-A0FnRxEtW0tMuznQ .image-shape .label,#mermaid-svg-A0FnRxEtW0tMuznQ .icon-shape .label{text-anchor:middle;}#mermaid-svg-A0FnRxEtW0tMuznQ .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-A0FnRxEtW0tMuznQ .rough-node .label,#mermaid-svg-A0FnRxEtW0tMuznQ .node .label,#mermaid-svg-A0FnRxEtW0tMuznQ .image-shape .label,#mermaid-svg-A0FnRxEtW0tMuznQ .icon-shape .label{text-align:center;}#mermaid-svg-A0FnRxEtW0tMuznQ .node.clickable{cursor:pointer;}#mermaid-svg-A0FnRxEtW0tMuznQ .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-A0FnRxEtW0tMuznQ .arrowheadPath{fill:#333333;}#mermaid-svg-A0FnRxEtW0tMuznQ .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-A0FnRxEtW0tMuznQ .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-A0FnRxEtW0tMuznQ .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-A0FnRxEtW0tMuznQ .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-A0FnRxEtW0tMuznQ .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-A0FnRxEtW0tMuznQ .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-A0FnRxEtW0tMuznQ .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-A0FnRxEtW0tMuznQ .cluster text{fill:#333;}#mermaid-svg-A0FnRxEtW0tMuznQ .cluster span{color:#333;}#mermaid-svg-A0FnRxEtW0tMuznQ div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-A0FnRxEtW0tMuznQ .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-A0FnRxEtW0tMuznQ rect.text{fill:none;stroke-width:0;}#mermaid-svg-A0FnRxEtW0tMuznQ .icon-shape,#mermaid-svg-A0FnRxEtW0tMuznQ .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-A0FnRxEtW0tMuznQ .icon-shape p,#mermaid-svg-A0FnRxEtW0tMuznQ .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-A0FnRxEtW0tMuznQ .icon-shape .label rect,#mermaid-svg-A0FnRxEtW0tMuznQ .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-A0FnRxEtW0tMuznQ .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-A0FnRxEtW0tMuznQ .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-A0FnRxEtW0tMuznQ :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 订单
有效订单
无效订单
订单数据
库存查询
库存数据
发货通知
订单确认
顾客
验证订单
处理订单
订单库
查询库存
库存库
仓库

(六)数据流图的绘制规则

绘制规则:

规则 说明
数据守恒 输入=输出+存储变化
适当命名 加工、数据流要有意义
分解合理 每个加工分解为3-9个
接口清晰 层与层之间接口对应
局部文件 每个加工可有局部文件

常见错误:

错误类型 说明 示例
黑洞 只有输入没有输出 数据丢失
奇迹 只有输出没有输入 无中生有
灰洞 输入不足以产生输出 信息不足
数据流直接到文件 数据流不经过加工 违反规则

📊 四、数据字典

(一)数据字典概述

数据字典(Data Dictionary, DD) 是对DFD中所有数据元素的精确定义。

数据字典内容:
#mermaid-svg-xEXekf3j2Dx8syJV{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-xEXekf3j2Dx8syJV .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-xEXekf3j2Dx8syJV .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-xEXekf3j2Dx8syJV .error-icon{fill:#552222;}#mermaid-svg-xEXekf3j2Dx8syJV .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-xEXekf3j2Dx8syJV .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-xEXekf3j2Dx8syJV .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-xEXekf3j2Dx8syJV .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-xEXekf3j2Dx8syJV .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-xEXekf3j2Dx8syJV .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-xEXekf3j2Dx8syJV .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-xEXekf3j2Dx8syJV .marker{fill:#333333;stroke:#333333;}#mermaid-svg-xEXekf3j2Dx8syJV .marker.cross{stroke:#333333;}#mermaid-svg-xEXekf3j2Dx8syJV svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-xEXekf3j2Dx8syJV p{margin:0;}#mermaid-svg-xEXekf3j2Dx8syJV .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-xEXekf3j2Dx8syJV .cluster-label text{fill:#333;}#mermaid-svg-xEXekf3j2Dx8syJV .cluster-label span{color:#333;}#mermaid-svg-xEXekf3j2Dx8syJV .cluster-label span p{background-color:transparent;}#mermaid-svg-xEXekf3j2Dx8syJV .label text,#mermaid-svg-xEXekf3j2Dx8syJV span{fill:#333;color:#333;}#mermaid-svg-xEXekf3j2Dx8syJV .node rect,#mermaid-svg-xEXekf3j2Dx8syJV .node circle,#mermaid-svg-xEXekf3j2Dx8syJV .node ellipse,#mermaid-svg-xEXekf3j2Dx8syJV .node polygon,#mermaid-svg-xEXekf3j2Dx8syJV .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-xEXekf3j2Dx8syJV .rough-node .label text,#mermaid-svg-xEXekf3j2Dx8syJV .node .label text,#mermaid-svg-xEXekf3j2Dx8syJV .image-shape .label,#mermaid-svg-xEXekf3j2Dx8syJV .icon-shape .label{text-anchor:middle;}#mermaid-svg-xEXekf3j2Dx8syJV .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-xEXekf3j2Dx8syJV .rough-node .label,#mermaid-svg-xEXekf3j2Dx8syJV .node .label,#mermaid-svg-xEXekf3j2Dx8syJV .image-shape .label,#mermaid-svg-xEXekf3j2Dx8syJV .icon-shape .label{text-align:center;}#mermaid-svg-xEXekf3j2Dx8syJV .node.clickable{cursor:pointer;}#mermaid-svg-xEXekf3j2Dx8syJV .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-xEXekf3j2Dx8syJV .arrowheadPath{fill:#333333;}#mermaid-svg-xEXekf3j2Dx8syJV .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-xEXekf3j2Dx8syJV .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-xEXekf3j2Dx8syJV .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-xEXekf3j2Dx8syJV .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-xEXekf3j2Dx8syJV .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-xEXekf3j2Dx8syJV .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-xEXekf3j2Dx8syJV .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-xEXekf3j2Dx8syJV .cluster text{fill:#333;}#mermaid-svg-xEXekf3j2Dx8syJV .cluster span{color:#333;}#mermaid-svg-xEXekf3j2Dx8syJV div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-xEXekf3j2Dx8syJV .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-xEXekf3j2Dx8syJV rect.text{fill:none;stroke-width:0;}#mermaid-svg-xEXekf3j2Dx8syJV .icon-shape,#mermaid-svg-xEXekf3j2Dx8syJV .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-xEXekf3j2Dx8syJV .icon-shape p,#mermaid-svg-xEXekf3j2Dx8syJV .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-xEXekf3j2Dx8syJV .icon-shape .label rect,#mermaid-svg-xEXekf3j2Dx8syJV .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-xEXekf3j2Dx8syJV .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-xEXekf3j2Dx8syJV .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-xEXekf3j2Dx8syJV :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 数据字典
数据项
数据结构
数据流
数据存储
加工
基本数据元素
数据组合
数据流动
数据存储
加工逻辑

(二)数据项定义

数据项:

数据项是不可再分的基本数据元素。

数据项定义示例:

数据项名 别名 类型 长度 取值范围 说明
用户ID UID 整型 11 1-99999999999 用户唯一标识
用户名 UserName 字符串 20 - 用户登录名
密码 Password 字符串 100 - 加密存储
邮箱 Email 字符串 100 - 邮箱地址

(三)数据结构定义

数据结构:

数据结构由多个数据项组成。

定义符号:

符号 含义 示例
= 定义为 A = B + C
+ 连接 A = B + C
... 可选 A = B + C
{...} 重复 A = B + {C}
(...) 分组 A = (B + C) * D
|...| 选择 A = B | C | D

数据结构定义示例:

复制代码
订单 = 订单号 + 用户ID + 商品列表 + 总金额 + 订单状态
商品列表 = {商品项}
商品项 = 商品ID + 商品名称 + 数量 + 单价
订单状态 = 待支付 | 已支付 | 已发货 | 已完成 | 已取消

(四)数据流定义

数据流定义:

数据流名 来源 去向 组成 说明
订单信息 顾客 订单处理 订单 顾客提交的订单
订单确认 订单处理 顾客 确认信息 订单处理结果
发货通知 订单处理 仓库 发货单 通知仓库发货

(五)数据存储定义

数据存储定义:

存储名 组成 说明 关键字
订单文件 {订单} 存储所有订单 订单号
库存文件 {库存项} 存储商品信息 商品ID
用户文件 {用户} 存储用户信息 用户ID

(六)加工定义

加工定义:

加工定义描述加工的逻辑。

定义方法:

方法 说明 适用场景
结构化语言 使用结构化语言 简单加工
判定树 使用判定树 复杂判断
判定表 使用判定表 多条件组合

结构化语言示例:

复制代码
加工:验证订单
输入:订单
输出:有效订单/无效订单
处理逻辑:
    IF 订单格式正确 THEN
        IF 用户存在 THEN
            IF 库存充足 THEN
                输出有效订单
            ELSE
                输出无效订单(库存不足)
            ENDIF
        ELSE
            输出无效订单(用户不存在)
        ENDIF
    ELSE
        输出无效订单(格式错误)
    ENDIF

判定树示例:
#mermaid-svg-kO2zgw7uOdMPP2jn{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-kO2zgw7uOdMPP2jn .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-kO2zgw7uOdMPP2jn .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-kO2zgw7uOdMPP2jn .error-icon{fill:#552222;}#mermaid-svg-kO2zgw7uOdMPP2jn .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-kO2zgw7uOdMPP2jn .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-kO2zgw7uOdMPP2jn .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-kO2zgw7uOdMPP2jn .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-kO2zgw7uOdMPP2jn .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-kO2zgw7uOdMPP2jn .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-kO2zgw7uOdMPP2jn .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-kO2zgw7uOdMPP2jn .marker{fill:#333333;stroke:#333333;}#mermaid-svg-kO2zgw7uOdMPP2jn .marker.cross{stroke:#333333;}#mermaid-svg-kO2zgw7uOdMPP2jn svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-kO2zgw7uOdMPP2jn p{margin:0;}#mermaid-svg-kO2zgw7uOdMPP2jn .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-kO2zgw7uOdMPP2jn .cluster-label text{fill:#333;}#mermaid-svg-kO2zgw7uOdMPP2jn .cluster-label span{color:#333;}#mermaid-svg-kO2zgw7uOdMPP2jn .cluster-label span p{background-color:transparent;}#mermaid-svg-kO2zgw7uOdMPP2jn .label text,#mermaid-svg-kO2zgw7uOdMPP2jn span{fill:#333;color:#333;}#mermaid-svg-kO2zgw7uOdMPP2jn .node rect,#mermaid-svg-kO2zgw7uOdMPP2jn .node circle,#mermaid-svg-kO2zgw7uOdMPP2jn .node ellipse,#mermaid-svg-kO2zgw7uOdMPP2jn .node polygon,#mermaid-svg-kO2zgw7uOdMPP2jn .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-kO2zgw7uOdMPP2jn .rough-node .label text,#mermaid-svg-kO2zgw7uOdMPP2jn .node .label text,#mermaid-svg-kO2zgw7uOdMPP2jn .image-shape .label,#mermaid-svg-kO2zgw7uOdMPP2jn .icon-shape .label{text-anchor:middle;}#mermaid-svg-kO2zgw7uOdMPP2jn .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-kO2zgw7uOdMPP2jn .rough-node .label,#mermaid-svg-kO2zgw7uOdMPP2jn .node .label,#mermaid-svg-kO2zgw7uOdMPP2jn .image-shape .label,#mermaid-svg-kO2zgw7uOdMPP2jn .icon-shape .label{text-align:center;}#mermaid-svg-kO2zgw7uOdMPP2jn .node.clickable{cursor:pointer;}#mermaid-svg-kO2zgw7uOdMPP2jn .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-kO2zgw7uOdMPP2jn .arrowheadPath{fill:#333333;}#mermaid-svg-kO2zgw7uOdMPP2jn .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-kO2zgw7uOdMPP2jn .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-kO2zgw7uOdMPP2jn .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-kO2zgw7uOdMPP2jn .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-kO2zgw7uOdMPP2jn .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-kO2zgw7uOdMPP2jn .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-kO2zgw7uOdMPP2jn .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-kO2zgw7uOdMPP2jn .cluster text{fill:#333;}#mermaid-svg-kO2zgw7uOdMPP2jn .cluster span{color:#333;}#mermaid-svg-kO2zgw7uOdMPP2jn div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-kO2zgw7uOdMPP2jn .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-kO2zgw7uOdMPP2jn rect.text{fill:none;stroke-width:0;}#mermaid-svg-kO2zgw7uOdMPP2jn .icon-shape,#mermaid-svg-kO2zgw7uOdMPP2jn .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-kO2zgw7uOdMPP2jn .icon-shape p,#mermaid-svg-kO2zgw7uOdMPP2jn .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-kO2zgw7uOdMPP2jn .icon-shape .label rect,#mermaid-svg-kO2zgw7uOdMPP2jn .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-kO2zgw7uOdMPP2jn .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-kO2zgw7uOdMPP2jn .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-kO2zgw7uOdMPP2jn :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 否
是
否
是
否
是
验证订单
格式正确?
无效订单
用户存在?
库存充足?
有效订单

判定表示例:

条件 1 2 3 4
格式正确 Y Y Y N
用户存在 Y Y N -
库存充足 Y N - -
动作
有效订单 X
无效订单 X X X

📋 五、实体关系图(ER图)

(一)ER图概述

实体关系图(Entity-Relationship Diagram, ERD) 描述系统的数据结构。

ER图组成:
#mermaid-svg-PpxsNX54fN3rfHG5{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-PpxsNX54fN3rfHG5 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-PpxsNX54fN3rfHG5 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-PpxsNX54fN3rfHG5 .error-icon{fill:#552222;}#mermaid-svg-PpxsNX54fN3rfHG5 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-PpxsNX54fN3rfHG5 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-PpxsNX54fN3rfHG5 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-PpxsNX54fN3rfHG5 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-PpxsNX54fN3rfHG5 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-PpxsNX54fN3rfHG5 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-PpxsNX54fN3rfHG5 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-PpxsNX54fN3rfHG5 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-PpxsNX54fN3rfHG5 .marker.cross{stroke:#333333;}#mermaid-svg-PpxsNX54fN3rfHG5 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-PpxsNX54fN3rfHG5 p{margin:0;}#mermaid-svg-PpxsNX54fN3rfHG5 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-PpxsNX54fN3rfHG5 .cluster-label text{fill:#333;}#mermaid-svg-PpxsNX54fN3rfHG5 .cluster-label span{color:#333;}#mermaid-svg-PpxsNX54fN3rfHG5 .cluster-label span p{background-color:transparent;}#mermaid-svg-PpxsNX54fN3rfHG5 .label text,#mermaid-svg-PpxsNX54fN3rfHG5 span{fill:#333;color:#333;}#mermaid-svg-PpxsNX54fN3rfHG5 .node rect,#mermaid-svg-PpxsNX54fN3rfHG5 .node circle,#mermaid-svg-PpxsNX54fN3rfHG5 .node ellipse,#mermaid-svg-PpxsNX54fN3rfHG5 .node polygon,#mermaid-svg-PpxsNX54fN3rfHG5 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-PpxsNX54fN3rfHG5 .rough-node .label text,#mermaid-svg-PpxsNX54fN3rfHG5 .node .label text,#mermaid-svg-PpxsNX54fN3rfHG5 .image-shape .label,#mermaid-svg-PpxsNX54fN3rfHG5 .icon-shape .label{text-anchor:middle;}#mermaid-svg-PpxsNX54fN3rfHG5 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-PpxsNX54fN3rfHG5 .rough-node .label,#mermaid-svg-PpxsNX54fN3rfHG5 .node .label,#mermaid-svg-PpxsNX54fN3rfHG5 .image-shape .label,#mermaid-svg-PpxsNX54fN3rfHG5 .icon-shape .label{text-align:center;}#mermaid-svg-PpxsNX54fN3rfHG5 .node.clickable{cursor:pointer;}#mermaid-svg-PpxsNX54fN3rfHG5 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-PpxsNX54fN3rfHG5 .arrowheadPath{fill:#333333;}#mermaid-svg-PpxsNX54fN3rfHG5 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-PpxsNX54fN3rfHG5 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-PpxsNX54fN3rfHG5 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-PpxsNX54fN3rfHG5 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-PpxsNX54fN3rfHG5 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-PpxsNX54fN3rfHG5 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-PpxsNX54fN3rfHG5 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-PpxsNX54fN3rfHG5 .cluster text{fill:#333;}#mermaid-svg-PpxsNX54fN3rfHG5 .cluster span{color:#333;}#mermaid-svg-PpxsNX54fN3rfHG5 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-PpxsNX54fN3rfHG5 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-PpxsNX54fN3rfHG5 rect.text{fill:none;stroke-width:0;}#mermaid-svg-PpxsNX54fN3rfHG5 .icon-shape,#mermaid-svg-PpxsNX54fN3rfHG5 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-PpxsNX54fN3rfHG5 .icon-shape p,#mermaid-svg-PpxsNX54fN3rfHG5 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-PpxsNX54fN3rfHG5 .icon-shape .label rect,#mermaid-svg-PpxsNX54fN3rfHG5 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-PpxsNX54fN3rfHG5 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-PpxsNX54fN3rfHG5 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-PpxsNX54fN3rfHG5 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} ER图组成
实体
属性
关系
数据对象
矩形表示
实体特征
椭圆表示
实体联系
菱形表示

(二)实体定义

实体:

实体是系统中需要存储的数据对象。

实体识别:

实体 说明 属性
用户 系统用户 ID、姓名、密码、邮箱
商品 商品信息 ID、名称、价格、库存
订单 订单信息 ID、用户ID、金额、状态

(三)关系定义

关系类型:

关系 说明 示例
1:1 一对一 用户-身份证
1:N 一对多 用户-订单
M:N 多对多 学生-课程

ER图示例:
#mermaid-svg-h1RIUVX3qqUoK5OG{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-h1RIUVX3qqUoK5OG .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-h1RIUVX3qqUoK5OG .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-h1RIUVX3qqUoK5OG .error-icon{fill:#552222;}#mermaid-svg-h1RIUVX3qqUoK5OG .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-h1RIUVX3qqUoK5OG .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-h1RIUVX3qqUoK5OG .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-h1RIUVX3qqUoK5OG .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-h1RIUVX3qqUoK5OG .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-h1RIUVX3qqUoK5OG .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-h1RIUVX3qqUoK5OG .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-h1RIUVX3qqUoK5OG .marker{fill:#333333;stroke:#333333;}#mermaid-svg-h1RIUVX3qqUoK5OG .marker.cross{stroke:#333333;}#mermaid-svg-h1RIUVX3qqUoK5OG svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-h1RIUVX3qqUoK5OG p{margin:0;}#mermaid-svg-h1RIUVX3qqUoK5OG .entityBox{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-h1RIUVX3qqUoK5OG .relationshipLabelBox{fill:hsl(80, 100%, 96.2745098039%);opacity:0.7;background-color:hsl(80, 100%, 96.2745098039%);}#mermaid-svg-h1RIUVX3qqUoK5OG .relationshipLabelBox rect{opacity:0.5;}#mermaid-svg-h1RIUVX3qqUoK5OG .labelBkg{background-color:rgba(248.6666666666, 255, 235.9999999999, 0.5);}#mermaid-svg-h1RIUVX3qqUoK5OG .edgeLabel .label{fill:#9370DB;font-size:14px;}#mermaid-svg-h1RIUVX3qqUoK5OG .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-h1RIUVX3qqUoK5OG .edge-pattern-dashed{stroke-dasharray:8,8;}#mermaid-svg-h1RIUVX3qqUoK5OG .node rect,#mermaid-svg-h1RIUVX3qqUoK5OG .node circle,#mermaid-svg-h1RIUVX3qqUoK5OG .node ellipse,#mermaid-svg-h1RIUVX3qqUoK5OG .node polygon{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-h1RIUVX3qqUoK5OG .relationshipLine{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-h1RIUVX3qqUoK5OG .marker{fill:none!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-h1RIUVX3qqUoK5OG .edgeLabel{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-h1RIUVX3qqUoK5OG .edgeLabel .label rect{fill:rgba(232,232,232, 0.8);}#mermaid-svg-h1RIUVX3qqUoK5OG .edgeLabel .label text{fill:#333;}#mermaid-svg-h1RIUVX3qqUoK5OG :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} places
contains
ordered in
USER
int
user_id
PK
string
name
string
password
string
email
ORDER
int
order_id
PK
int
user_id
FK
decimal
amount
string
status
ORDER_ITEM
int
order_id
FK
int
product_id
FK
int
quantity
PRODUCT
int
product_id
PK
string
name
decimal
price
int
stock

💡 六、状态转换图

(一)状态转换图概述

状态转换图(State Transition Diagram, STD) 描述系统的行为模型。

STD组成:
#mermaid-svg-IcZyG0ch14Kdzha2{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-IcZyG0ch14Kdzha2 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-IcZyG0ch14Kdzha2 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-IcZyG0ch14Kdzha2 .error-icon{fill:#552222;}#mermaid-svg-IcZyG0ch14Kdzha2 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-IcZyG0ch14Kdzha2 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-IcZyG0ch14Kdzha2 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-IcZyG0ch14Kdzha2 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-IcZyG0ch14Kdzha2 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-IcZyG0ch14Kdzha2 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-IcZyG0ch14Kdzha2 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-IcZyG0ch14Kdzha2 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-IcZyG0ch14Kdzha2 .marker.cross{stroke:#333333;}#mermaid-svg-IcZyG0ch14Kdzha2 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-IcZyG0ch14Kdzha2 p{margin:0;}#mermaid-svg-IcZyG0ch14Kdzha2 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-IcZyG0ch14Kdzha2 .cluster-label text{fill:#333;}#mermaid-svg-IcZyG0ch14Kdzha2 .cluster-label span{color:#333;}#mermaid-svg-IcZyG0ch14Kdzha2 .cluster-label span p{background-color:transparent;}#mermaid-svg-IcZyG0ch14Kdzha2 .label text,#mermaid-svg-IcZyG0ch14Kdzha2 span{fill:#333;color:#333;}#mermaid-svg-IcZyG0ch14Kdzha2 .node rect,#mermaid-svg-IcZyG0ch14Kdzha2 .node circle,#mermaid-svg-IcZyG0ch14Kdzha2 .node ellipse,#mermaid-svg-IcZyG0ch14Kdzha2 .node polygon,#mermaid-svg-IcZyG0ch14Kdzha2 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-IcZyG0ch14Kdzha2 .rough-node .label text,#mermaid-svg-IcZyG0ch14Kdzha2 .node .label text,#mermaid-svg-IcZyG0ch14Kdzha2 .image-shape .label,#mermaid-svg-IcZyG0ch14Kdzha2 .icon-shape .label{text-anchor:middle;}#mermaid-svg-IcZyG0ch14Kdzha2 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-IcZyG0ch14Kdzha2 .rough-node .label,#mermaid-svg-IcZyG0ch14Kdzha2 .node .label,#mermaid-svg-IcZyG0ch14Kdzha2 .image-shape .label,#mermaid-svg-IcZyG0ch14Kdzha2 .icon-shape .label{text-align:center;}#mermaid-svg-IcZyG0ch14Kdzha2 .node.clickable{cursor:pointer;}#mermaid-svg-IcZyG0ch14Kdzha2 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-IcZyG0ch14Kdzha2 .arrowheadPath{fill:#333333;}#mermaid-svg-IcZyG0ch14Kdzha2 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-IcZyG0ch14Kdzha2 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-IcZyG0ch14Kdzha2 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-IcZyG0ch14Kdzha2 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-IcZyG0ch14Kdzha2 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-IcZyG0ch14Kdzha2 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-IcZyG0ch14Kdzha2 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-IcZyG0ch14Kdzha2 .cluster text{fill:#333;}#mermaid-svg-IcZyG0ch14Kdzha2 .cluster span{color:#333;}#mermaid-svg-IcZyG0ch14Kdzha2 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-IcZyG0ch14Kdzha2 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-IcZyG0ch14Kdzha2 rect.text{fill:none;stroke-width:0;}#mermaid-svg-IcZyG0ch14Kdzha2 .icon-shape,#mermaid-svg-IcZyG0ch14Kdzha2 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-IcZyG0ch14Kdzha2 .icon-shape p,#mermaid-svg-IcZyG0ch14Kdzha2 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-IcZyG0ch14Kdzha2 .icon-shape .label rect,#mermaid-svg-IcZyG0ch14Kdzha2 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-IcZyG0ch14Kdzha2 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-IcZyG0ch14Kdzha2 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-IcZyG0ch14Kdzha2 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} STD组成
状态
事件
转换
系统状态
圆形表示
触发事件
箭头标注
状态转换
箭头表示

(二)状态定义

状态:

状态是系统在某一时刻的条件或情况。

状态示例:

状态 说明 进入条件 退出条件
待支付 订单已创建 提交订单 支付/取消
已支付 支付成功 支付成功 发货
已发货 已发货 仓库发货 确认收货
已完成 交易完成 确认收货 -

(三)状态转换图示例

订单状态转换图:
#mermaid-svg-9gofOa3sGF4ElJYq{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-9gofOa3sGF4ElJYq .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-9gofOa3sGF4ElJYq .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-9gofOa3sGF4ElJYq .error-icon{fill:#552222;}#mermaid-svg-9gofOa3sGF4ElJYq .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-9gofOa3sGF4ElJYq .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-9gofOa3sGF4ElJYq .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-9gofOa3sGF4ElJYq .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-9gofOa3sGF4ElJYq .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-9gofOa3sGF4ElJYq .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-9gofOa3sGF4ElJYq .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-9gofOa3sGF4ElJYq .marker{fill:#333333;stroke:#333333;}#mermaid-svg-9gofOa3sGF4ElJYq .marker.cross{stroke:#333333;}#mermaid-svg-9gofOa3sGF4ElJYq svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-9gofOa3sGF4ElJYq p{margin:0;}#mermaid-svg-9gofOa3sGF4ElJYq defs #statediagram-barbEnd{fill:#333333;stroke:#333333;}#mermaid-svg-9gofOa3sGF4ElJYq g.stateGroup text{fill:#9370DB;stroke:none;font-size:10px;}#mermaid-svg-9gofOa3sGF4ElJYq g.stateGroup text{fill:#333;stroke:none;font-size:10px;}#mermaid-svg-9gofOa3sGF4ElJYq g.stateGroup .state-title{font-weight:bolder;fill:#131300;}#mermaid-svg-9gofOa3sGF4ElJYq g.stateGroup rect{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-9gofOa3sGF4ElJYq g.stateGroup line{stroke:#333333;stroke-width:1;}#mermaid-svg-9gofOa3sGF4ElJYq .transition{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-9gofOa3sGF4ElJYq .stateGroup .composit{fill:white;border-bottom:1px;}#mermaid-svg-9gofOa3sGF4ElJYq .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px;}#mermaid-svg-9gofOa3sGF4ElJYq .state-note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-9gofOa3sGF4ElJYq .state-note text{fill:black;stroke:none;font-size:10px;}#mermaid-svg-9gofOa3sGF4ElJYq .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#mermaid-svg-9gofOa3sGF4ElJYq .edgeLabel .label rect{fill:#ECECFF;opacity:0.5;}#mermaid-svg-9gofOa3sGF4ElJYq .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-9gofOa3sGF4ElJYq .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-9gofOa3sGF4ElJYq .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-9gofOa3sGF4ElJYq .edgeLabel .label text{fill:#333;}#mermaid-svg-9gofOa3sGF4ElJYq .label div .edgeLabel{color:#333;}#mermaid-svg-9gofOa3sGF4ElJYq .stateLabel text{fill:#131300;font-size:10px;font-weight:bold;}#mermaid-svg-9gofOa3sGF4ElJYq .node circle.state-start{fill:#333333;stroke:#333333;}#mermaid-svg-9gofOa3sGF4ElJYq .node .fork-join{fill:#333333;stroke:#333333;}#mermaid-svg-9gofOa3sGF4ElJYq .node circle.state-end{fill:#9370DB;stroke:white;stroke-width:1.5;}#mermaid-svg-9gofOa3sGF4ElJYq .end-state-inner{fill:white;stroke-width:1.5;}#mermaid-svg-9gofOa3sGF4ElJYq .node rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-9gofOa3sGF4ElJYq .node polygon{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-9gofOa3sGF4ElJYq #statediagram-barbEnd{fill:#333333;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-cluster rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-9gofOa3sGF4ElJYq .cluster-label,#mermaid-svg-9gofOa3sGF4ElJYq .nodeLabel{color:#131300;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-cluster rect.outer{rx:5px;ry:5px;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-state .divider{stroke:#9370DB;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-state .title-state{rx:5px;ry:5px;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-cluster.statediagram-cluster .inner{fill:white;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-cluster.statediagram-cluster-alt .inner{fill:#f0f0f0;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-cluster .inner{rx:0;ry:0;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-state rect.basic{rx:5px;ry:5px;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#f0f0f0;}#mermaid-svg-9gofOa3sGF4ElJYq .note-edge{stroke-dasharray:5;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-note text{fill:black;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram-note .nodeLabel{color:black;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagram .edgeLabel{color:red;}#mermaid-svg-9gofOa3sGF4ElJYq #dependencyStart,#mermaid-svg-9gofOa3sGF4ElJYq #dependencyEnd{fill:#333333;stroke:#333333;stroke-width:1;}#mermaid-svg-9gofOa3sGF4ElJYq .statediagramTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-9gofOa3sGF4ElJYq :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 支付成功
超时/取消
确认
发货
确认收货
待支付
已支付
已取消
待发货
已发货
已完成

📝 七、结构化分析实例

(一)实例背景

项目:图书馆管理系统

系统概述:开发一个图书馆管理系统,支持图书管理、借阅管理、读者管理等功能。

(二)顶层数据流图

顶层DFD:
#mermaid-svg-VtTwKub1g2S3e4lh{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-VtTwKub1g2S3e4lh .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-VtTwKub1g2S3e4lh .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-VtTwKub1g2S3e4lh .error-icon{fill:#552222;}#mermaid-svg-VtTwKub1g2S3e4lh .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-VtTwKub1g2S3e4lh .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-VtTwKub1g2S3e4lh .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-VtTwKub1g2S3e4lh .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-VtTwKub1g2S3e4lh .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-VtTwKub1g2S3e4lh .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-VtTwKub1g2S3e4lh .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-VtTwKub1g2S3e4lh .marker{fill:#333333;stroke:#333333;}#mermaid-svg-VtTwKub1g2S3e4lh .marker.cross{stroke:#333333;}#mermaid-svg-VtTwKub1g2S3e4lh svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-VtTwKub1g2S3e4lh p{margin:0;}#mermaid-svg-VtTwKub1g2S3e4lh .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-VtTwKub1g2S3e4lh .cluster-label text{fill:#333;}#mermaid-svg-VtTwKub1g2S3e4lh .cluster-label span{color:#333;}#mermaid-svg-VtTwKub1g2S3e4lh .cluster-label span p{background-color:transparent;}#mermaid-svg-VtTwKub1g2S3e4lh .label text,#mermaid-svg-VtTwKub1g2S3e4lh span{fill:#333;color:#333;}#mermaid-svg-VtTwKub1g2S3e4lh .node rect,#mermaid-svg-VtTwKub1g2S3e4lh .node circle,#mermaid-svg-VtTwKub1g2S3e4lh .node ellipse,#mermaid-svg-VtTwKub1g2S3e4lh .node polygon,#mermaid-svg-VtTwKub1g2S3e4lh .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-VtTwKub1g2S3e4lh .rough-node .label text,#mermaid-svg-VtTwKub1g2S3e4lh .node .label text,#mermaid-svg-VtTwKub1g2S3e4lh .image-shape .label,#mermaid-svg-VtTwKub1g2S3e4lh .icon-shape .label{text-anchor:middle;}#mermaid-svg-VtTwKub1g2S3e4lh .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-VtTwKub1g2S3e4lh .rough-node .label,#mermaid-svg-VtTwKub1g2S3e4lh .node .label,#mermaid-svg-VtTwKub1g2S3e4lh .image-shape .label,#mermaid-svg-VtTwKub1g2S3e4lh .icon-shape .label{text-align:center;}#mermaid-svg-VtTwKub1g2S3e4lh .node.clickable{cursor:pointer;}#mermaid-svg-VtTwKub1g2S3e4lh .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-VtTwKub1g2S3e4lh .arrowheadPath{fill:#333333;}#mermaid-svg-VtTwKub1g2S3e4lh .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-VtTwKub1g2S3e4lh .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-VtTwKub1g2S3e4lh .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-VtTwKub1g2S3e4lh .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-VtTwKub1g2S3e4lh .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-VtTwKub1g2S3e4lh .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-VtTwKub1g2S3e4lh .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-VtTwKub1g2S3e4lh .cluster text{fill:#333;}#mermaid-svg-VtTwKub1g2S3e4lh .cluster span{color:#333;}#mermaid-svg-VtTwKub1g2S3e4lh div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-VtTwKub1g2S3e4lh .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-VtTwKub1g2S3e4lh rect.text{fill:none;stroke-width:0;}#mermaid-svg-VtTwKub1g2S3e4lh .icon-shape,#mermaid-svg-VtTwKub1g2S3e4lh .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-VtTwKub1g2S3e4lh .icon-shape p,#mermaid-svg-VtTwKub1g2S3e4lh .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-VtTwKub1g2S3e4lh .icon-shape .label rect,#mermaid-svg-VtTwKub1g2S3e4lh .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-VtTwKub1g2S3e4lh .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-VtTwKub1g2S3e4lh .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-VtTwKub1g2S3e4lh :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 借阅请求
借阅结果
管理指令
管理结果
读者
图书馆系统
管理员

(三)0层数据流图

0层DFD:
#mermaid-svg-QWN13UxTcgaM4Dfs{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-QWN13UxTcgaM4Dfs .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-QWN13UxTcgaM4Dfs .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-QWN13UxTcgaM4Dfs .error-icon{fill:#552222;}#mermaid-svg-QWN13UxTcgaM4Dfs .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-QWN13UxTcgaM4Dfs .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-QWN13UxTcgaM4Dfs .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-QWN13UxTcgaM4Dfs .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-QWN13UxTcgaM4Dfs .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-QWN13UxTcgaM4Dfs .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-QWN13UxTcgaM4Dfs .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-QWN13UxTcgaM4Dfs .marker{fill:#333333;stroke:#333333;}#mermaid-svg-QWN13UxTcgaM4Dfs .marker.cross{stroke:#333333;}#mermaid-svg-QWN13UxTcgaM4Dfs svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-QWN13UxTcgaM4Dfs p{margin:0;}#mermaid-svg-QWN13UxTcgaM4Dfs .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-QWN13UxTcgaM4Dfs .cluster-label text{fill:#333;}#mermaid-svg-QWN13UxTcgaM4Dfs .cluster-label span{color:#333;}#mermaid-svg-QWN13UxTcgaM4Dfs .cluster-label span p{background-color:transparent;}#mermaid-svg-QWN13UxTcgaM4Dfs .label text,#mermaid-svg-QWN13UxTcgaM4Dfs span{fill:#333;color:#333;}#mermaid-svg-QWN13UxTcgaM4Dfs .node rect,#mermaid-svg-QWN13UxTcgaM4Dfs .node circle,#mermaid-svg-QWN13UxTcgaM4Dfs .node ellipse,#mermaid-svg-QWN13UxTcgaM4Dfs .node polygon,#mermaid-svg-QWN13UxTcgaM4Dfs .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-QWN13UxTcgaM4Dfs .rough-node .label text,#mermaid-svg-QWN13UxTcgaM4Dfs .node .label text,#mermaid-svg-QWN13UxTcgaM4Dfs .image-shape .label,#mermaid-svg-QWN13UxTcgaM4Dfs .icon-shape .label{text-anchor:middle;}#mermaid-svg-QWN13UxTcgaM4Dfs .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-QWN13UxTcgaM4Dfs .rough-node .label,#mermaid-svg-QWN13UxTcgaM4Dfs .node .label,#mermaid-svg-QWN13UxTcgaM4Dfs .image-shape .label,#mermaid-svg-QWN13UxTcgaM4Dfs .icon-shape .label{text-align:center;}#mermaid-svg-QWN13UxTcgaM4Dfs .node.clickable{cursor:pointer;}#mermaid-svg-QWN13UxTcgaM4Dfs .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-QWN13UxTcgaM4Dfs .arrowheadPath{fill:#333333;}#mermaid-svg-QWN13UxTcgaM4Dfs .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-QWN13UxTcgaM4Dfs .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-QWN13UxTcgaM4Dfs .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-QWN13UxTcgaM4Dfs .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-QWN13UxTcgaM4Dfs .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-QWN13UxTcgaM4Dfs .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-QWN13UxTcgaM4Dfs .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-QWN13UxTcgaM4Dfs .cluster text{fill:#333;}#mermaid-svg-QWN13UxTcgaM4Dfs .cluster span{color:#333;}#mermaid-svg-QWN13UxTcgaM4Dfs div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-QWN13UxTcgaM4Dfs .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-QWN13UxTcgaM4Dfs rect.text{fill:none;stroke-width:0;}#mermaid-svg-QWN13UxTcgaM4Dfs .icon-shape,#mermaid-svg-QWN13UxTcgaM4Dfs .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-QWN13UxTcgaM4Dfs .icon-shape p,#mermaid-svg-QWN13UxTcgaM4Dfs .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-QWN13UxTcgaM4Dfs .icon-shape .label rect,#mermaid-svg-QWN13UxTcgaM4Dfs .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-QWN13UxTcgaM4Dfs .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-QWN13UxTcgaM4Dfs .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-QWN13UxTcgaM4Dfs :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 借阅请求
归还请求
图书信息
读者信息
借阅记录
借阅记录
图书信息
读者信息
借阅结果
归还结果
读者
借阅处理
归还处理
管理员
图书管理
读者管理
借阅库
图书库
读者库

(四)数据字典

数据项定义:

数据项 类型 长度 说明
图书ID 字符串 20 图书唯一标识
书名 字符串 100 图书名称
作者 字符串 50 作者姓名
读者ID 字符串 20 读者唯一标识
借阅日期 日期 - 借阅日期

数据结构定义:

复制代码
图书 = 图书ID + 书名 + 作者 + 出版社 + 价格 + 库存数量
读者 = 读者ID + 姓名 + 性别 + 电话 + 邮箱 + 最大借阅数
借阅记录 = 借阅ID + 读者ID + 图书ID + 借阅日期 + 归还日期 + 状态

(五)实体关系图

ER图:
#mermaid-svg-f0Gr0cmMbvaba3U8{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-f0Gr0cmMbvaba3U8 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-f0Gr0cmMbvaba3U8 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-f0Gr0cmMbvaba3U8 .error-icon{fill:#552222;}#mermaid-svg-f0Gr0cmMbvaba3U8 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-f0Gr0cmMbvaba3U8 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-f0Gr0cmMbvaba3U8 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-f0Gr0cmMbvaba3U8 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-f0Gr0cmMbvaba3U8 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-f0Gr0cmMbvaba3U8 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-f0Gr0cmMbvaba3U8 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-f0Gr0cmMbvaba3U8 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-f0Gr0cmMbvaba3U8 .marker.cross{stroke:#333333;}#mermaid-svg-f0Gr0cmMbvaba3U8 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-f0Gr0cmMbvaba3U8 p{margin:0;}#mermaid-svg-f0Gr0cmMbvaba3U8 .entityBox{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-f0Gr0cmMbvaba3U8 .relationshipLabelBox{fill:hsl(80, 100%, 96.2745098039%);opacity:0.7;background-color:hsl(80, 100%, 96.2745098039%);}#mermaid-svg-f0Gr0cmMbvaba3U8 .relationshipLabelBox rect{opacity:0.5;}#mermaid-svg-f0Gr0cmMbvaba3U8 .labelBkg{background-color:rgba(248.6666666666, 255, 235.9999999999, 0.5);}#mermaid-svg-f0Gr0cmMbvaba3U8 .edgeLabel .label{fill:#9370DB;font-size:14px;}#mermaid-svg-f0Gr0cmMbvaba3U8 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-f0Gr0cmMbvaba3U8 .edge-pattern-dashed{stroke-dasharray:8,8;}#mermaid-svg-f0Gr0cmMbvaba3U8 .node rect,#mermaid-svg-f0Gr0cmMbvaba3U8 .node circle,#mermaid-svg-f0Gr0cmMbvaba3U8 .node ellipse,#mermaid-svg-f0Gr0cmMbvaba3U8 .node polygon{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-f0Gr0cmMbvaba3U8 .relationshipLine{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-f0Gr0cmMbvaba3U8 .marker{fill:none!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-f0Gr0cmMbvaba3U8 .edgeLabel{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-f0Gr0cmMbvaba3U8 .edgeLabel .label rect{fill:rgba(232,232,232, 0.8);}#mermaid-svg-f0Gr0cmMbvaba3U8 .edgeLabel .label text{fill:#333;}#mermaid-svg-f0Gr0cmMbvaba3U8 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} makes
is borrowed
READER
string
reader_id
PK
string
name
string
phone
int
max_borrow
BORROW
string
borrow_id
PK
string
reader_id
FK
string
book_id
FK
date
borrow_date
date
return_date
string
status
BOOK
string
book_id
PK
string
title
string
author
int
stock

(六)状态转换图

借阅状态转换图:
#mermaid-svg-LH3a12iCBGAcwh0O{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-LH3a12iCBGAcwh0O .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-LH3a12iCBGAcwh0O .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-LH3a12iCBGAcwh0O .error-icon{fill:#552222;}#mermaid-svg-LH3a12iCBGAcwh0O .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-LH3a12iCBGAcwh0O .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-LH3a12iCBGAcwh0O .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-LH3a12iCBGAcwh0O .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-LH3a12iCBGAcwh0O .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-LH3a12iCBGAcwh0O .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-LH3a12iCBGAcwh0O .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-LH3a12iCBGAcwh0O .marker{fill:#333333;stroke:#333333;}#mermaid-svg-LH3a12iCBGAcwh0O .marker.cross{stroke:#333333;}#mermaid-svg-LH3a12iCBGAcwh0O svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-LH3a12iCBGAcwh0O p{margin:0;}#mermaid-svg-LH3a12iCBGAcwh0O defs #statediagram-barbEnd{fill:#333333;stroke:#333333;}#mermaid-svg-LH3a12iCBGAcwh0O g.stateGroup text{fill:#9370DB;stroke:none;font-size:10px;}#mermaid-svg-LH3a12iCBGAcwh0O g.stateGroup text{fill:#333;stroke:none;font-size:10px;}#mermaid-svg-LH3a12iCBGAcwh0O g.stateGroup .state-title{font-weight:bolder;fill:#131300;}#mermaid-svg-LH3a12iCBGAcwh0O g.stateGroup rect{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-LH3a12iCBGAcwh0O g.stateGroup line{stroke:#333333;stroke-width:1;}#mermaid-svg-LH3a12iCBGAcwh0O .transition{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-LH3a12iCBGAcwh0O .stateGroup .composit{fill:white;border-bottom:1px;}#mermaid-svg-LH3a12iCBGAcwh0O .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px;}#mermaid-svg-LH3a12iCBGAcwh0O .state-note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-LH3a12iCBGAcwh0O .state-note text{fill:black;stroke:none;font-size:10px;}#mermaid-svg-LH3a12iCBGAcwh0O .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#mermaid-svg-LH3a12iCBGAcwh0O .edgeLabel .label rect{fill:#ECECFF;opacity:0.5;}#mermaid-svg-LH3a12iCBGAcwh0O .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-LH3a12iCBGAcwh0O .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-LH3a12iCBGAcwh0O .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-LH3a12iCBGAcwh0O .edgeLabel .label text{fill:#333;}#mermaid-svg-LH3a12iCBGAcwh0O .label div .edgeLabel{color:#333;}#mermaid-svg-LH3a12iCBGAcwh0O .stateLabel text{fill:#131300;font-size:10px;font-weight:bold;}#mermaid-svg-LH3a12iCBGAcwh0O .node circle.state-start{fill:#333333;stroke:#333333;}#mermaid-svg-LH3a12iCBGAcwh0O .node .fork-join{fill:#333333;stroke:#333333;}#mermaid-svg-LH3a12iCBGAcwh0O .node circle.state-end{fill:#9370DB;stroke:white;stroke-width:1.5;}#mermaid-svg-LH3a12iCBGAcwh0O .end-state-inner{fill:white;stroke-width:1.5;}#mermaid-svg-LH3a12iCBGAcwh0O .node rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-LH3a12iCBGAcwh0O .node polygon{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-LH3a12iCBGAcwh0O #statediagram-barbEnd{fill:#333333;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-cluster rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-LH3a12iCBGAcwh0O .cluster-label,#mermaid-svg-LH3a12iCBGAcwh0O .nodeLabel{color:#131300;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-cluster rect.outer{rx:5px;ry:5px;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-state .divider{stroke:#9370DB;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-state .title-state{rx:5px;ry:5px;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-cluster.statediagram-cluster .inner{fill:white;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-cluster.statediagram-cluster-alt .inner{fill:#f0f0f0;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-cluster .inner{rx:0;ry:0;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-state rect.basic{rx:5px;ry:5px;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#f0f0f0;}#mermaid-svg-LH3a12iCBGAcwh0O .note-edge{stroke-dasharray:5;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-note text{fill:black;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram-note .nodeLabel{color:black;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagram .edgeLabel{color:red;}#mermaid-svg-LH3a12iCBGAcwh0O #dependencyStart,#mermaid-svg-LH3a12iCBGAcwh0O #dependencyEnd{fill:#333333;stroke:#333333;stroke-width:1;}#mermaid-svg-LH3a12iCBGAcwh0O .statediagramTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-LH3a12iCBGAcwh0O :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 归还图书
超过期限
归还图书
缴纳罚款
借阅中
已归还
已逾期
已罚款

📝 总结

结构化分析是一种经典的软件需求分析方法。

🎯 基本概念:结构化分析采用自顶向下、逐步求精的策略;以数据流为中心进行分析;使用数据流图、数据字典等工具建立系统逻辑模型。

📦 数据流图:DFD是SA的核心工具;分为顶层、0层、1层等多个层次;描述系统的数据流动和处理过程;遵循数据守恒等绘制规则。

🌐 数据字典:DD是对DFD中数据元素的精确定义;包括数据项、数据结构、数据流、数据存储、加工等;使用符号化语言进行定义。

📋 ER图:描述系统的数据结构;包括实体、属性、关系;定义实体之间的关系(1:1、1:N、M:N)。

💡 状态转换图:描述系统的行为模型;包括状态、事件、转换;描述系统状态的变化过程。


核心启示:结构化分析是软件需求分析的经典方法,虽然面向对象方法现在更加流行,但SA方法仍然有其独特的价值。它的优势在于:第一,思路清晰,自顶向下逐步分解;第二,图形化表达,直观易懂;第三,有严格的规范和标准;第四,特别适合数据处理类系统。在实际工作中,我们可以根据项目特点选择合适的方法:数据处理系统可以选择SA方法;复杂系统可以选择面向对象方法;需求不明确时可以使用原型法。无论选择哪种方法,关键是要建立完整、准确、一致的需求模型,为后续的设计和实现奠定坚实的基础。


相关推荐
郝学胜-神的一滴15 小时前
游戏引擎原理与实践 01:聊聊游戏引擎的前世今生
开发语言·c++·游戏引擎·产品运营·软件工程·产品经理·untiy
workflower17 小时前
企业竞争要素变迁,智能型企业走向新四化
人工智能·机器学习·机器人·无人机·软件工程
盖伦发发7 天前
软件工程SOLID 五大设计原则
后端·软件工程
Old Uncle Tom7 天前
评测即生死:Agent 时代的可靠性重构
人工智能·软件工程·agent
建筑工程企业管理系统7 天前
工程建设管理信息系统如何选型?多项目协同管控避坑指南
大数据·软件工程·软件需求
黄昏回响8 天前
软件工程基础知识(五):软件测试详解(下篇)——现代测试实践与论文指导
网络·其他·软件工程·改行学it
梁辰兴10 天前
软件工程:McCall软件质量因素
软件工程·梁辰兴·mccall软件质量因素·mccall模型·产品运行·产品修正·产品转移
爱码小白11 天前
开发在线部署工具,读懂组织管理:从代码架构悟创业底层逻辑
软件工程
梁辰兴12 天前
软件工程:软件维护的副作用
数据库·软件工程·梁辰兴·控制方法·软件维护的副作用·副作用类型·副作用原因