Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
[#22] repository 작은 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
chanhyeong committed Oct 31, 2021
1 parent 2a0f6e6 commit 49fb330
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package com.sns.user.component.test.repositories

import com.sns.commons.utils.log
import com.sns.user.component.test.domains.TestUser
import org.slf4j.LoggerFactory
import org.springframework.data.repository.CrudRepository
import org.springframework.jdbc.core.JdbcTemplate
import org.springframework.stereotype.Repository

@Repository
class DefaultTestUserRepository(val jdbcTemplate: JdbcTemplate) : TestUserRepository {
private val log = LoggerFactory.getLogger(javaClass)
class DefaultTestUserRepository(
private val jdbcTemplate: JdbcTemplate,
private val testUserCRUDRepository: TestUserCRUDRepository
) : TestUserRepository,
CrudRepository<TestUser, Int> by testUserCRUDRepository {
private val log = log()

override fun save(nickName: String): Int {
return jdbcTemplate.update("INSERT INTO test_user (`nick_name`) VALUES(?)", nickName)
Expand All @@ -25,7 +30,7 @@ class DefaultTestUserRepository(val jdbcTemplate: JdbcTemplate) : TestUserReposi
WHERE nick_name = ?
LIMIT 1
""",
TestUser.MAPPER, nickName
TestUser.MAPPER, nickName,
) ?: TestUser()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import com.sns.user.component.test.domains.TestUser

interface TestUserRepository {
fun save(nickName: String): Int
fun save(user: TestUser): Int
fun save(user: TestUser): TestUser
fun findByNickName(nickName: String): TestUser
}

0 comments on commit 49fb330

Please sign in to comment.