貸出書籍一覧とメニュー画面

This commit is contained in:
2026-10-22 17:30:59 +09:00
5 changed files with 64 additions and 55 deletions

View File

@@ -7,16 +7,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.example.demo.service.LendingListService; import com.example.demo.service.ReturnService;
@Controller @Controller
public class LendingListController { public class LendingListController {
@Autowired @Autowired
LendingListService lendingListService; ReturnService returnService;
public LendingListController(LendingListService lendingListService) { public LendingListController(ReturnService returnService) {
this.lendingListService = lendingListService; this.returnService = returnService;
} }
//貸出中書籍一覧を表示 //貸出中書籍一覧を表示
@@ -25,7 +25,7 @@ public class LendingListController {
public String index(Model model) { public String index(Model model) {
//サービスと連携する処理 //サービスと連携する処理
//サービスから一覧を取得し、borrowListという名前でHTMLに渡す //サービスから一覧を取得し、borrowListという名前でHTMLに渡す
model.addAttribute("borrowList", lendingListService.getBorrowList()); model.addAttribute("borrowList", returnService.getBorrowList());
//表示するHTML //表示するHTML
return "lendingList"; return "lendingList";
} }

View File

@@ -1,15 +1,15 @@
package com.example.demo.controller; //package com.example.demo.controller;
//
import org.springframework.stereotype.Controller; //import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; //import org.springframework.web.bind.annotation.RequestMethod;
//
//
@Controller //@Controller
public class MenuController { //public class MenuController {
//
@RequestMapping(value = "/menu", method = RequestMethod.GET) // @RequestMapping(value = "/menu", method = RequestMethod.GET)
public String showmenu() { // public String showmenu() {
return "menu"; // return "menu";
} // }
} //}

View File

@@ -8,7 +8,6 @@ import lombok.Data;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
public class LeadingListModel { public class LeadingListModel {
//データの保持 //データの保持
private final Integer idRequest; private final Integer idRequest;
private final String nmBook; private final String nmBook;
@@ -16,6 +15,4 @@ public class LeadingListModel {
private final Date dateRequest; private final Date dateRequest;
private final Date dateBorrow; private final Date dateBorrow;
private final Date dateScheduledReturn; private final Date dateScheduledReturn;
} }

View File

@@ -1,34 +1,34 @@
package com.example.demo.service; //package com.example.demo.service;
//
import java.util.List; //import java.util.List;
//
import jakarta.transaction.Transactional; //import jakarta.transaction.Transactional;
//
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
import com.example.demo.model.LeadingListModel; //import com.example.demo.model.LeadingListModel;
import com.example.demo.repository.Borrow_BooksRepository; //import com.example.demo.repository.Borrow_BooksRepository;
//
@Service //@Service
@Transactional //@Transactional
public class LendingListService { //public class LendingListService {
//
@Autowired // @Autowired
Borrow_BooksRepository borrowrepo; // Borrow_BooksRepository borrowrepo;
//
public LendingListService(Borrow_BooksRepository borrowrepo) { // public LendingListService(Borrow_BooksRepository borrowrepo) {
this.borrowrepo = borrowrepo; // this.borrowrepo = borrowrepo;
} // }
//
//貸出中書籍の一覧を取得したい // //貸出中書籍の一覧を取得したい
public List<LeadingListModel>getBorrowList(){ // public List<LeadingListModel>getBorrowList(){
//リポジトリに取得を託す。取得したらコントローラーに返す // //リポジトリに取得を託す。取得したらコントローラーに返す
return borrowrepo.findLendingList(); // return borrowrepo.findLendingList();
} // }
//
// public List<LeadingListDto> getBorrowList(){ // public List<LeadingListDto> getBorrowList(){
// List<Borrow_booksEntity> borrowentity = Borrow_BooksRepository.findAll(); // List<Borrow_booksEntity> borrowentity = Borrow_BooksRepository.findAll();
// leadinglistdto.status(equals("2")); // leadinglistdto.status(equals("2"));
// } // }
} //}

View File

@@ -8,12 +8,15 @@
<body> <body>
<h1> <h1>
メインメニュー
<div class="rightSection"> <div class="rightSection">
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button> <button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
</div> </div>
</h1> </h1>
<!-- 管理者フラグのチェック処理-->
<!-- 一般ユーザー向けのメニュー-->
<table class="menuClass"> <table class="menuClass">
<tr> <tr>
<td> <td>
@@ -27,6 +30,15 @@
</td> </td>
</tr> </tr>
</table> </table>
<!-- 管理者向けのメニュー-->
<table class="menuClass">
<tr>
<td>
<a class="menuClass" href="javascript:leandingListSubmit()"><i class="fas fa-search"></i>貸出中書籍一覧</a>
</td>
</tr>
</table>
</body> </body>