Data - Mermaid - Graph
1、原始数据
root
包含1
1包含1.1, 1.2
包含2
2包含2.1, 2.2,2.3
帮我生成mermaid格式
2、生成mermaid
随便一个大模型,让它生成mermaid格式
structure = {
"root": ["1", "2"],
"1": ["1.1", "1.2"],
"2": ["2.1", "2.2", "2.3"]
}
graph TD; // TD表示竖直的,LR表示左向右的
root
root --> 1
root --> 2
1
1 --> 1.1
1 --> 1.2
2
2 --> 2.1
2 --> 2.2
2 --> 2.3
3、 使用drawio生成图
mermaid_graph.png
3.1、生成uml图
测试了一些大模型,gemini能力还是强一些,让gemini把uml图片识别出来转为mermaid格式。
然后再使用drawio生成uml类图,这样就可以编辑了
如:
mermaid_uml_source.png
classDiagram
direction LR
class Account {
+String accountId
+String passWord
+String accountName
+login()
}
class Teacher {
+String teacherId
+String teacherName
+String accountId
+String mobile
+String ownerMobile
+String classId
+String orgId
+String schoolId
+addTeacher()
+deleteTeacher()
+editTeacher()
+getTeacher()
}
class Student {
+String studentId
+String studentName
+String accountId
+String mobile
+String studentStatus
+String studentNumber
+String admissionNumber
+String classId
+String school_id
+addStudent()
+deleteStudent()
+editStudent()
+getStudent()
}
class Parent {
+String parentId
+String parentName
+String accountId
+String mobile
+String studentId
+addStudentParent()
+deleteStudentParent()
+editStudentParent()
+getStudentParent()
}
class school_org {
+String schoolOrgId
+String parentSchoolOrgId
+String schoolId
+String schoolOrgName
+String schoolOrgSequence
+String level
+addSchoolOrg()
+deleteSchoolOrg()
+editSchoolOrg()
+getSchoolOrg()
+addSchoolOrgTeacher()
+deleteSchoolOrgTeacher()
+getSchoolOrgTeacher()
+getSchoolOrgTeacherList()
}
class grade_group {
+String groupId
+String gradeId
+String schoolId
+String groupName
+String groupType
+String classType
+String groupSequence
+addClass()
+deleteClass()
+editClass()
+getClass()
+addClassTeacher()
+deleteClassTeacher()
+getClassTeacher()
+getClassTeacherList()
+addClassStudent()
+deleteClassStudent()
+getClassStudent()
+getClassStudentList()
}
class School {
+String schoolId
+String schoolName
+String schoolShortName
+String schoolType
+String schoolNature
+String provinceCode
+String provinceName
+String cityCode
+String cityName
+String countyCode
+String countyName
+addSchool()
+deleteSchool()
+editSchool()
+getSchool()
+getSchoolList()
+getGradeList()
+getSchoolOrgList()
}
class school_grade {
+String gradeId
+String schoolId
+String gradeName
+String gradePhase
+String yearLength
+String graduationYear
+String gradeSequence
+addGrade()
+deleteGrade()
+editGrade()
+getGrade()
+getGradeClassList()
}
Relationships
Account --> Teacher : has a
Account --> Student : has a
Account --> Parent : has a
Teacher --> school_org : belongs to
Student --> grade_group : belongs to
Parent --> Student : is parent of
school_org --> School : part of
grade_group --> school_grade : belongs to
school_grade --> School : belongs to
mermaid_uml.png
3、像其他er图什么的也可以。
mermaid中文网,可以参考实现各种大模型+mermaid