QueryDsl 사용 시 date 시작/종료 구간 검색
JPAQuery 부분
query.where(qOrder.createdDate.between(dto.getSearchStartDate(), dto.getSearchEndDate()));
dto 부분
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime searchStartDate;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime searchEndDate;
LocalDateTime 을 사용할때에는 DateTimeFormat 을 입력해줘야 param 에 2021-02-01 09:52:53 같은 date time을 변환하여 받을 수 있다
'개발 > Spring' 카테고리의 다른 글
Springboot @Transactional Rollback 이 안되는 현상 정리 (0) | 2021.03.24 |
---|---|
JSONException 에러 관련 (0) | 2020.08.18 |
Xss custom filter (lucy 적용 안되어 임시방편 코드) (0) | 2020.07.28 |
springboot 에서 jsp-config include 사용 (2) | 2020.07.02 |
@Slf4j 사용시 log cannot be resolved 에러 처리 (4) | 2019.09.18 |