The project is a Spring Boot application for managing student information. Here is a brief explanation of the key components:
-
StudentServiceInterface:- Defines the contract for student-related operations such as getting a student, getting all students, adding a new student, deleting a student, and updating a student.
-
StudentServiceImplClass:- Implements the
StudentServiceinterface. - Contains methods to handle CRUD operations for students.
- Uses
StudentMapperto interact with the database. - Methods include:
getStudent(Long studentId): Retrieves a student by ID.getStudents(): Retrieves all students.addNewStudent(StudentDto studentDto): Adds a new student.deleteStudent(Long studentId): Deletes a student by ID.updateStudent(StudentDto studentDto): Updates a student's information.
- Implements the
-
StudentMapperInterface:- Extends
BaseMapperto provide CRUD operations forStudententities. - Contains custom query methods such as
findStudentByEmail(String email).
- Extends
-
StudentClass:- Represents the student entity with fields such as ID, name, email, and date of birth.
-
StudentDtoClass:- Data Transfer Object for transferring student data between layers.
- Includes fields such as ID, name, email, date of birth, and age.
- Contains logic to calculate the age based on the date of birth.
-
StudentConfigClass:- Configuration class that initializes some student data using
CommandLineRunner. - Truncates the
studenttable at startup to reset IDs.
- Configuration class that initializes some student data using
-
Unit Tests:
StudentServiceImplTestclass contains unit tests for theStudentServiceImplclass using Mockito for mocking dependencies.
The project uses Java, Spring Boot, MyBatis Plus, and Maven for dependency management.