ADD file via upload

main
p46nuwtki 4 months ago
parent 4c5a410a67
commit 89a5587f70

@ -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<EmployeeChangeRecord>
+ 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<EmployeeChangeRecord>
+ getChangeRecordsByType(changeType: ChangeType): List<EmployeeChangeRecord>
+ getAllChangeRecords(): List<EmployeeChangeRecord>
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>
+ 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<Course>
- trainingRecords: List<TrainingRecord>
- certificates: List<Certificate>
+ 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<TrainingRecord>
+ getEmployeeCertificates(employeeId: String): List<Certificate>
+ searchCourses(keyword: String): List<Course>
+ checkCertificateValidity(certificateId: String): boolean
}
}
' 关系定义
EmployeeHistory --> Employee
TrainingRecord --> Employee : (隐式通过employeeId)
Certificate --> Employee : (隐式通过employeeId)
TrainingSystem --> Course
TrainingSystem --> TrainingRecord
TrainingSystem --> Certificate
@enduml
Loading…
Cancel
Save