Skip to content

Commit

Permalink
fix: Plan date 속성 자료형 변경(#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
heej-ng committed Apr 24, 2022
1 parent 4da565c commit e1e226d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/main/java/planshare/server/planshare/domain/Plan.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Entity
@Data
Expand All @@ -19,7 +20,7 @@ public class Plan {

private String name;

private LocalDate date;
private LocalDateTime date;

// 체크 여부
private boolean checkStatus;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.Setter;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Getter
@Setter
Expand All @@ -14,6 +15,6 @@ public class PlanForm {

private String name;

private LocalDate date;
private LocalDateTime date;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);

Expand Down

0 comments on commit e1e226d

Please sign in to comment.