Merge branch 'BE/userinfo' into 'backend'

feat: qna page변수 수정

See merge request s11-webmobile1-sub2/S11P12A701!167
This commit is contained in:
박정민 2024-08-12 09:54:33 +09:00
commit 9930da9acc
3 changed files with 5 additions and 5 deletions

View File

@ -146,9 +146,9 @@ public class QnaController {
@GetMapping("/all/{id}")
public ResponseEntity<List<QnaResponseDto>> getAllQna(
@PathVariable Long id,
@RequestParam(defaultValue = "0") int page) {
@RequestParam(defaultValue = "0") int pageNo) {
try {
List<QnaResponseDto> qnaList = qnaService.getAllQnasByLecture(id, page, PAGE_SIZE);
List<QnaResponseDto> qnaList = qnaService.getAllQnasByLecture(id, pageNo, PAGE_SIZE);
return new ResponseEntity<>(qnaList, HttpStatus.ACCEPTED);
} catch (SQLException e) {
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);

View File

@ -22,7 +22,7 @@ public interface QnaService {
QnaResponseDto getQna(Long id, Long userId) throws SQLException;
List<QnaResponseDto> getAllQnasByLecture(Long lectureId, int page, int pageNumber) throws SQLException;
List<QnaResponseDto> getAllQnasByLecture(Long lectureId, int pageNo, int pageNumber) throws SQLException;
QnaResponseDto createAnswer(Long id, QnaRequestDto qnaRequestDto) throws SQLException;

View File

@ -120,8 +120,8 @@ public class QnaServiceImpl implements QnaService {
}
@Override
public List<QnaResponseDto> getAllQnasByLecture(Long lectureId, int page, int pageSize) {
Pageable pageable = PageRequest.of(page, pageSize);
public List<QnaResponseDto> getAllQnasByLecture(Long lectureId, int pageNo, int pageSize) {
Pageable pageable = PageRequest.of(pageNo, pageSize);
Page<Qna> qnaPage = qnaRepository.findByLectureId(lectureId, pageable);
return qnaPage.getContent().stream()