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 @@


- +
+



- +
+



- +