From f0e6cc165d482f40cdec6ef4448f8c875da76ebd Mon Sep 17 00:00:00 2001 From: a-takayama <26-a-takayama-scm@it-college.co.jp> Date: Tue, 20 Oct 2026 15:50:17 +0900 Subject: [PATCH 1/2] =?UTF-8?q?bookList.html=20/=20SelectController=20/=20?= =?UTF-8?q?SearchConditionBookForm=20/=20SearchBook=20=E9=80=94=E4=B8=AD?= =?UTF-8?q?=E3=81=BE=E3=81=A7=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/controller/SelectBookController.java | 77 +++++++++++++++++++ .../demo/form/SearchConditionBookForm.java | 18 +++++ .../com/example/demo/service/SearchBook.java | 16 ++++ .../main/resources/templates/bookList.html | 72 +++++++++++++++++ 4 files changed, 183 insertions(+) create mode 100644 team1/src/main/java/com/example/demo/controller/SelectBookController.java create mode 100644 team1/src/main/java/com/example/demo/form/SearchConditionBookForm.java create mode 100644 team1/src/main/java/com/example/demo/service/SearchBook.java create mode 100644 team1/src/main/resources/templates/bookList.html diff --git a/team1/src/main/java/com/example/demo/controller/SelectBookController.java b/team1/src/main/java/com/example/demo/controller/SelectBookController.java new file mode 100644 index 0000000..4fa733c --- /dev/null +++ b/team1/src/main/java/com/example/demo/controller/SelectBookController.java @@ -0,0 +1,77 @@ +package com.example.demo.controller; + + +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import jakarta.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.example.demo.entity.Book_collectionEntity; +import com.example.demo.form.SearchConditionBookForm; +import com.example.demo.service.SearchBook; + + + +@Controller +public class SelectBookController { + + // ログ出力用インスタンス + private final static Logger LOGGER = Logger.getLogger(SelectBookController.class.getName()); + // エラーメッセージ用の定数フィールド + private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!"; + + HttpSession httpsession; + SearchBook searchBook; + + @Autowired + public SelectBookController(HttpSession httpSession, SearchBook searchBook) { + this.httpsession = httpSession; + this.searchBook = searchBook; + } + + //空の検索条件Form + @ModelAttribute + public SearchConditionBookForm searchConditionBookForm() { + return new SearchConditionBookForm(); + } + +// ① 書籍一覧の初期表示 + + @RequestMapping(value ="/selectBook", method = RequestMethod.GET) + public String select(Model model) { + try { + //貸出可能な書籍を全権取得する + List books = searchBook.selectAll(); + //検索結果をmodelに登録する + model.addAttribute("books" , books); + //書籍一覧画面を表示する + return "book-search"; + + }catch(Exception e) { + //httpSessionを破棄 + httpsession.invalidate(); + //エラー内容を出力 + e.printStackTrace(); + //ログにエラーを記録 + LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e); + //エラー画面へ遷移 + return "error"; + } + } + // ② 検索ボタン押下時の処理 + + @RequestMapping(value ="/selectBook", method = RequestMethod.POST) + public String ) { + + + +// } +} diff --git a/team1/src/main/java/com/example/demo/form/SearchConditionBookForm.java b/team1/src/main/java/com/example/demo/form/SearchConditionBookForm.java new file mode 100644 index 0000000..e180cc6 --- /dev/null +++ b/team1/src/main/java/com/example/demo/form/SearchConditionBookForm.java @@ -0,0 +1,18 @@ +package com.example.demo.form; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class SearchConditionBookForm { + //書籍名 + private String nmBook; + //出版社 + private String pubLisher; + //特記事項 + private String noteText; + +} diff --git a/team1/src/main/java/com/example/demo/service/SearchBook.java b/team1/src/main/java/com/example/demo/service/SearchBook.java new file mode 100644 index 0000000..74bb01c --- /dev/null +++ b/team1/src/main/java/com/example/demo/service/SearchBook.java @@ -0,0 +1,16 @@ +package com.example.demo.service; + +import java.util.List; + +import com.example.demo.entity.Book_collectionEntity; +import com.example.demo.form.SearchConditionBookForm; + +public interface SearchBook { + + //貸出可能な書籍を全件取得する + List selectAll(); + + //書籍名・出版社・特記事項を条件に検索する + List searchByWithLike(SearchConditionBookForm form); + +} diff --git a/team1/src/main/resources/templates/bookList.html b/team1/src/main/resources/templates/bookList.html new file mode 100644 index 0000000..70b74ce --- /dev/null +++ b/team1/src/main/resources/templates/bookList.html @@ -0,0 +1,72 @@ + + + + + + 書籍一覧・検索 + + + + +ログアウト +

書籍一覧・検索

+ +
+ + + + + + + + + + + + + + + + + + + + + + メニューに戻る +

検索結果

+ +
書籍名
出版社
特記事項
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ISBN書籍名書籍名よみ出版社特記事項操作 +
+ + +
+ + + \ No newline at end of file From a6f719d0042e0df9b008c818d7af3d0feeb70505 Mon Sep 17 00:00:00 2001 From: m-endo <26-s-i-tm-nets@it-college.jp> Date: Tue, 20 Oct 2026 15:53:54 +0900 Subject: [PATCH 2/2] =?UTF-8?q?HTML=EF=BC=93=E3=81=A4=E4=BD=9C=E6=88=90?= =?UTF-8?q?=E3=80=81=E3=82=B3=E3=83=B3=E3=83=88=E3=83=AD=E3=83=BC=E3=83=80?= =?UTF-8?q?=E3=83=BC=E3=82=AF=E3=83=A9=E3=82=B9=E4=BD=9C=E6=88=90=E9=80=94?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- team1/pom.xml | 5 ++ .../demo/controller/LendingController.java | 82 +++++++++++++++++++ .../main/resources/templates/application.html | 51 ++++++++++++ .../templates/applicationComplete.html | 29 +++++++ .../templates/applicationConfirm.html | 55 +++++++++++++ 5 files changed, 222 insertions(+) create mode 100644 team1/src/main/java/com/example/demo/controller/LendingController.java create mode 100644 team1/src/main/resources/templates/application.html create mode 100644 team1/src/main/resources/templates/applicationComplete.html create mode 100644 team1/src/main/resources/templates/applicationConfirm.html diff --git a/team1/pom.xml b/team1/pom.xml index 75ae850..8b03b4f 100644 --- a/team1/pom.xml +++ b/team1/pom.xml @@ -79,6 +79,11 @@ HelloSpring 0.0.1-SNAPSHOT + + com.example.rhizome + EM-Spring + 0.0.1-SNAPSHOT + diff --git a/team1/src/main/java/com/example/demo/controller/LendingController.java b/team1/src/main/java/com/example/demo/controller/LendingController.java new file mode 100644 index 0000000..2c44fd6 --- /dev/null +++ b/team1/src/main/java/com/example/demo/controller/LendingController.java @@ -0,0 +1,82 @@ +package com.example.demo.controller; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import jakarta.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; + +import main.java.com.example.rhizome.aop.aspect.PermissionCheck; +import main.java.com.example.rhizome.aop.aspect.SessionCheck; +import main.java.com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; + +/** + * 書籍貸出申請に関する処理を制御するコントローラ + */ +@Controller +public class LendingController { + // ログ出力用インスタンス + private final static Logger LOGGER = Logger.getLogger(LendingController.class.getName()); + // エラーメッセージ用の定数フィールド + private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!"; + + HttpSession httpSession; + + //コンストラクタ注入(一番最初に動く処理) + @Autowired + public LendingController(HttpSession httpSession) { + this.httpSession = httpSession; + } + + //画面を開くための初期化(!formクラス名要確認!) + @ModelAttribute + public LendingForm lendingForm() { + return new LendingForm(); + } + + @PermissionCheck + @SessionCheck + @RequestMapping(value = "反応するURLを記載", method = RequestMethod.POST) + public String confirmLending(@ModelAttribute("lendingForm") LendingForm lendingForm, Model model) { + try { + + // HTML側の th:object="${lendingForm}" に渡すデータをセット + model.addAllAttribute("lendingForm", lendingForm); + // 貸出申請確認画面のHTML名を返す + return "applicationConform"; + } catch (Exception e) { + //ログイン情報の破棄 + httpSession.invalidate(); + + e.printStackTrace(); + + // エラーログ出力 + LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e); + // エラー画面遷移 + return TransitionTargetPageNameKeyword.ERROR_HTML; + + } + + } + /** + * 書籍貸出申請 実行処理 + * + * @param lendingForm 確認画面の隠しフィールド(hidden)から引き継いだデータ + * @param model ビューにデータを渡すためのコンテナ + * @return 遷移先の画面 + */ + @PermissionCheck + @SessionCheck + @RequestMapping(value = "反応するURLを記載", method = RequestMethod.POST) + public String executeLending(@ModelAttribute("lendingForm") LendingForm lendingForm, Model model) { + final String LENDING_COMPLETE = "書籍申請完了しました"; + } + try { + + }catch +} diff --git a/team1/src/main/resources/templates/application.html b/team1/src/main/resources/templates/application.html new file mode 100644 index 0000000..bbdd703 --- /dev/null +++ b/team1/src/main/resources/templates/application.html @@ -0,0 +1,51 @@ + + + + + + + + 書籍貸出申請 + + + + +
+ ログイン者名: + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + +
蔵書ID
書籍名
貸出日
返却予定日
+ +
+
+ + + 書籍一覧に戻る + + + \ No newline at end of file diff --git a/team1/src/main/resources/templates/applicationComplete.html b/team1/src/main/resources/templates/applicationComplete.html new file mode 100644 index 0000000..3c829ff --- /dev/null +++ b/team1/src/main/resources/templates/applicationComplete.html @@ -0,0 +1,29 @@ + + + + + + + + 書籍貸出申請完了 + + + + +
+ ログイン者名: + +
+ + +

書籍申請完了しました

+ + + 書籍一覧に戻る + + + メニューに戻る + + + + \ No newline at end of file diff --git a/team1/src/main/resources/templates/applicationConfirm.html b/team1/src/main/resources/templates/applicationConfirm.html new file mode 100644 index 0000000..42196dd --- /dev/null +++ b/team1/src/main/resources/templates/applicationConfirm.html @@ -0,0 +1,55 @@ + + + + + + + + 書籍貸出申請確認 + + + + +
+ ログイン者名: + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
蔵書ID
書籍名
貸出日
返却予定日
+ + +
+
+ + 申請情報入力に戻る + + + \ No newline at end of file