Skip to content

Commit

Permalink
Merge pull request #18 from Sam3Star/gayeong
Browse files Browse the repository at this point in the history
fix: db수정
  • Loading branch information
GayeongKimm authored Jun 26, 2024
2 parents 3475064 + d7b5f1c commit ce17220
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
package kr.hs.dgsw.clock_server.domain.routine.repository;

import kr.hs.dgsw.clock_server.domain.routine.entity.RoutineEntity;
import kr.hs.dgsw.clock_server.domain.task.entity.TaskEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Repository
public interface RoutineRepository extends JpaRepository<RoutineEntity, Long> {
@Query("SELECT r FROM RoutineEntity r WHERE r.modifiedDateTime = :today")
List<RoutineEntity> findModifiedToday(@Param("today") LocalDateTime today);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -65,7 +67,7 @@ public void delete(Long id) {

@Override
public List<RoutineLoadRes> loadRoutine() {
List<RoutineEntity> routineEntity = routineRepository.findAll();
List<RoutineEntity> routineEntity = routineRepository.findModifiedToday(LocalDateTime.now());

List<RoutineLoadRes> routineLoadResList = new ArrayList<>();
for (RoutineEntity routine : routineEntity){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
public abstract class BaseTimeEntity {
@CreatedDate
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
protected LocalDateTime createdDate;
protected LocalDateTime createdDateTime;

@LastModifiedDate
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
protected LocalDateTime modifiedDate;
protected LocalDateTime modifiedDateTime;
}

0 comments on commit ce17220

Please sign in to comment.