Skip to content

Commit

Permalink
[Refactor] Payment, point내 변수명 및 폴더 위치 정렬 #142
Browse files Browse the repository at this point in the history
  • Loading branch information
ashd89 committed Aug 8, 2024
1 parent 73f60c9 commit c2d4a43
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

Expand All @@ -20,4 +21,9 @@ public interface JpaExchangeRepository extends JpaRepository<ExchangeEntity,Long
"WHERE e.reservation2.user.id = :userId"
)
List<ExchangeEntity> findExchangeByUser (Long userId, Pageable page);

@Query("SELECT COUNT(r) FROM ReservationEntity r " +
"JOIN r.user u " +
"WHERE u.id = :userId")
Long countReservationsByUserId(@Param("userId") Long userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ public class PaymentEntity {
private String payType;
private Boolean verify;

//@ManyToOne
//@JoinColumn(name = "user_id")
//private User user;

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reservation_id")
private ReservationEntity reservationEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.gamja.tiggle.point.adapter.out.verify;
package com.gamja.tiggle.point.adapter.out.persistence;

import com.gamja.tiggle.common.BaseException;
import com.gamja.tiggle.point.adapter.out.persistence.JpaPointRepository;
import com.gamja.tiggle.point.adapter.out.persistence.PointEntity;
import com.gamja.tiggle.point.application.port.out.PointHistoryPort;
import com.gamja.tiggle.point.domain.GetOrUse;
import com.gamja.tiggle.point.domain.PointHistory;
Expand All @@ -22,11 +20,11 @@ public class PointHistoryAdapter implements PointHistoryPort {
private final JpaUserRepository jpaUserRepository;

@Override
public List<PointHistory> findPointHistorybyUserId(Long userId, GetOrUse method) {
public List<PointHistory> findPointHistorybyUserId(Long userId, GetOrUse useType) {
List<PointHistory> pointHistoryList = new ArrayList<>();

List<PointEntity> pointEntityList = jpaPointRepository.findAllByUserEntity_Id(userId);
if (method.equals(GetOrUse.ALL)){
if (useType.equals(GetOrUse.ALL)){
for (PointEntity p : pointEntityList){
PointHistory pointHistory = PointHistory.builder()
.id(p.getId())
Expand All @@ -43,7 +41,7 @@ public List<PointHistory> findPointHistorybyUserId(Long userId, GetOrUse method)
}
else {
for (PointEntity p : pointEntityList) {
if (p.getGetOrUse().equals(method)) {
if (p.getGetOrUse().equals(useType)) {
PointHistory pointHistory = PointHistory.builder()
.id(p.getId())
.userId(p.getUserEntity().getId())
Expand Down

0 comments on commit c2d4a43

Please sign in to comment.