Compare commits
2 Commits
e45fe1bf10
...
2ab2a04748
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ab2a04748 | |||
| fb0a9e98a1 |
@@ -26,7 +26,8 @@ class AdminCanQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : A
|
|||||||
can1.can,
|
can1.can,
|
||||||
can1.rewardCan,
|
can1.rewardCan,
|
||||||
can1.price,
|
can1.price,
|
||||||
can1.currency
|
can1.currency,
|
||||||
|
can1.price.stringValue()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.from(can1)
|
.from(can1)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ class CanController(private val service: CanService) {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
fun getCans(request: HttpServletRequest): ApiResponse<List<CanResponse>> {
|
fun getCans(request: HttpServletRequest): ApiResponse<List<CanResponse>> {
|
||||||
val geoCountry = request.getAttribute("geoCountry") as? GeoCountry ?: GeoCountry.OTHER
|
val geoCountry = request.getAttribute("geoCountry") as? GeoCountry ?: GeoCountry.OTHER
|
||||||
println("geoCountry: $geoCountry")
|
|
||||||
return ApiResponse.ok(service.getCans(geoCountry))
|
return ApiResponse.ok(service.getCans(geoCountry))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ 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>
|
||||||
@@ -33,24 +32,6 @@ 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
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.from(can1)
|
|
||||||
.where(can1.status.eq(status))
|
|
||||||
.orderBy(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(
|
||||||
@@ -60,7 +41,8 @@ class CanQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : CanQue
|
|||||||
can1.can,
|
can1.can,
|
||||||
can1.rewardCan,
|
can1.rewardCan,
|
||||||
can1.price,
|
can1.price,
|
||||||
can1.currency
|
can1.currency,
|
||||||
|
can1.price.stringValue()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.from(can1)
|
.from(can1)
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ data class CanResponse @QueryProjection constructor(
|
|||||||
val can: Int,
|
val can: Int,
|
||||||
val rewardCan: Int,
|
val rewardCan: Int,
|
||||||
val price: BigDecimal,
|
val price: BigDecimal,
|
||||||
val currency: String
|
val currency: String,
|
||||||
|
val priceStr: String
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user