diff --git a/src/main/java/com/example/demo/controller/BookLendController.java b/src/main/java/com/example/demo/controller/BookLendController.java index 5b535e8..6683951 100644 --- a/src/main/java/com/example/demo/controller/BookLendController.java +++ b/src/main/java/com/example/demo/controller/BookLendController.java @@ -1,13 +1,30 @@ package com.example.demo.controller; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PostMapping; + +import com.example.demo.entity.Employee; +import com.example.demo.repository.EmployeeRepository; + @Controller public class BookLendController { - @PostMapping("/bookLend") - public String bookLend() { - return "bookLend"; - } + + @Autowired + private EmployeeRepository employeeRepository; + + @PostMapping("/bookLend") + public String bookLend(Model model) { + return "bookLend"; + } + // 社員IDを取得してプルダウンに表示させる + @PostMapping("/bookLend/employeeId") + public String selectEmployeeId(Employee employee, Model model) { + model.addAttribute("employeeList", employeeRepository.findByEmployeeId(employee.getEmployeeId())); + model.addAttribute("bookLend", employee); + return "bookLend"; + } } diff --git a/src/main/java/com/example/demo/form/BookLendForm.java b/src/main/java/com/example/demo/form/BookLendForm.java new file mode 100644 index 0000000..ecf8f1f --- /dev/null +++ b/src/main/java/com/example/demo/form/BookLendForm.java @@ -0,0 +1,7 @@ +package com.example.demo.form; + +// 図書の貸出処理に使用予定 + +public class BookLendForm { + +} diff --git a/src/main/java/com/example/demo/repository/EmployeeRepository.java b/src/main/java/com/example/demo/repository/EmployeeRepository.java new file mode 100644 index 0000000..12605e9 --- /dev/null +++ b/src/main/java/com/example/demo/repository/EmployeeRepository.java @@ -0,0 +1,12 @@ +package com.example.demo.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.example.demo.entity.Employee; + +public interface EmployeeRepository extends JpaRepository{ + + List findByEmployeeId(Integer employeeId); +} diff --git a/src/main/java/com/example/demo/service/BookLendService.java b/src/main/java/com/example/demo/service/BookLendService.java index 2296807..a416702 100644 --- a/src/main/java/com/example/demo/service/BookLendService.java +++ b/src/main/java/com/example/demo/service/BookLendService.java @@ -18,4 +18,4 @@ public class BookLendService { return bookLendRepository.findAll(); } -} \ No newline at end of file +} diff --git a/src/main/resources/templates/bookLend.html b/src/main/resources/templates/bookLend.html index 5f90131..fe4a3c2 100644 --- a/src/main/resources/templates/bookLend.html +++ b/src/main/resources/templates/bookLend.html @@ -1,32 +1,208 @@ - + + - -図書貸出処理 + + 図書貸出処理 + - 図書貸出処理 -
-
-
- -
-
+

+ 図書貸出処理 +

-
+

+ 以下の図書を貸出します。貸出先と貸出日・返却予定日を入力してください。 +

+ +

+ 図書情報 +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ 図書管理ID + + (図書管理IDをここに表示させる) +
+ 図書タイトル + + (タイトルをここに表示させる) +
+ 著者名 + + (著者名をここに表示させる) +
+ ISBN + + (ISBNをここに表示させる) +
+
+ +

+ 社員情報 +

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

+ 貸出・返却日入力 +

+ +
+ +
+ + + + + +
+ ※ 現在の日付が自動で設定されます。 +
+ +
+ +
+ + + + + +
+ ※ 数値(1以上)で入力してください。 +
+ +
+ +
+ + + + + +
+ ※ カレンダーから日付を選択してください。 +
+ +
+ ※ 現在の日付より前は選択できません。 +
+ +
+ +
+ +
+ + + 注意事項 + + +
    +
  • + 貸出処理を行うと、対象の図書のステータスが「貸出中」に変更されます。 +
  • + +
  • + 返却予定日を必ず指定してください。 +
  • +
+ +
+ +
+
+ +
+ +
+ +
+ +
+ + + \ No newline at end of file