From f86d47c17a72eda5393dd5de73d172aaab00fcfd Mon Sep 17 00:00:00 2001 From: kkazuya Date: Thu, 17 Sep 2026 14:20:34 +0900 Subject: [PATCH] =?UTF-8?q?[EDIT]=20AllocationRepository=E3=81=AB=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E4=B8=80=E8=A6=A7=E3=81=AB=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=83=87=E3=83=BC=E3=82=BF=E3=82=92=E5=8F=96?= =?UTF-8?q?=E5=BE=97=E3=81=99=E3=82=8B@Query=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/repository/AllocationRepository.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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(); + }