From 49c40a05c468c28b0990461a3b70410210a5e321 Mon Sep 17 00:00:00 2001 From: w-yuki Date: Mon, 28 Sep 2026 14:53:31 +0900 Subject: [PATCH] =?UTF-8?q?[add]=E7=B5=9E=E3=82=8A=E8=BE=BC=E3=81=BF?= =?UTF-8?q?=E6=A9=9F=E8=83=BD=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/controller/BookInsertController.java | 6 ++-- src/main/resources/templates/bookInsert.html | 35 ++++++++++++------- .../templates/bookInsertConfirm.html | 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/example/demo/controller/BookInsertController.java b/src/main/java/com/example/demo/controller/BookInsertController.java index e3d5b2f..f1b903a 100644 --- a/src/main/java/com/example/demo/controller/BookInsertController.java +++ b/src/main/java/com/example/demo/controller/BookInsertController.java @@ -1,7 +1,5 @@ package com.example.demo.controller; -import java.util.ArrayList; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -51,7 +49,7 @@ private StorageLocationRepository storageLocationRepository; model.addAttribute("subCategoryList",subCategoryRepository.findByBookCategory_BookCategoryId(bookInsert.getBookCategoryId())); //そのカテゴリに属するサブカテゴリを持ってくる } else{ - model.addAttribute("subCategoryList",new ArrayList<>()); + model.addAttribute("subCategoryList",subCategoryRepository.findAll()); } model.addAttribute("locationList",storageLocationRepository.findAll()); model.addAttribute("bookInsert", bookInsert); @@ -71,7 +69,7 @@ private StorageLocationRepository storageLocationRepository; if(bookInsert.getBookCategoryId() != null) { model.addAttribute("subCategoryList",subCategoryRepository.findByBookCategory_BookCategoryId(bookInsert.getBookCategoryId())); } else{ - model.addAttribute("subCategoryList",new ArrayList<>()); + model.addAttribute("subCategoryList",subCategoryRepository.findAll()); } model.addAttribute("locationList",storageLocationRepository.findAll()); model.addAttribute("bookInsert",bookInsert); diff --git a/src/main/resources/templates/bookInsert.html b/src/main/resources/templates/bookInsert.html index be4be18..9ca1fdc 100644 --- a/src/main/resources/templates/bookInsert.html +++ b/src/main/resources/templates/bookInsert.html @@ -8,10 +8,11 @@

新規図書登録入力

-

-

新しく図書を登録します。必要事項を入力し、「登録」ボタンを押してください

+
+

新しく図書を登録します。必要事項を入力し、「登録」ボタンを押してください。

※は必須項目です -

+
+

図書情報

@@ -19,17 +20,23 @@ -

+
+ ※例:BK-1、BK-2... +
+




- -
+ +
+ ※ハイフン(4つ)を含む形式で入力してください +
+
-

+

@@ -50,30 +57,34 @@


- +
+



- +
+



- +