Compare commits
4 Commits
76c299ca3e
...
s-ikeda
| Author | SHA1 | Date | |
|---|---|---|---|
| 15d510df3b | |||
| 43f91b4116 | |||
| f091771efc | |||
| bb9fdcca5e |
@@ -74,11 +74,6 @@
|
|||||||
<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>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,64 +1,64 @@
|
|||||||
package com.example.demo.controller;
|
//package com.example.demo.controller;
|
||||||
|
//
|
||||||
import java.util.logging.Level;
|
//import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
//import java.util.logging.Logger;
|
||||||
|
//
|
||||||
import jakarta.servlet.http.HttpSession;
|
//import jakarta.servlet.http.HttpSession;
|
||||||
|
//
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//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.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
//import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
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;
|
||||||
|
//
|
||||||
import com.example.demo.form.ApprovalForm;
|
//import com.example.demo.form.ApprovalForm;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 書籍貸出承認確認用のコントローラ
|
// * 書籍貸出承認確認用のコントローラ
|
||||||
*/
|
// */
|
||||||
@Controller
|
//@Controller
|
||||||
public class ApprovalConfirmController {
|
//public class ApprovalConfirmController {
|
||||||
|
//
|
||||||
// ログ出力用インスタンス
|
// // ログ出力用インスタンス
|
||||||
private final static Logger LOGGER = Logger.getLogger(ApprovalConfirmController.class.getName());
|
// private final static Logger LOGGER = Logger.getLogger(ApprovalConfirmController.class.getName());
|
||||||
|
//
|
||||||
// エラーメッセージ用の定数フィールド
|
// // エラーメッセージ用の定数フィールド
|
||||||
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
// private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
//
|
||||||
HttpSession httpSession;
|
// HttpSession httpSession;
|
||||||
ApprovalForm approvalform;
|
// ApprovalForm approvalform;
|
||||||
|
//
|
||||||
@Autowired
|
// @Autowired
|
||||||
public ApprovalConfirmController(
|
// public ApprovalConfirmController(
|
||||||
HttpSession httpSession,
|
// HttpSession httpSession,
|
||||||
ApprovalForm approvalform) {
|
// ApprovalForm approvalform) {
|
||||||
this.httpSession = httpSession;
|
// this.httpSession = httpSession;
|
||||||
this.approvalform = approvalform;
|
// this.approvalform = approvalform;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@ModelAttribute
|
// @ModelAttribute
|
||||||
public ApprovalForm approvalForm() {
|
// public ApprovalForm approvalForm() {
|
||||||
return new ApprovalForm();
|
// return new ApprovalForm();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@RequestMapping(value = "/ApprovalConfirm", method = RequestMethod.POST)
|
// @RequestMapping(value = "/ApprovalConfirm", method = RequestMethod.POST)
|
||||||
public String AprrvalForm(ApprovalForm ApprovalForm, Model model) {
|
// public String AprrvalForm(ApprovalForm ApprovalForm, Model model) {
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
|
//
|
||||||
|
//
|
||||||
return;
|
// return;
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
// ログイン情報の破棄
|
// // ログイン情報の破棄
|
||||||
httpSession.invalidate();
|
// httpSession.invalidate();
|
||||||
|
//
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
// エラーログ出力
|
// // エラーログ出力
|
||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
// LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
// エラー画面遷移
|
// // エラー画面遷移
|
||||||
return "error";
|
// return "error";
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.example.demo.repository;
|
package com.example.demo.repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -8,4 +10,9 @@ import com.example.demo.entity.Borrow_booksEntity;
|
|||||||
@Repository
|
@Repository
|
||||||
public interface Borrow_BooksRepository extends JpaRepository<Borrow_booksEntity, Integer> {
|
public interface Borrow_BooksRepository extends JpaRepository<Borrow_booksEntity, Integer> {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 申請者IDで検索
|
||||||
|
* */
|
||||||
|
Optional<Borrow_booksEntity> findByIdApplicant(Integer idApplicant);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package com.example.demo.service;
|
|
||||||
|
|
||||||
public interface ApprovalBorrowBooks {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
package com.example.demo.service.Impl;
|
//package com.example.demo.service.Impl;
|
||||||
|
//
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
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 org.springframework.transaction.annotation.Transactional;
|
//import org.springframework.transaction.annotation.Transactional;
|
||||||
|
//
|
||||||
import com.example.demo.repository.Borrow_BooksRepository;
|
//import com.example.demo.repository.Borrow_BooksRepository;
|
||||||
import com.example.demo.service.ApprovalBorrowBooks;
|
//import com.example.demo.service.ApprovalBorrowBooks;
|
||||||
|
//
|
||||||
@Service
|
//@Service
|
||||||
@Transactional
|
//@Transactional
|
||||||
public class ApprovalBorrowBooksImpl implements ApprovalBorrowBooks {
|
//public class ApprovalBorrowBooksImpl implements ApprovalBorrowBooks {
|
||||||
|
//
|
||||||
Borrow_BooksRepository borrowbooksRepository;
|
// Borrow_BooksRepository borrowbooksRepository;
|
||||||
|
//
|
||||||
@Autowired
|
// @Autowired
|
||||||
public ApprovalBorrowBooksImpl(Borrow_BooksRepository borrowbooksRepository) {
|
// public ApprovalBorrowBooksImpl(Borrow_BooksRepository borrowbooksRepository) {
|
||||||
this.borrowbooksRepository = borrowbooksRepository;
|
// this.borrowbooksRepository = borrowbooksRepository;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* 申請情報から全件取得
|
// /* 申請情報から全件取得
|
||||||
* @return 取得した情報すべて
|
// * @return 取得した情報すべて
|
||||||
*/
|
// */
|
||||||
public List<???> selectAll() {
|
// public List<???> selectAll() {
|
||||||
return ???Entity.create???List(???Repository.findAll());
|
// return ???Entity.create???List(???Repository.findAll());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
@@ -12,90 +12,9 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>
|
|
||||||
<div class="rightSection">
|
<div class="rightSection">
|
||||||
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
</div>
|
</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>
|
<div class="header-spacing"></div>
|
||||||
<a href="showMenu">メニューに戻る</a>
|
<a href="showMenu">メニューに戻る</a>
|
||||||
@@ -103,37 +22,38 @@
|
|||||||
<div class="header-spacing"></div>
|
<div class="header-spacing"></div>
|
||||||
<h1><span>検索結果</span></h1>
|
<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>
|
<div class="header-spacing"></div>
|
||||||
<th:block th:if="${employeeInfoFormList != null and employeeInfoFormList.size() > 0}">
|
<th:block th:if="${employeeInfoFormList != null and employeeInfoFormList.size() > 0}">
|
||||||
<!-- 検索結果が1件以上ある場合 -->
|
<!-- 検索結果が1件以上ある場合 -->
|
||||||
<table class="table-grid table-striped table-hover">
|
<table class="table-grid table-striped table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 60px;">申請ID</th>
|
<th style="width: 100px;">申請ID</th>
|
||||||
<th style="width: 100px;">申請者名</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: 100px;">貸出日</th>
|
<th style="width: 100px;">貸出日</th>
|
||||||
<th style="width: 70px;">返却予定日</th>
|
<th style="width: 100px;">返却予定日</th>
|
||||||
<th style="width: 150px;">操作</th>
|
<th style="width: 100px;">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr th:each="employeeInfoForm : ${employeeInfoFormList}">
|
<tr th:each="employeeInfoForm : ${employeeInfoFormList}">
|
||||||
<td th:text="${employeeInfoForm.idEmployee}"></td>
|
<td th:text="${employeeInfoForm.idRequest}"></td>
|
||||||
<td th:text="${employeeInfoForm.nmEmployee}"></td>
|
<td th:text="${employeeInfoForm.nmApplicant}"></td>
|
||||||
<td th:text="${employeeInfoForm.knEmployee}"></td>
|
<td th:text="${employeeInfoForm.nmBook}"></td>
|
||||||
<td th:text="${employeeInfoForm.mailAddress}"></td>
|
<td th:text="${employeeInfoForm.dateRequest}"></td>
|
||||||
<td th:text="${employeeInfoForm.password}"></td>
|
<td th:text="${employeeInfoForm.dateBorrow}"></td>
|
||||||
<td th:text="${employeeInfoForm.adminAuth}"></td>
|
<td th:text="${employeeInfoForm.dateReturn}"></td>
|
||||||
<td th:text="${employeeInfoForm.nmDepartment}"></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>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -145,18 +65,5 @@
|
|||||||
</th:block>
|
</th:block>
|
||||||
|
|
||||||
</body>
|
</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>
|
</html>
|
||||||
Reference in New Issue
Block a user