-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClassesExampleInvoices.puml
43 lines (38 loc) · 1.23 KB
/
ClassesExampleInvoices.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@startuml (id=invoices)
class invoices <<entity>> {
+ id : integer {PK} {unique}
+ date :date {required}
+ customer : integer {required}
}
@enduml
@startuml (id=invoicesDetails)
class invoicesDetails <<entity>> {
+ id : integer {PK} {unique}
+ product : integer {PK} {unique}
+ quantity :integer {required}
+ price :integer {required}
}
@enduml
@startuml (id=customers)
class customers <<entity>> {
+ id :integer {PK} {unique}
+ name :string {required}
}
@enduml
@startuml (id=products)
class products <<entity>> {
+ id :integer {PK} {unique}
+ name :string {required}
}
@enduml
@startuml(id=relations)
!procedure $relations($class1, $class2)
!if ($class1=="invoices" && $class2=="invoicesDetails") || ($class1=="invoicesDetails" && $class2=="invoices")
invoices -- invoicesDetails :invoices.id = invoicesDetails.id
!elseif ($class1=="invoices" && $class2=="customers") || ($class1=="customers" && $class2=="invoices")
invoices -- customers :invoices.id = customers.id
!elseif ($class1=="invoicesDetails" && $class2=="products") || ($class1=="products" && $class2=="invoicesDetails")
invoicesDetails -- products :invoicesDetails.id = products.id
!endif
!endprocedure
@enduml