后语
1.优快云时序图的mermaid画法
画类图和时序图,注意时序图是把发信息的人的主语抽离。就好像这个
我:Hello , can you speak chinese?
小明:yes
我 :where 's the ZhongShanPark?
小明:i don’t know ,maybe you can ask others
我:Hello,can you speak chinese?
小王:yes
我:where’s the ZhongshanPark
小王:oh,it’s in XXX
注意到了这个是不停的重复代码,可以适当抽象进行复用
这个时序图的优快云 mermaid 代码
```mermaid
sequenceDiagram
Title: 测试
participant A as 我
participant B as 其他人
loop Every people
activate A
A->>B : askCanYouSpeakQuestion()
Note right of B: 这里是个边界备注.
activate B
alt 知道
B-->>A: letHimKnowTheWay()
else 不知道
B-->>A: letHimAskAnotherOne()
end
A->>B:askWhereQuestion()
alt 知道
B-->>A: letHimKnowTheWay()
else 不知道
B-->>A: letHimAskAnotherOne()
end
deactivate B
deactivate A
end
参考:https://mermaidjs.github.io/sequenceDiagram.html
2.优快云流程图的mermaid代码
流程图基础参考迂者-贺利坚blog
https://mermaidjs.github.io/flowchart.html
我们把askWhereQuestion进行更细分
marmaid代码
GQNB_1= getQuestionNumberById _1
A_1 = ask_1 别名
M_1 = main_1 别名
```mermaid
graph TB
subgraph getQuestionNumberById
GQNB_1[paramIsVlidate]-->GQNB_2[perpareSearchParam]
GQNB_2-->GQNB_3[runSql]
end
subgraph ask
A_1[dataIsValidate data]-->A_2[run data]
end
subgraph main
M_1[define questionNumber,dictory,id]-->GQNB_1[call getQuestionNumberById id]
GQNB_3-->M_3(data = getQuestionNumberById)
M_3-->M_4{data is null ?}
M_4-->|YES|A_1
M_4-->|NO|M_5[return dictory is not find]
end
甘特图