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
@Transactional | |
fun saveCategory(dto:CategorySaveReq, idAncestor: Long?): Category? { | |
val category = categoryRepository.saveCategory(dto.toEntity()) | |
categoryRepository.saveCategoryClosure(category?.id!!, idAncestor ) | |
return category | |
} | |
override fun saveCategoryClosure(idDescendant: Long, idAncestor: Long?) { |
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
@Configuration(proxyBeanMethods = false) | |
class BeanRegistry : ApplicationContextAware { | |
companion object { | |
private lateinit var applicationContext: ApplicationContext | |
// 타입으로 빈을 가져옵니다 | |
fun <T : Any> getBean(type: KClass<T>): T = | |
applicationContext.getBean(type.java) | |
// 이름과 타입으로 빈을 가져옵니다 | |
fun <T : Any> getBean(name: String, type: KClass<T>): T = |
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
@Test | |
@DisplayName("s3파일 업로드 테스트") | |
fun s3FileUploadTest(){ | |
val imgPath = "src/main/resources/static/img" | |
val mockFile:MultipartFile = MockMultipartFile( | |
"test1", | |
"test1.png", | |
"image/png", |
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
val fetch = queryFactory.listQuery<Song> { | |
select(entity(Song::class)) | |
from(entity(Song::class)) | |
fetch(Song::album, JoinType.LEFT) | |
offset(pageable.offset.toInt()) | |
limit(pageable.pageSize) | |
where( | |
isSongSearchable(searchCondition, Song::deletedAt) | |
) |
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
fun readDataFromCsv(filePath: String): List<List<String>?> { | |
var csvList: MutableList<List<String>?> = mutableListOf() | |
val csv = java.io.File(filePath) | |
try { | |
BufferedReader(FileReader(csv)).use { br -> | |
var line: String? | |
while (br.readLine().also { line = it } != null) { | |
//println("line $line") | |
val split: List<String>? = line?.split(",") |
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
fun <T> readJsonArrayFile(filePath: String): List<Map<*, *>?>? { | |
val mapper = ObjectMapper() | |
//val readFileAsString = readFileAsString(filePath) | |
//println(readFileAsString) | |
val myObjects = mapper.readValue(File(filePath), object : TypeReference<List<Map<*, *>?>>() {}) | |
// for (obj in myObjects) { | |
// println(obj) | |
// } | |
return myObjects |
NewerOlder