Compare commits
17 Commits
service
...
adae4c5de5
| Author | SHA1 | Date | |
|---|---|---|---|
| adae4c5de5 | |||
| 1b73b9329f | |||
| 384154436f | |||
| 2d4ec7f061 | |||
| a58ccda9c8 | |||
| a4a675d68e | |||
| 56da7392b9 | |||
| ab57ed4ec8 | |||
| ba81a9b50f | |||
| 0af33fb0c0 | |||
| c730538e56 | |||
| 4fb0f51dc4 | |||
| c5142cdfdf | |||
| 53485523b0 | |||
| 6b0fcad592 | |||
| 077b53243a | |||
| ef84f8ff26 |
@@ -74,7 +74,6 @@
|
|||||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.example.demo.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class LendingListController {
|
||||||
|
|
||||||
|
// @GetMapping("/lendingList")
|
||||||
|
// public String show(Model model) {
|
||||||
|
// List<X> x = xservice.getX();
|
||||||
|
// model.addAttribute("Y", x);
|
||||||
|
// return "Y";
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// HttpSession session;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// public SelectListController(HttpSession session) {
|
||||||
|
// this.session=session;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @RequestMapping("/lendingList")
|
||||||
|
// public String lendList() {
|
||||||
|
// return "lendingList";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @RequestMapping(value = lendingList, method = RequestMethod.POST)
|
||||||
|
// public String select( , Model model) {
|
||||||
|
// model.addAttribute(
|
||||||
|
// );
|
||||||
|
// return lendingList;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -45,15 +45,32 @@ public class SelectBookController {
|
|||||||
|
|
||||||
// ① 書籍一覧の初期表示
|
// ① 書籍一覧の初期表示
|
||||||
|
|
||||||
@RequestMapping(value ="/selectBook", method = RequestMethod.GET)
|
@RequestMapping(value ="/selectBook", method = RequestMethod.POST)
|
||||||
public String select(Model model) {
|
public String select(Model model) {
|
||||||
try {
|
try {
|
||||||
//貸出可能な書籍を全権取得する
|
//貸出可能な書籍を全権取得する
|
||||||
List<Book_collectionEntity> books = searchBook.selectAll();
|
List<Book_collectionEntity> books = searchBook.selectAll();
|
||||||
//検索結果をmodelに登録する
|
//検索結果をmodelに登録する
|
||||||
model.addAttribute("books" , books);
|
model.addAttribute("books" , books);
|
||||||
//書籍一覧画面を表示する
|
|
||||||
return "book-search";
|
//!!ここに管理者か一般ユーザか判断・でボタンを表示するための処理が必要
|
||||||
|
|
||||||
|
// 一旦コメントアウト
|
||||||
|
// LoginUser loginUser = httpSession.getAttribute("loginUser");
|
||||||
|
// //ログイン情報が存在しない場合はログイン画面へ
|
||||||
|
// if(LoginUser == null) {
|
||||||
|
// return "/login";
|
||||||
|
// }
|
||||||
|
// //LoginUserのisAdminUser()を呼び出す
|
||||||
|
// //管理者ならtrue、一般社員ならfalse
|
||||||
|
// boolean isAdmin = loginUser.isAdminUser();
|
||||||
|
// //判定結果をModelに格納あうる
|
||||||
|
// //HTMLでは"{isAdmin}"として使用
|
||||||
|
// model.addAttribute("isAdmin",isAdmin);
|
||||||
|
// // Sessionからログイン者情報を取得する
|
||||||
|
|
||||||
|
return "bookList";
|
||||||
|
|
||||||
|
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
//httpSessionを破棄
|
//httpSessionを破棄
|
||||||
@@ -66,13 +83,45 @@ public class SelectBookController {
|
|||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ② 検索ボタン押下時の処理
|
// ② 検索ボタン押下時の処理
|
||||||
|
|
||||||
@RequestMapping(value ="/selectBook", method = RequestMethod.POST)
|
@RequestMapping(value ="/selectBook", method = RequestMethod.GET)
|
||||||
public String ) {
|
public String select(SearchConditionBookForm searchConditionBookForm, Model model) {
|
||||||
|
try {
|
||||||
|
List<Book_collectionEntity> books = searchBook.searchByWithLike(searchConditionBookForm);
|
||||||
|
model.addAttribute("books", books);
|
||||||
|
//
|
||||||
|
//!!ここに管理者か一般ユーザか判断・でボタンを表示するための処理が必要?
|
||||||
|
//
|
||||||
|
// 一旦コメントアウト
|
||||||
|
// LoginUser loginUser = httpSession.getAttribute("loginUser");
|
||||||
|
// if(LoginUser == null) {
|
||||||
|
// return "/login";
|
||||||
|
// }
|
||||||
|
// //LoginUserのisAdminUser()を呼び出す
|
||||||
|
// //管理者ならtrue、一般社員ならfalse
|
||||||
|
// boolean isAdmin = loginUser.isAdminUser();
|
||||||
|
// //判定結果をModelに格納あうる
|
||||||
|
// //HTMLでは"{isAdmin}"として使用
|
||||||
|
// model.addAttribute("isAdmin",isAdmin);
|
||||||
|
|
||||||
|
return "bookList";
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
//httpSessionを破棄
|
||||||
|
httpsession.invalidate();
|
||||||
|
//エラー内容を出力
|
||||||
|
e.printStackTrace();
|
||||||
|
//ログにエラーを記録
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
//エラー画面へ遷移
|
||||||
|
return "error";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -138,4 +138,4 @@ public class EmployeeEntity {
|
|||||||
// getIdUpdate(),
|
// getIdUpdate(),
|
||||||
// getDateUpdate());
|
// getDateUpdate());
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.example.demo.service;
|
||||||
|
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
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.repository.Borrow_BooksRepository;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class LendingListService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Book_CollectionRepository collection;
|
||||||
|
@Autowired
|
||||||
|
private Borrow_BooksRepository borrow;
|
||||||
|
@Autowired
|
||||||
|
private EmployeeEntity employee;
|
||||||
|
|
||||||
|
public List<table> getcollectionWithborrow(){
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
5
team1/src/main/java/com/example/demo/service/S.java
Normal file
5
team1/src/main/java/com/example/demo/service/S.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package com.example.demo.service;
|
||||||
|
|
||||||
|
public class S {
|
||||||
|
|
||||||
|
}
|
||||||
162
team1/src/main/resources/templates/applicationList.html
Normal file
162
team1/src/main/resources/templates/applicationList.html
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
<!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>
|
||||||
|
<h1>
|
||||||
|
<div class="rightSection">
|
||||||
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<form action="selectEmployeeInfo"
|
||||||
|
method="post"
|
||||||
|
th:object="${searchConditionEmployeeForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
|
</div>
|
||||||
|
<trtable>
|
||||||
|
<tr>
|
||||||
|
<th class="header">申請ID</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="申請ID"
|
||||||
|
th:field="*{idRequest}"
|
||||||
|
type="number"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">申請者名</th>
|
||||||
|
<td>
|
||||||
|
<select th:field="*{nmApplication}">
|
||||||
|
<option value=""></option>
|
||||||
|
<option th:each="department : ${departmentFormList}"
|
||||||
|
th:selected="${searchConditionEmployeeForm.idDepartment != null && department.idDepartment == searchConditionEmployeeForm.idDepartment}"
|
||||||
|
th:text="${department.nmDepartment}"
|
||||||
|
th:value="${department.idDepartment}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<input placeholder="申請者名"
|
||||||
|
th:field="*{nmApplicant}"
|
||||||
|
type="text"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">書籍名</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="書籍名"
|
||||||
|
th:field="*{nmBook}"
|
||||||
|
type="text"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">申請日</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="申請日"
|
||||||
|
th:field="*{dateRequest}"
|
||||||
|
type="date"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<th class="header">貸出日</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="貸出日"
|
||||||
|
th:field="*{dateBorrow}"
|
||||||
|
type="date"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">返却予定日</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="返却予定日"
|
||||||
|
th:field="*{dateScheduledReturn}"
|
||||||
|
type="date"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">操作</th>
|
||||||
|
<td>
|
||||||
|
<button class="approvalButton" onclick="approvalSubmit()">承認</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<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="${messageInfo != null}">
|
||||||
|
<script th:inline="javascript">
|
||||||
|
alert([[${messageInfo.message}]]);
|
||||||
|
</script>
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
<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: 60px;">申請ID</th>
|
||||||
|
<th style="width: 100px;">申請者名</th>
|
||||||
|
<th style="width: 150px;">書籍名</th>
|
||||||
|
<th style="width: 150px;">申請日</th>
|
||||||
|
<th style="width: 100px;">貸出日</th>
|
||||||
|
<th style="width: 70px;">返却予定日</th>
|
||||||
|
<th style="width: 150px;">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="employeeInfoForm : ${employeeInfoFormList}">
|
||||||
|
<td th:text="${employeeInfoForm.idEmployee}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.nmEmployee}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.knEmployee}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.mailAddress}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.password}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.adminAuth}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.nmDepartment}"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
<th:block th:if="${employeeInfoFormList == null or employeeInfoFormList.size() == 0}">
|
||||||
|
<!-- 検索結果が0件の場合 -->
|
||||||
|
現在書籍貸出の申請はありません。
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function clearInput() {
|
||||||
|
document.getElementById('idRequest').value = '';
|
||||||
|
document.getElementById('idApplicant').value = '';
|
||||||
|
document.getElementById('nmBook').value = '';
|
||||||
|
document.getElementById('dateRequest').value = '';
|
||||||
|
document.getElementById('dateBorrow').value = '';
|
||||||
|
document.getElementById('dateReturn').value = '';
|
||||||
|
document.getElementById('dateRequest').selectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<!-- 検索結果を表示-->
|
<!-- 検索結果を表示-->
|
||||||
<tbody>
|
<tbody>
|
||||||
<!-- booksのデータを1件ずつ取り出す-->
|
<!-- booksのデータを1件ずつ取り出す-->
|
||||||
<td th:each="{book : ${books}}"></td>
|
<tr th:each ="{book : ${books}">
|
||||||
<!--ISBN-->
|
<!--ISBN-->
|
||||||
<td th:each="{book.isbn}"></td>
|
<td th:each="{book.isbn}"></td>
|
||||||
<!--書籍名-->
|
<!--書籍名-->
|
||||||
@@ -63,7 +63,11 @@
|
|||||||
<td th:each="{book.noteText}"></td>
|
<td th:each="{book.noteText}"></td>
|
||||||
<td>
|
<td>
|
||||||
<!-- 管理者の場合は編集ボタン-->
|
<!-- 管理者の場合は編集ボタン-->
|
||||||
<!--一般ユーザーの場合は申請ボタン-->
|
<!--一般ユーザーの場合は>
|
||||||
|
|
||||||
|
<form th:if = "${isAdmin}"
|
||||||
|
th:action>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
44
team1/src/main/resources/templates/lendingList.html
Normal file
44
team1/src/main/resources/templates/lendingList.html
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<title>貸出中書籍一覧</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
<div class="rightSection">
|
||||||
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
|
</div>
|
||||||
|
<a href="menu">メニューに戻る</a>
|
||||||
|
<h1><span>検索結果</span></h1>
|
||||||
|
</h1>
|
||||||
|
<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="">
|
||||||
|
<td th:text="${.idRequest}"></td>
|
||||||
|
<td th:text="${.}"></td>
|
||||||
|
<td th:text="${.}"></td>
|
||||||
|
<td th:text="${.dateRequest}"></td>
|
||||||
|
<td th:text="${.dateBorrow}"></td>
|
||||||
|
<td th:text="${.dateScheduledReturn}"></td>
|
||||||
|
<td>
|
||||||
|
<form action="" method="post" style="display: inline;">
|
||||||
|
<input name="" th:value="${}" type="hidden">
|
||||||
|
<input type="submit" value="返却">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tbody>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user