Compare commits

...

2 Commits

Author SHA1 Message Date
2ab2a04748 feat(can): 캔 응답 - String 형태 가격 필드 추가 2025-10-02 15:07:57 +09:00
fb0a9e98a1 사용하지 않는 print 제거 2025-10-02 12:20:25 +09:00
4 changed files with 6 additions and 23 deletions

View File

@@ -26,7 +26,8 @@ class AdminCanQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : A
can1.can,
can1.rewardCan,
can1.price,
can1.currency
can1.currency,
can1.price.stringValue()
)
)
.from(can1)

View File

@@ -18,7 +18,6 @@ class CanController(private val service: CanService) {
@GetMapping
fun getCans(request: HttpServletRequest): ApiResponse<List<CanResponse>> {
val geoCountry = request.getAttribute("geoCountry") as? GeoCountry ?: GeoCountry.OTHER
println("geoCountry: $geoCountry")
return ApiResponse.ok(service.getCans(geoCountry))
}

View File

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

View File

@@ -9,5 +9,6 @@ data class CanResponse @QueryProjection constructor(
val can: Int,
val rewardCan: Int,
val price: BigDecimal,
val currency: String
val currency: String,
val priceStr: String
)