개발/JPA
jpa 배열로 넣기
멋진놈
2022. 8. 10. 18:02
728x90
@Transactional
public List<RevisionResponseDto> selectViewCode(final Long eventId) throws Exception {
List<Revision> list = revisionRepository.selectViewCode(eventId);
return list.stream().map(RevisionResponseDto::new).collect(Collectors.toList());
}
List<RevisionResponseDto> selectViewCode(final Long eventId) throws Exception;
@Query(value = "SELECT * from Revision where event_id = :id", nativeQuery = true)
List<Revision> selectViewCode(Long id);
@GetMapping("/v3/revision/{eventId}")
public List<RevisionResponseDto> findById(@PathVariable final Long eventId) throws Exception {
return revisionService.selectViewCode(eventId);
}
굿