-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- MVC 구조 및 기타 로직 완료 - config package 세분화 - entity JsonIgnoreProperties 추가 - 초기 database data 초기화 sql 추가
- Loading branch information
godchiken
committed
May 29, 2019
1 parent
c7e4458
commit 406cfa4
Showing
10 changed files
with
90 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
2 changes: 1 addition & 1 deletion
2
.../elk/app/config/JpaTransactionConfig.java → .../app/config/jpa/JpaTransactionConfig.java
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,34 @@ | ||
package com.kbh.elk.app.service; | ||
|
||
import com.kbh.elk.app.entity.Book; | ||
import com.kbh.elk.app.entity.BookStore; | ||
import com.kbh.elk.app.repository.BookRepository; | ||
import com.kbh.elk.app.repository.BookStoreRepository; | ||
import lombok.AllArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@AllArgsConstructor | ||
public class BookService { | ||
|
||
private BookRepository bookRepository; | ||
private BookStoreRepository bookStoreRepository; | ||
|
||
public ResponseEntity get(int bookIdx){ | ||
Book book = bookRepository.findById(bookIdx).get(); | ||
return ResponseEntity.ok(book); | ||
public Book select(int bookIdx){ | ||
return bookRepository.getOne(bookIdx); | ||
} | ||
public ResponseEntity post(int name){ | ||
bookRepository.save(null); | ||
return ResponseEntity.ok().build(); | ||
public void insert(){ | ||
Book book = new Book(); | ||
bookRepository.save(book); | ||
} | ||
public ResponseEntity put(int bookIdx){ | ||
return ResponseEntity.ok().build(); | ||
public void update(int bookIdx){ | ||
Book book = bookRepository.findById(bookIdx).get(); | ||
book.setAuthor("김보훈"); | ||
book.setName("ELK 완전정복 가이드"); | ||
BookStore bookStore = bookStoreRepository.getOne(1); | ||
book.setBookStore(bookStore); | ||
} | ||
public ResponseEntity delete(int bookIdx){ | ||
return ResponseEntity.ok().build(); | ||
public void delete(int bookIdx){ | ||
bookRepository.deleteById(bookIdx); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
package com.kbh.elk.app.service; | ||
|
||
import com.kbh.elk.app.entity.BookStore; | ||
import com.kbh.elk.app.repository.BookStoreRepository; | ||
import lombok.AllArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@AllArgsConstructor | ||
public class BookStoreService { | ||
private BookStoreRepository bookStoreRepository; | ||
|
||
public BookStore getBookStore(int bookStoreIdx){ | ||
return bookStoreRepository.getOne(bookStoreIdx); | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
INSERT INTO `elk`.`book_store`(`book_store_idx`, `name`) VALUES (1, '김보훈 책방'); | ||
INSERT INTO `elk`.`book_store`(`book_store_idx`, `name`) VALUES (2, '배창현 책방'); | ||
INSERT INTO `elk`.`book_store`(`book_store_idx`, `name`) VALUES (3, '안정훈 책방'); | ||
INSERT INTO `elk`.`book_store`(`book_store_idx`, `name`) VALUES (4, '황성인 책방'); | ||
|
||
INSERT INTO `elk`.`book`(`book_idx`, `author`, `name`, `book_store_name`) VALUES (1, '김보훈', '한울네트웍스에서의 생활', 1); | ||
INSERT INTO `elk`.`book`(`book_idx`, `author`, `name`, `book_store_name`) VALUES (2, '배창현', '프레시코드의 바나나 비즈니스 매너', 2); | ||
INSERT INTO `elk`.`book`(`book_idx`, `author`, `name`, `book_store_name`) VALUES (3, '안정훈', '아이나비에서의 혈투', 3); | ||
INSERT INTO `elk`.`book`(`book_idx`, `author`, `name`, `book_store_name`) VALUES (4, '황성인', '패스트캠퍼스에서 생존법', 4); |