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<Plan> findByGoal(Goal goal) { } @Override - public List<Plan> findByDate(LocalDate date) { + public List<Plan> 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<Plan> findById(Long id); List<Plan> findByGoal(Goal goal); - List<Plan> findByDate(LocalDate date); + List<Plan> findByDate(LocalDateTime date); List<Plan> findAll(); int deleteById(Long id);