Open
Conversation
- 도서 검색 기능 구현 완료 - 도서 대여 기능 구현 예정
- 책 대여하기 추가 - 책 반납하기 추가
- ResponsBody 삭제 - 조회 접근 url PathVariable로 수정
- JdbcBookRepostiory 생성
- 데이터베이스 환경변수 설정 - 구현할 함수 선언
- 책 추가기능 구현 - 책 제목, ISBN, 작가, 카테고리 조회 기능 구현 - 책 전체 조회 구현
- 데이터 추가 컬럼 수정 - 대여, 반납 시스템 진행중
| public boolean existsByIsbn(String isbn) { | ||
|
|
||
| try { | ||
| String sql = "select * from book where isbn=?"; |
Contributor
There was a problem hiding this comment.
SQL의 exists 구문을 사용하면 아래에서 count 변수를 사용하지 않아도 될 것으로 보입니다.
| @Override | ||
| public Book borrowBook(String isbn){ | ||
| try { | ||
| String sql = "update book set book_status = 'BORROWING' where isbn=? "; |
Contributor
There was a problem hiding this comment.
book_status 에 BORROWING을 하드 코딩하지 않고, PreparedStatement의 장점을 살려서 값을 추가하는 방식으로 수정 바랍니다.
| @Override | ||
| public Book returnBook(String isbn){ | ||
| try { | ||
| String sql = "update book set book_status = 'AVAILABLE' where isbn=? "; |
Contributor
There was a problem hiding this comment.
book_status 에 AVAILABLE을 하드 코딩하지 않고, PreparedStatement의 장점을 살려서 값을 추가하는 방식으로 수정 바랍니다.
| }catch(SQLException e){ | ||
| e.printStackTrace(); | ||
| } | ||
| return null; |
Contributor
There was a problem hiding this comment.
메서드의 반환은 null이 되어서는 안됩니다.
| }catch(SQLException e){ | ||
| e.printStackTrace(); | ||
| } | ||
| return null; |
Contributor
There was a problem hiding this comment.
메서드의 반환은 null이 되어서는 안됩니다.
- JpaBookRepositroy 추가 - BookService에서 JpaRepositroy 타입을 주입받도록 수정 - JdbcRepository 생성자 주석처리
- application.properties에 db 접속관련 내용추가 - 접속을 위한 환경변수 추가
- Entity 어노테이션 추가 - 기본키를 사용하는 id 값 추가
- JPA를 이용한 ISBN으로 도서 조회하기 - BookService에서 사용하는 매서드를 findByIsbn으로 수정
- 제목을 포함하는 도서 찾기 구현 - 생성한 Repository를 service에서 사용
- 저자로 도서 검색하기 기능 추가 - 추가한 메서드를 Service에서 사용
- findAllByCategory 기능 구현 - service에서 추가한 메서드를 사용하도록 수정
- enum으로 인식 할 수 있도록 어노테이션 추가 - table을 create에서 update로 변경
- Transactionl 어노테이션 추가 - 도서 대여 반납 기능 구현
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
still working