Class StudentRepositoryImpl

java.lang.Object
org.example.crmedu.infrastructure.repository.student.StudentRepositoryImpl
All Implemented Interfaces:
StudentRepository

@Component public class StudentRepositoryImpl extends Object implements StudentRepository
Implementation of the StudentRepository interface. Provides methods for managing Student entities in the database.
  • Constructor Details

    • StudentRepositoryImpl

      public StudentRepositoryImpl()
  • Method Details

    • save

      public Student save(Student student)
      Description copied from interface: StudentRepository
      Saves a new student or updates an existing one.
      Specified by:
      save in interface StudentRepository
      Parameters:
      student - the student to save
      Returns:
      the saved Student entity
    • findById

      public Optional<Student> findById(Long id)
      Description copied from interface: StudentRepository
      Retrieves a student by its unique identifier.
      Specified by:
      findById in interface StudentRepository
      Parameters:
      id - the unique identifier of the student
      Returns:
      an Optional containing the student if found, otherwise empty
    • existsByEmailAndPhoneInOrganization

      public boolean existsByEmailAndPhoneInOrganization(Student student)
      Description copied from interface: StudentRepository
      Checks whether a student with this email and phone exists in this organization.
      Specified by:
      existsByEmailAndPhoneInOrganization in interface StudentRepository
      Parameters:
      student - the student to check
      Returns:
      true if a student with the same email and phone exists in this organization, otherwise false
    • findAll

      public Page<Student> findAll(int pageNumber, int pageSize)
      Description copied from interface: StudentRepository
      Retrieves a paginated list of students.
      Specified by:
      findAll in interface StudentRepository
      Parameters:
      pageNumber - the page number (starting from 0)
      pageSize - the number of students per page
      Returns:
      a Page containing the requested students
    • update

      public void update(Student student)
      Description copied from interface: StudentRepository
      Updates an existing student.
      Specified by:
      update in interface StudentRepository
      Parameters:
      student - the student entity with updated information
    • delete

      public void delete(Long id)
      Description copied from interface: StudentRepository
      Deletes a student by its unique identifier.
      Specified by:
      delete in interface StudentRepository
      Parameters:
      id - the unique identifier of the student to delete