Compare commits
6 Commits
7f828657ad
...
0c19adb63f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c19adb63f | ||
|
|
f86d47c17a | ||
| a98554ac69 | |||
|
|
cf31d03415 | ||
|
|
80d83b96f4 | ||
| 72477d014b |
@@ -6,12 +6,11 @@ import jakarta.persistence.Column;
|
|||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
import jakarta.persistence.GenerationType;
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.OneToMany;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import org.springframework.data.annotation.Id;
|
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.CourseModel;
|
import com.example.demo.app.domain.model.CourseModel;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -41,7 +40,7 @@ public class CourseEntity {
|
|||||||
private List<UserEntity> userEntity;
|
private List<UserEntity> userEntity;
|
||||||
|
|
||||||
@OneToOne(mappedBy = "courseEntity")
|
@OneToOne(mappedBy = "courseEntity")
|
||||||
private List<AllocationEntity> allocationEntity;
|
private AllocationEntity allocationEntity;
|
||||||
|
|
||||||
|
|
||||||
public static List<CourseModel> createCourseModelList(List<CourseEntity> courseEntityList) {
|
public static List<CourseModel> createCourseModelList(List<CourseEntity> courseEntityList) {
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ public class QuestionEntity {
|
|||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "secret_question_id")
|
@Column(name = "secret_question_id")
|
||||||
private Integer secretQuestionId;
|
private Long secretQuestionId;
|
||||||
|
|
||||||
@Column(name = "question_text", nullable = false)
|
@Column(name = "question_text", nullable = false)
|
||||||
private String questionText;
|
private String questionText;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "QuestionEntity")
|
@OneToMany(mappedBy = "questionEntity")
|
||||||
private List<UserEntity> userEntity;
|
private List<UserEntity> userEntity;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,28 @@ package com.example.demo.app.infra.repository;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
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;
|
import com.example.demo.app.infra.entity.AllocationEntity;
|
||||||
|
|
||||||
public interface AllocationRepository extends JpaRepository<AllocationEntity, Long>{
|
public interface AllocationRepository extends JpaRepository<AllocationEntity, Long>{
|
||||||
|
|
||||||
List<AllocationEntity> findByCourseId(Long courseId);
|
List<AllocationEntity> 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<CourseInfoModel> findAllJoinedAllocation();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user