Controller・Repository・bookList修正・編集
This commit is contained in:
@@ -45,13 +45,7 @@ public class SelectBookController {
|
||||
@RequestMapping(value = "/selectBook", method = RequestMethod.GET)
|
||||
public String selectBook(Model model) {
|
||||
try {
|
||||
// LoginUser loginUser = (LoginUser) httpsession.getAttribute("loginUser");
|
||||
//
|
||||
// //ログイン情報が存在しない場合はログイン画面へ
|
||||
// if(loginUser == null) {
|
||||
// return "/login";
|
||||
// }
|
||||
// //貸出可能な書籍を全て取得
|
||||
//貸出可能な書籍を全て取得
|
||||
List<Book_collectionEntity> books = returnService.availableSelectAll();
|
||||
|
||||
//取得した書籍情報をModelに登録する
|
||||
|
||||
@@ -13,13 +13,14 @@ import com.example.demo.entity.Book_collectionEntity;
|
||||
public interface Book_CollectionRepository extends JpaRepository<Book_collectionEntity, Integer> {
|
||||
//JpaRepositoruを継承することで基本的なDB操作が使用できる
|
||||
//Book_collctionEntity:操作するEntity
|
||||
//Integer: Entity の主キーの方
|
||||
//Integer: Entity の主キーの"id_book"の型
|
||||
|
||||
List<Book_collectionEntity> findByFlgLending(Character flgLending);
|
||||
|
||||
// [ b.noteText ] …Entityのフィールドを表す
|
||||
// [ :noteText ]…Javaから渡された検索条件を表す。ユーザが入力した(Java)などの文字列が入る
|
||||
// [:]…JPQLでは、名前付きパラメータを指定するときに、名前の前に : を付け
|
||||
// └[ : ] 以降の名前は @Param("noteText") の名前と一致させる
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT b FROM Book_collectionEntity b
|
||||
@@ -40,6 +41,8 @@ public interface Book_CollectionRepository extends JpaRepository<Book_collection
|
||||
//検索結果はBook_collectionEntityのListで返す
|
||||
List<Book_collectionEntity> searchBooks(
|
||||
//入力された書籍名をJPQLの:nmBookに返す
|
||||
// [:]…JPQLでは、名前付きパラメータを指定するときに、名前の前に : を付け
|
||||
// └[ : ] 以降の名前は @Param("noteText") の名前と一致させる
|
||||
@Param("nmBook") String nmBook,
|
||||
@Param("pubLisher") String pubLisher,
|
||||
@Param("noteText") String noteText);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<!--ログアウトボタン-->
|
||||
<a href="@{/logout}">ログアウト</a>
|
||||
|
||||
<h2>書籍一覧・検索</h2>
|
||||
<h1>書籍一覧・検索</h1>
|
||||
<!-- 検索条件をControllerの/selectBookへPOST送信-->
|
||||
<!--bookSearchFormはControllerから渡されるForm-->
|
||||
<!--Controllerと@{/selectBook}合わせる-->
|
||||
@@ -44,11 +44,14 @@
|
||||
<!-- 検索ボタン-->
|
||||
<button type="submit">検索</button>
|
||||
</form>
|
||||
|
||||
<!-- メニュー画面へ戻るリンク-->
|
||||
<a th:href="@{/menu}">メニューに戻る </a>
|
||||
|
||||
<h3>検索結果</h3>
|
||||
|
||||
<!--検索結果を表示するテーブル-->
|
||||
<!-- border ="1"は表のセルを区切るための線を表示-->
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user