From 174f843618a69caf430ec6e72ca1326ef68d755e Mon Sep 17 00:00:00 2001 From: m_ozawa <26-m-ozawa-swnet@it-college.co.jp> Date: Mon, 19 Oct 2026 16:21:10 +0900 Subject: [PATCH 1/6] =?UTF-8?q?bookList.html=E3=80=80=E9=80=94=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/bookList.html | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 book-rent/src/main/resources/templates/bookList.html diff --git a/book-rent/src/main/resources/templates/bookList.html b/book-rent/src/main/resources/templates/bookList.html new file mode 100644 index 0000000..043c10a --- /dev/null +++ b/book-rent/src/main/resources/templates/bookList.html @@ -0,0 +1,38 @@ + + + + + + 書籍一覧 + + + +
+
+ +
+ + + + + + + + + + + + + +
書籍名
出版社
+
+ + メニューに戻る +

検索結果

+ + + + + + + \ No newline at end of file From 3e1eb9f6bd123f5adaa2757256ee164018bf1421 Mon Sep 17 00:00:00 2001 From: "h.hein" <26-h-kyaw-sakuracommunication@it-college.co.jp> Date: Tue, 20 Oct 2026 14:59:58 +0900 Subject: [PATCH 2/6] AdminloanController done --- .../demo/controller/AdminLoanController.java | 115 +++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/book-rent/src/main/java/com/example/demo/controller/AdminLoanController.java b/book-rent/src/main/java/com/example/demo/controller/AdminLoanController.java index 45482ec..0c53e5d 100644 --- a/book-rent/src/main/java/com/example/demo/controller/AdminLoanController.java +++ b/book-rent/src/main/java/com/example/demo/controller/AdminLoanController.java @@ -1,5 +1,118 @@ package com.example.demo.controller; -public class AdminLoanController { +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.SessionAttribute; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import com.example.demo.common.BusinessException; +import com.example.demo.common.Const; +import com.example.demo.common.LoginUser; +import com.example.demo.service.LoanService; + +/** + * 管理者用:LOAN-02 申請一覧、LOAN-03 承認/却下、LOAN-04 貸出中一覧、LOAN-05 返却。 + * /admin/** は LoginCheckInterceptor で管理者以外を拒否する。 + */ +@Controller +public class AdminLoanController { + private final LoanService loanService; + + public AdminLoanController(LoanService loanService) { + this.loanService = loanService; + } + + // ===== LOAN-02 書籍申請一覧(承認待) ===== + @GetMapping("/admin/applications") + public String applications(Model model) { + model.addAttribute("list", loanService.listByStatus(Const.STATUS_WAITING)); + return "applicationList"; + } + + // ===== LOAN-03 承認/却下 ===== + @GetMapping("/admin/applications/{id}") + public String approvalConfirm(@PathVariable Integer id, Model model, RedirectAttributes ra) { + try { + model.addAttribute("r", loanService.getView(id, Const.STATUS_WAITING)); + return "approvalConfirm"; + } catch (BusinessException e) { + ra.addFlashAttribute("errorMessage", e.getMessage()); + return "redirect:/admin/applications"; + } + } + + @PostMapping("/admin/applications/{id}/approve") + public String approve(@PathVariable Integer id, + @SessionAttribute(Const.SESSION_LOGIN_USER) LoginUser admin, RedirectAttributes ra) { + try { + loanService.approve(id, admin); + ra.addFlashAttribute("message", "書籍貸出申請を承認しました。"); + return "redirect:/admin/approval/complete"; + } catch (BusinessException e) { + ra.addFlashAttribute("errorMessage", e.getMessage()); + return "redirect:/admin/applications"; + } + } + + @PostMapping("/admin/applications/{id}/reject") + public String reject(@PathVariable Integer id, + @SessionAttribute(Const.SESSION_LOGIN_USER) LoginUser admin, RedirectAttributes ra) { + try { + loanService.reject(id, admin); + ra.addFlashAttribute("message", "書籍貸出申請を却下しました。"); + return "redirect:/admin/approval/complete"; + } catch (BusinessException e) { + ra.addFlashAttribute("errorMessage", e.getMessage()); + return "redirect:/admin/applications"; + } + } + + @GetMapping("/admin/approval/complete") + public String approvalComplete(Model model) { + model.addAttribute("backUrl", "/admin/applications"); + model.addAttribute("backLabel", "承認待ち一覧に戻る"); + return "complete"; + } + + // ===== LOAN-04 貸出中書籍一覧 ===== + @GetMapping("/admin/lendings") + public String lendings(Model model) { + model.addAttribute("list", loanService.listByStatus(Const.STATUS_LENDING)); + return "lendingList"; + } + + // ===== LOAN-05 返却 ===== + @GetMapping("/admin/lendings/{id}") + public String returnConfirm(@PathVariable Integer id, Model model, RedirectAttributes ra) { + try { + model.addAttribute("r", loanService.getView(id, Const.STATUS_LENDING)); + return "returnConfirm"; + } catch (BusinessException e) { + ra.addFlashAttribute("errorMessage", e.getMessage()); + return "redirect:/admin/lendings"; + } + } + + @PostMapping("/admin/lendings/{id}/return") + public String doReturn(@PathVariable Integer id, + @SessionAttribute(Const.SESSION_LOGIN_USER) LoginUser admin, RedirectAttributes ra) { + try { + loanService.returnBook(id, admin); + ra.addFlashAttribute("message", "書籍の返却が完了しました。"); + return "redirect:/admin/return/complete"; + } catch (BusinessException e) { + ra.addFlashAttribute("errorMessage", e.getMessage()); + return "redirect:/admin/lendings"; + } + } + + @GetMapping("/admin/return/complete") + public String returnComplete(Model model) { + model.addAttribute("backUrl", "/admin/lendings"); + model.addAttribute("backLabel", "貸出中書籍一覧に戻る"); + return "complete"; + } } From b128e9259883a00e9d25fdaae48e3fe54ddd290a Mon Sep 17 00:00:00 2001 From: "h.hein" <26-h-kyaw-sakuracommunication@it-college.co.jp> Date: Tue, 20 Oct 2026 15:22:39 +0900 Subject: [PATCH 3/6] 3 stept done --- .../demo/controller/BookController.java | 30 ++++++++- .../templates/applicationConfirm.html | 37 ---------- .../main/resources/templates/bookConfirm.html | 42 ++++++++++++ .../main/resources/templates/bookInput.html | 34 ++++++++++ .../main/resources/templates/bookList.html | 67 +++++++++++++++++++ .../main/resources/templates/complete.html | 19 ++++++ .../resources/templates/loanApplyConfirm.html | 38 +++++++++++ .../resources/templates/loanApplyInput.html | 33 +++++++++ 8 files changed, 262 insertions(+), 38 deletions(-) delete mode 100644 book-rent/src/main/resources/templates/applicationConfirm.html create mode 100644 book-rent/src/main/resources/templates/bookConfirm.html create mode 100644 book-rent/src/main/resources/templates/bookInput.html create mode 100644 book-rent/src/main/resources/templates/bookList.html create mode 100644 book-rent/src/main/resources/templates/complete.html create mode 100644 book-rent/src/main/resources/templates/loanApplyConfirm.html create mode 100644 book-rent/src/main/resources/templates/loanApplyInput.html diff --git a/book-rent/src/main/java/com/example/demo/controller/BookController.java b/book-rent/src/main/java/com/example/demo/controller/BookController.java index 5344892..0196193 100644 --- a/book-rent/src/main/java/com/example/demo/controller/BookController.java +++ b/book-rent/src/main/java/com/example/demo/controller/BookController.java @@ -1,5 +1,33 @@ package com.example.demo.controller; -public class BookController { +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import com.example.demo.service.BookService; + + +/** BOOK-01:書籍検索(bookList.html) */ +@Controller +public class BookController { + private final BookService bookService; + + public BookController(BookService bookService) { + this.bookService = bookService; + } + + /** メニューの「書籍一覧」=条件なし(全件)、検索ボタン=条件付きで同じURLを使う */ + @GetMapping("/books") + public String list(@RequestParam(defaultValue = "") String nmBook, + @RequestParam(defaultValue = "") String publisher, + @RequestParam(defaultValue = "") String note, + Model model) { + model.addAttribute("books", bookService.searchLendable(nmBook, publisher, note)); + // 検索条件を保持 + model.addAttribute("nmBook", nmBook); + model.addAttribute("publisher", publisher); + model.addAttribute("note", note); + return "bookList"; + } } diff --git a/book-rent/src/main/resources/templates/applicationConfirm.html b/book-rent/src/main/resources/templates/applicationConfirm.html deleted file mode 100644 index cc28384..0000000 --- a/book-rent/src/main/resources/templates/applicationConfirm.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - 書籍貸出申請画面 - - - - - - -
- -
- - - - - - - - - 申請 -
蔵書ID - - 書籍名 - - 貸出日 - - 返却予定日 - -
- 申請情報入力 - - - \ No newline at end of file diff --git a/book-rent/src/main/resources/templates/bookConfirm.html b/book-rent/src/main/resources/templates/bookConfirm.html new file mode 100644 index 0000000..c9d41d0 --- /dev/null +++ b/book-rent/src/main/resources/templates/bookConfirm.html @@ -0,0 +1,42 @@ + + + + + 書籍情報確認 + + + +
+
+

書籍情報確認

+
+

書籍登録

+ + + + + + +
ISBN
書籍名
書籍名よみ
出版社
特記事項
+
+ + + + + + + +
+
+ + + + + + + +
+
+
+ + diff --git a/book-rent/src/main/resources/templates/bookInput.html b/book-rent/src/main/resources/templates/bookInput.html new file mode 100644 index 0000000..dddd0f0 --- /dev/null +++ b/book-rent/src/main/resources/templates/bookInput.html @@ -0,0 +1,34 @@ + + + + + 書籍情報入力 + + + +
+
+

書籍情報入力

+
+
+
+

書籍登録

+
+ + + + + + + + + + + +

+ 書籍一覧に戻る

+
+
+
+ + diff --git a/book-rent/src/main/resources/templates/bookList.html b/book-rent/src/main/resources/templates/bookList.html new file mode 100644 index 0000000..0193cfc --- /dev/null +++ b/book-rent/src/main/resources/templates/bookList.html @@ -0,0 +1,67 @@ + + + + + + 書籍一覧 + + + + +
+
+

書籍一覧

+
+
+
+ + + + + + +

+ メニューに戻る + 書籍新規登録 +

+
+
+ +
+

検索結果

+

該当する書籍はありません。

+ + + + + + + + + + + + + + + + + + + + + + + +
蔵書IDISBN書籍名書籍名よみ出版社特記事項操作
+ + 貸出申請 + 編集 +
+
+
+ + + \ No newline at end of file diff --git a/book-rent/src/main/resources/templates/complete.html b/book-rent/src/main/resources/templates/complete.html new file mode 100644 index 0000000..9e84135 --- /dev/null +++ b/book-rent/src/main/resources/templates/complete.html @@ -0,0 +1,19 @@ + + + + + 完了 + + + +
+
+

完了

+
+

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

+
+ + diff --git a/book-rent/src/main/resources/templates/loanApplyConfirm.html b/book-rent/src/main/resources/templates/loanApplyConfirm.html new file mode 100644 index 0000000..23bbeb3 --- /dev/null +++ b/book-rent/src/main/resources/templates/loanApplyConfirm.html @@ -0,0 +1,38 @@ + + + + + 書籍貸出申請確認 + + + +
+
+

書籍貸出申請確認

+
+ + + + + +
書籍名
ISBN
出版社
特記事項
+ + + +
貸出日
返却予定日
+
+ + + + +
+
+ + + + +
+
+
+ + diff --git a/book-rent/src/main/resources/templates/loanApplyInput.html b/book-rent/src/main/resources/templates/loanApplyInput.html new file mode 100644 index 0000000..730938d --- /dev/null +++ b/book-rent/src/main/resources/templates/loanApplyInput.html @@ -0,0 +1,33 @@ + + + + + 書籍貸出申請 + + + +
+
+

書籍貸出申請

+
+
+
+ + + + + +
書籍名
ISBN
出版社
特記事項
+
+ + + + + +

+ 書籍一覧に戻る

+
+
+
+ + From 6b2c08c0313ec62081078734de0faec322d1bc3e Mon Sep 17 00:00:00 2001 From: m_ozawa <26-m-ozawa-swnet@it-college.co.jp> Date: Tue, 20 Oct 2026 15:23:08 +0900 Subject: [PATCH 4/6] 2 --- .../demo/controller/BookController.java | 3 +- .../main/resources/templates/bookList.html | 119 ++++++++++++++---- 2 files changed, 97 insertions(+), 25 deletions(-) diff --git a/book-rent/src/main/java/com/example/demo/controller/BookController.java b/book-rent/src/main/java/com/example/demo/controller/BookController.java index 5344892..1be9cca 100644 --- a/book-rent/src/main/java/com/example/demo/controller/BookController.java +++ b/book-rent/src/main/java/com/example/demo/controller/BookController.java @@ -1,5 +1,6 @@ package com.example.demo.controller; -public class BookController { +public class BookController { + } diff --git a/book-rent/src/main/resources/templates/bookList.html b/book-rent/src/main/resources/templates/bookList.html index 043c10a..3a56306 100644 --- a/book-rent/src/main/resources/templates/bookList.html +++ b/book-rent/src/main/resources/templates/bookList.html @@ -7,32 +7,103 @@ + +
+
-
- -
- - - - - - - - - - - - - -
書籍名
出版社
-
- - メニューに戻る -

検索結果

- - - +
+ +
+ + + + + + + + + + + + + + + + + + +
書籍名
出版社
特記事項
+ +
+ メニューに戻る +
+

検索結果

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
蔵書IDISBN書籍名書籍名よみ出版社特記事項操作
+ +
+ + +
+ +
+ + +
+
+
+ + + 検索結果はありません。 + +
+ \ No newline at end of file From 0754c4507eff0b09472ed1c1d00662d0de2300e2 Mon Sep 17 00:00:00 2001 From: m_ozawa <26-m-ozawa-swnet@it-college.co.jp> Date: Tue, 20 Oct 2026 15:27:39 +0900 Subject: [PATCH 5/6] mm --- .../demo/controller/BookController.java | 8 +- .../main/resources/templates/bookList.html | 181 +++++++++--------- 2 files changed, 94 insertions(+), 95 deletions(-) diff --git a/book-rent/src/main/java/com/example/demo/controller/BookController.java b/book-rent/src/main/java/com/example/demo/controller/BookController.java index 228a728..8fa56a3 100644 --- a/book-rent/src/main/java/com/example/demo/controller/BookController.java +++ b/book-rent/src/main/java/com/example/demo/controller/BookController.java @@ -1,10 +1,10 @@ package com.example.demo.controller; -<<<<<<< HEAD -public class BookController { + + -======= + import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @@ -35,5 +35,5 @@ public class BookController { model.addAttribute("note", note); return "bookList"; } ->>>>>>> b128e9259883a00e9d25fdaae48e3fe54ddd290a + } diff --git a/book-rent/src/main/resources/templates/bookList.html b/book-rent/src/main/resources/templates/bookList.html index e80fbd0..2c3c73f 100644 --- a/book-rent/src/main/resources/templates/bookList.html +++ b/book-rent/src/main/resources/templates/bookList.html @@ -4,110 +4,110 @@ 書籍一覧 -<<<<<<< HEAD + - +
-
-
- -
+ +
+ +
- - - - - - - - - - - - - - - - - - -
書籍名
出版社
特記事項
-
-
- メニューに戻る -
-

検索結果

-
- - - -
- + + + + + + + + + + + + + + + + + + +
書籍名
出版社
特記事項
+ +
+ メニューに戻る +
+

検索結果

+
+ + + +
+ - - - - - - - - - - - - - - - - - - - - - - - - - -
蔵書IDISBN書籍名書籍名よみ出版社特記事項操作
- -
- - -
- -
- - -
-
-
- - - 検索結果はありません。 - + + + + + + + + + + + + + + + + + + + + + + + + + +
蔵書IDISBN書籍名書籍名よみ出版社特記事項操作
+ +
+ + +
+ +
+ + +
+
+
+ + + 検索結果はありません。 +
-======= - + + @@ -166,6 +166,5 @@ ->>>>>>> b128e9259883a00e9d25fdaae48e3fe54ddd290a \ No newline at end of file From 879d7235e0eac9d875108f5bccdd796b334d52b2 Mon Sep 17 00:00:00 2001 From: m_ozawa <26-m-ozawa-swnet@it-college.co.jp> Date: Tue, 20 Oct 2026 16:10:51 +0900 Subject: [PATCH 6/6] =?UTF-8?q?10/20=20=E4=BD=9C=E6=A5=AD=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/bookList.html | 105 +----------------- 1 file changed, 1 insertion(+), 104 deletions(-) diff --git a/book-rent/src/main/resources/templates/bookList.html b/book-rent/src/main/resources/templates/bookList.html index 2c3c73f..0193cfc 100644 --- a/book-rent/src/main/resources/templates/bookList.html +++ b/book-rent/src/main/resources/templates/bookList.html @@ -4,110 +4,7 @@ 書籍一覧 - - - - - -
-
-
-
- -
- - - - - - - - - - - - - - - - - - - -
書籍名
出版社
特記事項
-
-
- メニューに戻る -
-

検索結果

-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
蔵書IDISBN書籍名書籍名よみ出版社特記事項操作
- -
- - -
- -
- - -
-
-
- - - 検索結果はありません。 - -
- - - - +