API 1.0.28+2 ExercisePlan type
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import org.hibernate.annotations.Fetch
|
||||
import org.hibernate.annotations.FetchMode
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.*
|
||||
|
||||
@@ -12,18 +10,12 @@ data class ExercisePlan(
|
||||
@get: NonNull var description: String? = null,
|
||||
@get: NonNull var private: Boolean = false,
|
||||
@get: NonNull var dateAdd: String? = null,
|
||||
@get: NonNull var dateUpd: String? = null
|
||||
@get: NonNull var dateUpd: String? = null,
|
||||
@get: NonNull var type: String? = null,
|
||||
) {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
var exercisePlanId: Int = 0
|
||||
|
||||
|
||||
|
||||
/* @OneToMany(fetch = FetchType.LAZY, mappedBy = "exercisePlan")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val planDetailList: List<ExercisePlanDetail> = mutableListOf<ExercisePlanDetail>()
|
||||
|
||||
*/
|
||||
}
|
||||
@@ -8,8 +8,8 @@ import org.springframework.stereotype.Repository
|
||||
@Repository
|
||||
interface ExercisePlanRepository: JpaRepository<ExercisePlan, Int> {
|
||||
@Query(" FROM ExercisePlan" +
|
||||
" WHERE customerId = :customerId AND private = 1" +
|
||||
" AND dateAdd in (select Max(dateAdd) from ExercisePlan where customerId = :customerId and private = 1) "+
|
||||
" WHERE customerId = :customerId AND private = 1 AND type is NULL" +
|
||||
" AND dateAdd in (select Max(dateAdd) from ExercisePlan where customerId = :customerId and private = 1 AND type is NULL) "+
|
||||
" GROUP BY customerId"
|
||||
)
|
||||
fun getLastExercisePlan(customerId: Long): ExercisePlan?
|
||||
|
||||
Reference in New Issue
Block a user