2 Commits

10 changed files with 96 additions and 332 deletions

View File

@@ -74,6 +74,16 @@
<artifactId>spring-boot-starter-webmvc-test</artifactId> <artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>HelloSpring</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.example.rhizome</groupId>
<artifactId>EM-Spring</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -1,49 +0,0 @@
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.example.demo.service.ReturnService;
@Controller
public class ApplicationListController{
@Autowired
ReturnService returnService;
public ApplicationListController(ReturnService returnService) {
this.returnService = returnService;
}
//applicationListにアクセスしたときに実行されるメソッド
@RequestMapping(value = "/applicationList", method = RequestMethod.GET)
public String index(Model model) {
//サービスから一覧を取得し、getAwaitingApprovalListという名前でHTMLに渡す
model.addAttribute("applicationList", returnService.getAwaitingApprovalList());
return "applicationList";
}
//メニュー画面に戻るURLへMapping
@RequestMapping(value = "/menu", method = RequestMethod.GET)
public String menu() {
return "menu";
}
//申請承認待ちページに遷移するためのMapping
@RequestMapping(value = "/returnApproval", method = RequestMethod.GET)
//返却確認ページにアクセスしたときに実行されるメソッド
public String returnApproval(
//URLから送られた申請IDを受け取る
@RequestParam("idRequest") Integer idRequest, Model model) {
//受け取った申請IDをidRequestという名前でModelに登録してHTMLに渡す
model.addAttribute("idRequest", idRequest);
//上記で渡すHTMLのURL
return "returnApproval";
}
}

View File

@@ -1,58 +1,35 @@
package com.example.demo.controller; package com.example.demo.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.ReturnService;
@Controller @Controller
public class LendingListController { public class LendingListController {
@Autowired // @GetMapping("/lendingList")
ReturnService returnService; // public String show(Model model) {
// List<X> x = xservice.getX();
// model.addAttribute("Y", x);
// return "Y";
// }
public LendingListController(ReturnService returnService) {
this.returnService = returnService;
}
//貸出中書籍一覧を表示 // HttpSession session;
@RequestMapping(value = "/lendingList", method = RequestMethod.GET) //
//lendingListにアクセスしたときに実行されるメソッド // @Autowired
public String index(Model model) { // public SelectListController(HttpSession session) {
//サービスと連携する処理 // this.session=session;
//サービスから一覧を取得し、borrowListという名前でHTMLに渡す // }
model.addAttribute("borrowList", returnService.getBorrowList());
//表示するHTML
return "lendingList";
}
//メニューに戻る // @RequestMapping("/lendingList")
@RequestMapping(value = "/menu", method = RequestMethod.GET) // public String lendList() {
public String menu() { // return "lendingList";
return "menu"; // }
}
//書籍返却ページに遷移 // @RequestMapping(value = lendingList, method = RequestMethod.POST)
@RequestMapping(value = "/returnConfirm", method = RequestMethod.GET) // public String select( , Model model) {
//返却確認ページにアクセスしたときに実行されるメソッド // model.addAttribute(
public String returnConfirm( // );
//URLから送られた申請IDを受け取る // return lendingList;
@RequestParam("idRequest") Integer idRequest, Model model) { //
//受け取った申請IDをidRequestという名前でHTMLに渡す // }
model.addAttribute("idRequest", idRequest);
//上記で渡すHTMLのURL
return "returnConfirm";
}
//@GetMapping("/lendingList")//登録されているデータを取得する役割を果たす
// public String show(Model model) {
// List<X> x = xservice.getX();
// model.addAttribute("Y", x);
// return LendingListService.select;
// }
//
} }

View File

@@ -1,24 +0,0 @@
package com.example.demo.controller;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class MenuController {
// @RequestMapping(value = "/menu", method = RequestMethod.GET)
// public String showmenu() {
// return "menu";
// }
@GetMapping("/menu")
public String menu(HttpSession session, Model model) {
Character FlgAdmin = (Character) session.getAttribute("FlgAdmin");
model.addAttribute("FlgAdmin", FlgAdmin);
return "menu";
}
}

View File

@@ -1,18 +0,0 @@
package com.example.demo.model;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class LeadingListModel {
//データの保持
private final Integer idRequest;
private final String nmBook;
private final String nmEmployee;
private final Date dateRequest;
private final Date dateBorrow;
private final Date dateScheduledReturn;
}

View File

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

View File

@@ -18,7 +18,7 @@
<!--クラス名確認すること(現在仮入力)--> <!--クラス名確認すること(現在仮入力)-->
<form action="confirmLending" id="lendingForm" method="post" th:object="${lendingForm}"> <form action="confirmLending" id="lendingForm" method="post" th:object="${lendingForm}">
<table> <table>
<!--蔵書ID、書籍名はreadonlyにて固定--> <!--蔵所ID、書籍名はreadonlyにて固定-->
<tr> <tr>
<th class="header">蔵書ID</th> <th class="header">蔵書ID</th>
<td><input type="text" th:field="*{id_book}" readonly="readonly"></td> <td><input type="text" th:field="*{id_book}" readonly="readonly"></td>

View File

