diff --git a/src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java b/src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java index df6d8f6..8817122 100644 --- a/src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java +++ b/src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java @@ -3,10 +3,28 @@ package com.example.demo.app.infra.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import com.example.demo.app.domain.model.CourseInfoModel; import com.example.demo.app.infra.entity.AllocationEntity; public interface AllocationRepository extends JpaRepository{ List findByCourseId(Long courseId); + + @Query(" SELECT co.course_id, " + + " co.course_name, " + + " ca.category_id, " + + " ca.categpry_name, " + + " a.allocation_ratio " + + " FROM allocation_m a " + + " INNER JOIN course_m co " + + " ON a.course_id = co.course_id " + + " INNER JOIN category_t ca " + + " on a.category_id = ca.category_id " + + " WHERE ca.transaction_type = 0 " + + " ORDER BY a.course_id ASC, " + + " a.category_id ASC ") + List findAllJoinedAllocation(); + }