temp(charge): 캔 리스트

- 해외 충전 테스트를 위해 전체 캔 리스트 표시
This commit is contained in:
2025-10-02 19:03:42 +09:00
parent 6327a5d2bf
commit bc378cc619
2 changed files with 21 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ import org.springframework.stereotype.Repository
interface CanRepository : JpaRepository<Can, Long>, CanQueryRepository interface CanRepository : JpaRepository<Can, Long>, CanQueryRepository
interface CanQueryRepository { interface CanQueryRepository {
fun findAllByStatus(status: CanStatus): List<CanResponse>
fun findAllByStatusAndCurrency(status: CanStatus, currency: String): List<CanResponse> fun findAllByStatusAndCurrency(status: CanStatus, currency: String): List<CanResponse>
fun getCanUseStatus(member: Member, pageable: Pageable): List<UseCan> fun getCanUseStatus(member: Member, pageable: Pageable): List<UseCan>
fun getCanChargeStatus(member: Member, pageable: Pageable, container: String): List<Charge> fun getCanChargeStatus(member: Member, pageable: Pageable, container: String): List<Charge>
@@ -32,6 +33,25 @@ interface CanQueryRepository {
@Repository @Repository
class CanQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : CanQueryRepository { class CanQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : CanQueryRepository {
override fun findAllByStatus(status: CanStatus): List<CanResponse> {
return queryFactory
.select(
QCanResponse(
can1.id,
can1.title,
can1.can,
can1.rewardCan,
can1.price,
can1.currency,
can1.price.stringValue()
)
)
.from(can1)
.where(can1.status.eq(status))
.orderBy(can1.currency.asc(), can1.can.asc())
.fetch()
}
override fun findAllByStatusAndCurrency(status: CanStatus, currency: String): List<CanResponse> { override fun findAllByStatusAndCurrency(status: CanStatus, currency: String): List<CanResponse> {
return queryFactory return queryFactory
.select( .select(

View File

@@ -14,7 +14,7 @@ import java.time.format.DateTimeFormatter
class CanService(private val repository: CanRepository) { class CanService(private val repository: CanRepository) {
fun getCans(geoCountry: GeoCountry): List<CanResponse> { fun getCans(geoCountry: GeoCountry): List<CanResponse> {
val currency = when (geoCountry) { val currency = when (geoCountry) {
GeoCountry.KR -> "KRW" GeoCountry.KR -> "USD"
else -> "USD" else -> "USD"
} }
return repository.findAllByStatusAndCurrency(status = CanStatus.SALE, currency = currency) return repository.findAllByStatusAndCurrency(status = CanStatus.SALE, currency = currency)