貸出書籍一覧とメニュー画面
This commit is contained in:
@@ -7,16 +7,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.example.demo.service.LendingListService;
|
||||
import com.example.demo.service.ReturnService;
|
||||
|
||||
@Controller
|
||||
public class LendingListController {
|
||||
|
||||
@Autowired
|
||||
LendingListService lendingListService;
|
||||
ReturnService returnService;
|
||||
|
||||
public LendingListController(LendingListService lendingListService) {
|
||||
this.lendingListService = lendingListService;
|
||||
public LendingListController(ReturnService returnService) {
|
||||
this.returnService = returnService;
|
||||
}
|
||||
|
||||
//貸出中書籍一覧を表示
|
||||
@@ -25,7 +25,7 @@ public class LendingListController {
|
||||
public String index(Model model) {
|
||||
//サービスと連携する処理
|
||||
//サービスから一覧を取得し、borrowListという名前でHTMLに渡す
|
||||
model.addAttribute("borrowList", lendingListService.getBorrowList());
|
||||
model.addAttribute("borrowList", returnService.getBorrowList());
|
||||
//表示するHTML
|
||||
return "lendingList";
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
|
||||
@Controller
|
||||
public class MenuController {
|
||||
|
||||
@RequestMapping(value = "/menu", method = RequestMethod.GET)
|
||||
public String showmenu() {
|
||||
return "menu";
|
||||
}
|
||||
}
|
||||
//package com.example.demo.controller;
|
||||
//
|
||||
//import org.springframework.stereotype.Controller;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMethod;
|
||||
//
|
||||
//
|
||||
//@Controller
|
||||
//public class MenuController {
|
||||
//
|
||||
// @RequestMapping(value = "/menu", method = RequestMethod.GET)
|
||||
// public String showmenu() {
|
||||
// return "menu";
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -8,7 +8,6 @@ import lombok.Data;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class LeadingListModel {
|
||||
|
||||
//データの保持
|
||||
private final Integer idRequest;
|
||||
private final String nmBook;
|
||||
@@ -16,6 +15,4 @@ public class LeadingListModel {
|
||||
private final Date dateRequest;
|
||||
private final Date dateBorrow;
|
||||
private final Date dateScheduledReturn;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.transaction.Transactional;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.example.demo.model.LeadingListModel;
|
||||
import com.example.demo.repository.Borrow_BooksRepository;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class LendingListService {
|
||||
|
||||
@Autowired
|
||||
Borrow_BooksRepository borrowrepo;
|
||||
|
||||
public LendingListService(Borrow_BooksRepository borrowrepo) {
|
||||
this.borrowrepo = borrowrepo;
|
||||
}
|
||||
|
||||
//貸出中書籍の一覧を取得したい
|
||||
public List<LeadingListModel>getBorrowList(){
|
||||
//リポジトリに取得を託す。取得したらコントローラーに返す
|
||||
return borrowrepo.findLendingList();
|
||||
}
|
||||
|
||||
//package com.example.demo.service;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import jakarta.transaction.Transactional;
|
||||
//
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import com.example.demo.model.LeadingListModel;
|
||||
//import com.example.demo.repository.Borrow_BooksRepository;
|
||||
//
|
||||
//@Service
|
||||
//@Transactional
|
||||
//public class LendingListService {
|
||||
//
|
||||
// @Autowired
|
||||
// Borrow_BooksRepository borrowrepo;
|
||||
//
|
||||
// public LendingListService(Borrow_BooksRepository borrowrepo) {
|
||||
// this.borrowrepo = borrowrepo;
|
||||
// }
|
||||
//
|
||||
// //貸出中書籍の一覧を取得したい
|
||||
// public List<LeadingListModel>getBorrowList(){
|
||||
// //リポジトリに取得を託す。取得したらコントローラーに返す
|
||||
// return borrowrepo.findLendingList();
|
||||
// }
|
||||
//
|
||||
// public List<LeadingListDto> getBorrowList(){
|
||||
// List<Borrow_booksEntity> borrowentity = Borrow_BooksRepository.findAll();
|
||||
// leadinglistdto.status(equals("2"));
|
||||
// }
|
||||
}
|
||||
//}
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
|
||||
<body>
|
||||
<h1>
|
||||
メインメニュー
|
||||
<div class="rightSection">
|
||||
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||
</div>
|
||||
</h1>
|
||||
|
||||
<!-- 管理者フラグのチェック処理-->
|
||||
|
||||
|
||||
<!-- 一般ユーザー向けのメニュー-->
|
||||
<table class="menuClass">
|
||||
<tr>
|
||||
<td>
|
||||
@@ -28,6 +31,15 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 管理者向けのメニュー-->
|
||||
<table class="menuClass">
|
||||
<tr>
|
||||
<td>
|
||||
<a class="menuClass" href="javascript:leandingListSubmit()"><i class="fas fa-search"></i>貸出中書籍一覧</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user