@@ -1,69 +0,0 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<!-- 外部のスクリプトファイルを読み込む -->
<script th:src="@{/js/common.js}"></script>
<!-- CSSの読み込み -->
<link rel="stylesheet" th:href="@{/css/all.css}">
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
<title>検索</title>
</head>
<body>
<div class="rightSection">
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
</div>
<div class="header-spacing"></div>
<a href="showMenu">メニューに戻る</a>
<div class="header-spacing"></div>
<h1><span>検索結果</span></h1>
<div class="header-spacing"></div>
<th:block th:if="${employeeInfoFormList != null and employeeInfoFormList.size() > 0}">
<!-- 検索結果が1件以上ある場合 -->
<table class="table-grid table-striped table-hover">
<thead>
<tr>
<th style="width: 100px;">申請ID</th>
<th style="width: 100px;">申請者名</th>
<th style="width: 100px;">書籍名</th>
<th style="width: 100px;">申請日</th>
<th style="width: 100px;">貸出日</th>
<th style="width: 100px;">返却予定日</th>
<th style="width: 100px;">操作</th>
</tr>
</thead>
<tbody>
<tr th:each="employeeInfoForm : ${applicationList}">
<td th:text="${employeeInfoForm.idRequest}"></td>
<td th:text="${employeeInfoForm.nmApplicant}"></td>
<td th:text="${employeeInfoForm.nmBook}"></td>
<td th:text="${employeeInfoForm.dateRequest}"></td>
<td th:text="${employeeInfoForm.dateBorrow}"></td>
<td th:text="${employeeInfoForm.dateReturn}"></td>
<td th:text="${employeeInfoForm.dateRequest}"></td>
<td>
  <form action="/approve" method="get">
     <input name="idRequest" th:value="${employeeInfoForm.idRequest}" type="hidden">
     <input type="submit" value="承認">
  </form>
</td>
</tr>
</tbody>
</table>
</th:block>
<th:block th:if="${applicationList == null or borrowList.isEmpty()}">
<!-- 検索結果が0件の場合 -->
現在書籍貸出の申請はありません。
</th:block>
</body>
</html>

View File

@@ -2,8 +2,8 @@
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>貸出中書籍一覧</title> <title>貸出中書籍一覧</title>
</head> </head>
<body> <body>
@@ -11,44 +11,34 @@
<div class="rightSection"> <div class="rightSection">
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button> <button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
</div> </div>
<a href="menu">メニューに戻る</a>
<h1><span>検索結果</span></h1>
</h1> </h1>
<a href="menu">メニューに戻る</a> <thead>
<h1><span>検索結果</span></h1> <tr>
<table> <th style="width: 100px;">申請ID</th>
<thead> <th style="width: 100px;">申請者名</th>
<tr> <th style="width: 100px;">書籍名</th>
<th style="width: 150px;">申請ID</th> <th style="width: 100px;">申請日</th>
<th style="width: 150px;">申請者名</th> <th style="width: 100px;">貸出日</th>
<th style="width: 150px;">書籍名</th> <th style="width: 100px;">返却予定日</th>
<th style="width: 150px;">申請日</th> <th style="width: 100px;">操作</th>
<th style="width: 150px;">貸出日</th> </tr>
<th style="width: 150px;">返却予定日</th> </thead>
<th style="width: 150px;">操作</th> <tbody>
</tr> <tr th:each="">
</thead> <td th:text="${.idRequest}"></td>
<tbody> <td th:text="${.}"></td>
<tr th:each="borrow : ${borrowList}"> <td th:text="${.}"></td>
<td th:text="${borrow.idRequest}"></td> <td th:text="${.dateRequest}"></td>
<td th:text="${borrow.nmEmployee}"></td> <td th:text="${.dateBorrow}"></td>
<td th:text="${borrow.nmBook}"></td> <td th:text="${.dateScheduledReturn}"></td>
<td th:text="${borrow.dateRequest}"></td> <td>
<td th:text="${borrow.dateBorrow}"></td> <form action="" method="post" style="display: inline;">
<td th:text="${borrow.dateScheduledReturn}"></td> <input name="" th:value="${}" type="hidden">
<td> <input type="submit" value="返却">
<!--返却フォーム--> </form>
<form action="/returnConfirm" method="get"> </td>
<!--送信するデータ名、送信する値、送信する指定--> </tbody>
<input name="idRequest" th:value="${borrow.idRequest}" type="hidden">
<input type="submit" value="返却">
</form>
</td>
</tr>
</tbody>
</table>
<br>
<th:block th:if="${borrowList == null or borrowList.isEmpty()}">
貸出中の書籍はありません
</th:block>
</body> </body>
</html> </html>

View File

@@ -1,46 +0,0 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>メニュー</title>
</head>
<body>
<h1>
<div class="rightSection">
<button class="logoutButton" th:onclick="logoutSubmit()">ログアウト</button>
</div>
</h1>
<!-- 管理者フラグのチェック処理-->
<!-- 一般ユーザー向けのメニュー-->
<table class="menuClass">
<tr>
<td>
<a class="menuClass" th:href="@{/bookList}"><i class="fas fa-search"></i>書籍検索</a>
</td>
</tr>
</table>
<!-- 管理者向けのメニュー-->
<div th:if="${FlgAdmin == '1'}">
<table class="menuClass">
<tr>
<td>
<a class="menuClass" href="@{/application}"><i
class="fas fa-search"></i>書籍貸出申請一覧</a>
</td>
</tr>
<tr>
<td>
<a class="menuClass" href="@{/lendingList}"><i class="fas fa-search"></i>貸出中書籍一覧</a>
</td>
</tr>
</table>
</div>
</body>
</html>