Skip to content

Commit

Permalink
Validate to show course that have content
Browse files Browse the repository at this point in the history
  • Loading branch information
PoserDungeon2003 committed Nov 5, 2023
1 parent 534c1de commit ec6e8bb
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

@Repository
public interface CourseRepository extends JpaRepository<Course, BigDecimal> {
@Query(value = "SELECT c FROM course c",
@Query(value = "SELECT c FROM course c WHERE c.id IN ( SELECT s.course.id FROM section s JOIN course_content cc ON s.id = cc.section.id WHERE cc.section.id IS NOT NULL )",
countQuery = "SELECT count(*) FROM course c")
public Page<Course>getCourseOnPaging(Pageable pageable);

@Query(value = "SELECT u FROM course u WHERE u.name LIKE %:searchName%",
@Query(value = "SELECT u FROM course u WHERE u.name LIKE %:searchName% AND u.id IN ( SELECT s.course.id FROM section s JOIN course_content cc ON s.id = cc.section.id WHERE cc.section.id IS NOT NULL )",
countQuery = "SELECT count(*) FROM course u WHERE u.name LIKE %:searchName%")
public Page<Course> searchCourseByNameAndFilter(@Param(value = "searchName") String searchName, Pageable pageable);
@Query(value = "SELECT u FROM course u WHERE u.id IN :coursesID"
Expand Down

0 comments on commit ec6e8bb

Please sign in to comment.