From 89a5587f702a1d43c72d6e6f0ebf33f377ffb1c4 Mon Sep 17 00:00:00 2001 From: p46nuwtki <1577964316@qq.com> Date: Mon, 27 Oct 2025 11:13:30 +0800 Subject: [PATCH] ADD file via upload --- 挑战题类图.puml | 148 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 挑战题类图.puml diff --git a/挑战题类图.puml b/挑战题类图.puml new file mode 100644 index 0000000..7f2806c --- /dev/null +++ b/挑战题类图.puml @@ -0,0 +1,148 @@ +@startuml 单一职责原则-挑战题类图 + +skinparam backgroundColor white +skinparam handwritten false +skinparam monochrome false +skinparam shadowing false +skinparam roundcorner 8 +skinparam defaultFontName Microsoft YaHei +skinparam defaultFontSize 14 +skinparam packageStyle rectangle +skinparam package { + BackgroundColor LightGray + BorderColor Gray +} +skinparam class { + BackgroundColor White + BorderColor Black + ArrowColor Black +} +skinparam enum { + BackgroundColor White + BorderColor Black +} + +package "com.company.employee.model" { + class Employee { + - id: String + - name: String + - age: int + - department: String + - salary: double + - hireDate: LocalDate + - email: String + - position: String + + getId(): String + + getName(): String + + getDepartment(): String + + getSalary(): double + } +} + +package "com.company.employee.history" { + enum EmployeeHistory.ChangeType { + SALARY_ADJUSTMENT + POSITION_CHANGE + DEPARTMENT_CHANGE + HIRED + TERMINATED + } + + class EmployeeHistory { + - changeRecords: List + + recordSalaryAdjustment(employee: Employee, oldSalary: double, newSalary: double): void + + recordPositionChange(employee: Employee, oldPosition: String, newPosition: String): void + + recordDepartmentChange(employee: Employee, oldDepartment: String, newDepartment: String): void + + recordHire(employee: Employee): void + + recordTermination(employee: Employee, reason: String): void + + getEmployeeHistory(employeeId: String): List + + getChangeRecordsByType(changeType: ChangeType): List + + getAllChangeRecords(): List + + class EmployeeChangeRecord { + - id: String + - employeeId: String + - changeType: ChangeType + - oldValue: String + - newValue: String + - changeDate: LocalDate + - description: String + + getters and setters + } + } +} + +package "com.company.employee.training" { + class Course { + - courseId: String + - title: String + - description: String + - durationHours: int + - instructor: String + - prerequisites: List + + Course(courseId, title, description, durationHours, instructor) + + addPrerequisite(course: Course): void + + removePrerequisite(courseId: String): void + + hasPrerequisites(): boolean + + getters and setters + } + + class TrainingRecord { + - recordId: String + - employeeId: String + - courseId: String + - startDate: LocalDate + - completionDate: LocalDate + - score: int + - grade: String + - status: String + + TrainingRecord(recordId, employeeId, courseId, startDate) + + completeTraining(score: int): void + + cancelTraining(reason: String): void + + calculateGrade(score: int): String + + getTrainingDays(): int + + getters and setters + } + + class Certificate { + - certificateId: String + - employeeId: String + - courseId: String + - certificateNumber: String + - issueDate: LocalDate + - expiryDate: LocalDate + - status: String + + Certificate(certificateId, employeeId, courseId) + + generateCertificateNumber(): String + + isValid(): boolean + + updateStatus(status: String): void + + revoke(reason: String): void + + renew(days: int): void + + getRemainingValidDays(): int + + getters and setters + } + + class TrainingSystem { + - courses: List + - trainingRecords: List + - certificates: List + + addCourse(course: Course): void + + registerEmployeeForTraining(employeeId: String, courseId: String): TrainingRecord + + completeTraining(recordId: String, score: int): TrainingRecord + + issueCertificate(employeeId: String, courseId: String): Certificate + + getEmployeeTrainingHistory(employeeId: String): List + + getEmployeeCertificates(employeeId: String): List + + searchCourses(keyword: String): List + + checkCertificateValidity(certificateId: String): boolean + } +} + +' 关系定义 +EmployeeHistory --> Employee +TrainingRecord --> Employee : (隐式,通过employeeId) +Certificate --> Employee : (隐式,通过employeeId) +TrainingSystem --> Course +TrainingSystem --> TrainingRecord +TrainingSystem --> Certificate + +@enduml \ No newline at end of file