API 1.0.18 Tree Parents
This commit is contained in:
@@ -23,4 +23,9 @@ data class ExerciseTree (
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseTree")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val translations: List<ExerciseTreeTranslation> = mutableListOf<ExerciseTreeTranslation>().toList()
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseTreeChild")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val parents: List<ExerciseTreeParents> = mutableListOf<ExerciseTreeParents>().toList()
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@Entity
|
||||
data class ExerciseTreeParents (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
var exerciseTreeParentsId: Long = 0,
|
||||
@get: NotNull var exerciseTreeParentId: Long?
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "exerciseTreeChildId", nullable = false)
|
||||
@JsonIgnore
|
||||
val exerciseTreeChild: ExerciseTree? = null
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ interface ExerciseTreeRepository : JpaRepository<ExerciseTree, Long> {
|
||||
|
||||
@Query("FROM ExerciseTree as e " +
|
||||
"LEFT JOIN ExerciseTreeTranslation as t ON e.treeId = t.exerciseTree AND t.languageCode = 'hu' " +
|
||||
"LEFT JOIN ExerciseTreeParents as p ON e.treeId = p.exerciseTreeChild " +
|
||||
"WHERE e.active = 1 " +
|
||||
"ORDER BY e.treeId ")
|
||||
fun getActiveMenu(): List<ExerciseTree>
|
||||
|
||||
Reference in New Issue
Block a user