-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afdcace
commit ced65ff
Showing
5 changed files
with
78 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseCount.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.hero.alignlab.domain.pose.domain | ||
|
||
import jakarta.persistence.* | ||
import java.time.LocalDate | ||
|
||
@Entity | ||
@Table(name = "pose_count") | ||
class PoseCount( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
val id: Long = -1, | ||
|
||
@Column(name = "uid") | ||
val uid: Long, | ||
|
||
/** 집계 데이터 */ | ||
@Column(name = "total_count") | ||
@Convert(converter = PoseTotalCountConverter::class) | ||
val totalCount: PoseTotalCount, | ||
|
||
/** 기준 날짜 */ | ||
@Column(name = "`date`") | ||
val date: LocalDate, | ||
) |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseTotalCount.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.hero.alignlab.domain.pose.domain | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import java.io.Serializable | ||
|
||
/** 집계 데이터를 관리 */ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class PoseTotalCount( | ||
val count: Map<PoseType, Int>, | ||
) : Serializable |
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseTotalCountConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.hero.alignlab.domain.pose.domain | ||
|
||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import com.hero.alignlab.common.extension.mapper | ||
import jakarta.persistence.AttributeConverter | ||
import jakarta.persistence.Converter | ||
|
||
@Converter | ||
class PoseTotalCountConverter : AttributeConverter<PoseTotalCount, String> { | ||
override fun convertToDatabaseColumn(attribute: PoseTotalCount): String { | ||
return mapper.writeValueAsString(attribute) | ||
} | ||
|
||
override fun convertToEntityAttribute(dbData: String): PoseTotalCount { | ||
return mapper.readValue(dbData) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/hero/alignlab/domain/pose/infrastructure/PoseCountRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.hero.alignlab.domain.pose.infrastructure | ||
|
||
import com.hero.alignlab.domain.pose.domain.PoseCount | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
import org.springframework.stereotype.Repository | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Transactional(readOnly = true) | ||
@Repository | ||
interface PoseCountRepository : JpaRepository<PoseCount, Long> |