From e1e226d0ea28850653198db3276c0e73877fd439 Mon Sep 17 00:00:00 2001 From: Park heejung Date: Mon, 25 Apr 2022 00:11:24 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Plan=20date=20=EC=86=8D=EC=84=B1=20?= =?UTF-8?q?=EC=9E=90=EB=A3=8C=ED=98=95=20=EB=B3=80=EA=B2=BD(#15)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/planshare/server/planshare/domain/Plan.java | 5 +++-- .../java/planshare/server/planshare/plan/dto/PlanForm.java | 3 ++- .../server/planshare/plan/repository/JpaPlanRepository.java | 3 ++- .../server/planshare/plan/repository/PlanRepository.java | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/planshare/server/planshare/domain/Plan.java b/src/main/java/planshare/server/planshare/domain/Plan.java index 12f7015..3b492f7 100644 --- a/src/main/java/planshare/server/planshare/domain/Plan.java +++ b/src/main/java/planshare/server/planshare/domain/Plan.java @@ -5,6 +5,7 @@ import javax.persistence.*; import java.time.LocalDate; +import java.time.LocalDateTime; @Entity @Data @@ -19,7 +20,7 @@ public class Plan { private String name; - private LocalDate date; + private LocalDateTime date; // 체크 여부 private boolean checkStatus; @@ -28,7 +29,7 @@ public class Plan { @JoinColumn(name = "g_id") private Goal goal; - public static Plan createPlan(String name, LocalDate date, boolean checkStatus, Goal goal){ + public static Plan createPlan(String name, LocalDateTime date, boolean checkStatus, Goal goal){ Plan plan = new Plan(); plan.name = name; plan.date = date; diff --git a/src/main/java/planshare/server/planshare/plan/dto/PlanForm.java b/src/main/java/planshare/server/planshare/plan/dto/PlanForm.java index 5314d0f..b4faa60 100644 --- a/src/main/java/planshare/server/planshare/plan/dto/PlanForm.java +++ b/src/main/java/planshare/server/planshare/plan/dto/PlanForm.java @@ -6,6 +6,7 @@ import lombok.Setter; import java.time.LocalDate; +import java.time.LocalDateTime; @Getter @Setter @@ -14,6 +15,6 @@ public class PlanForm { private String name; - private LocalDate date; + private LocalDateTime date; } diff --git a/src/main/java/planshare/server/planshare/plan/repository/JpaPlanRepository.java b/src/main/java/planshare/server/planshare/plan/repository/JpaPlanRepository.java index ad67296..64ffb89 100644 --- a/src/main/java/planshare/server/planshare/plan/repository/JpaPlanRepository.java +++ b/src/main/java/planshare/server/planshare/plan/repository/JpaPlanRepository.java @@ -9,6 +9,7 @@ import javax.persistence.EntityManager; import javax.persistence.Query; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.List; import java.util.Optional; @@ -45,7 +46,7 @@ public List findByGoal(Goal goal) { } @Override - public List findByDate(LocalDate date) { + public List findByDate(LocalDateTime date) { return em.createQuery("select p from Plan p where p.date = :planDate", Plan.class) .setParameter("planDate", date) .getResultList(); diff --git a/src/main/java/planshare/server/planshare/plan/repository/PlanRepository.java b/src/main/java/planshare/server/planshare/plan/repository/PlanRepository.java index 851a831..f88ceeb 100644 --- a/src/main/java/planshare/server/planshare/plan/repository/PlanRepository.java +++ b/src/main/java/planshare/server/planshare/plan/repository/PlanRepository.java @@ -4,6 +4,7 @@ import planshare.server.planshare.domain.Plan; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.List; import java.util.Optional; @@ -12,7 +13,7 @@ public interface PlanRepository { Plan save(Plan plan); Optional findById(Long id); List findByGoal(Goal goal); - List findByDate(LocalDate date); + List findByDate(LocalDateTime date); List findAll(); int deleteById(Long id);