Merge remote-tracking branch 'origin/y-nakano' into a-takayama

This commit is contained in:
2026-10-20 16:35:57 +09:00
16 changed files with 533 additions and 15 deletions

View File

@@ -74,6 +74,11 @@
<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>
@@ -122,3 +127,5 @@
</build> </build>
</project> </project>

View File

@@ -0,0 +1,64 @@
package com.example.demo.controller;
import java.util.logging.Level;
import java.util.logging.Logger;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.example.demo.form.ApprovalForm;
/**
* 書籍貸出承認確認用のコントローラ
*/
@Controller
public class ApprovalConfirmController {
// ログ出力用インスタンス
private final static Logger LOGGER = Logger.getLogger(ApprovalConfirmController.class.getName());
// エラーメッセージ用の定数フィールド
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
HttpSession httpSession;
Request request;
@Autowired
public ApprovalConfirmController(
HttpSession httpSession,
Request request) {
this.httpSession = httpSession;
this.request = request;
}
@ModelAttribute
public ApprovalForm approvalForm() {
return new ApprovalForm();
}
@RequestMapping(value = "/ApprovalConfirm", method = RequestMethod.POST)
public String AprrvalForm(ApprovalForm ApprovalForm, Model model) {
try {
return a ;
} catch (Exception e) {
// ログイン情報の破棄
httpSession.invalidate();
e.printStackTrace();
// エラーログ出力
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
// エラー画面遷移
return "error";
}
}
}

View File

@@ -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;
//
// }
}

View File

@@ -1,5 +0,0 @@
package com.example.demo.controller;
public class a {
}

View File

@@ -54,7 +54,7 @@ public class Borrow_booksEntity {
* ステータス * ステータス
* */ * */
@Column(name = "status", nullable = false, columnDefinition = "default 1") @Column(name = "status", nullable = false, columnDefinition = "default 1")
private char status; private Character status;
/* /*
* 承認者 * 承認者

View File

@@ -1,5 +1,141 @@
package com.example.demo.entity; package com.example.demo.entity;
public class EmployeeEntity { import java.security.Timestamp;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import org.springframework.data.annotation.LastModifiedDate;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* EmployeeテーブルのEntity
*/
@Entity
@Table(name = "employee")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EmployeeEntity {
/**
* 社員ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id_employee", nullable = false)
private Integer idEmployee;
/**
* 社員名
*/
@Column(name = "nm_employee", nullable = false, length = 50)
private String nmEmployee;
/**
* 社員よみ
*/
@Column(name = "kn_employee", nullable = false, length = 100)
private String knEmployee;
/**
* メールアドレス
*/
@Column(name = "mail_address", nullable = false, length = 256)
private String MailAddress;
/**
* パスワード
*/
@Column(name = "password", nullable = false, length = 256)
private String Password;
/**
* 管理者フラグ
*/
@Column(name = "flg_admin", nullable = false)
private Character FlgAdmin;
/**
* 退職者フラグ
*/
@Column(name = "flg_retirement", nullable = false)
private Character FlgRetirement;
/**
* 更新者
*/
@Column(name = "id_update", nullable = false)
private Integer idUpdate;
/**
* 更新日
*/
@Column(name = "date_update", nullable = false)
@LastModifiedDate
private Timestamp dateUpdate;
} }
// public static EmployeeEntity convertForm(Employee employee) {
// return new EmployeeEntity(
// employee.getIdEmployee(),
// employee.getnmEmployee(),
// employee.getknEmployee(),
// employee.getMailAddress(),
// employee.getPassword(),
// employee.getFlgAdmin(),
// employee.getFlgRetirement(),
// employee.getIdUpdate(),
// employee.getDateUpdate());
//
// }
//
// public static EmployeeEntity convertFrom(SearchConditionEmployee searchConditionEmployee) {
// EmployeeEntity employeeEntity = new EmployeeEntity();
//
// employeeEntity.setIdEmployee(searchConditionEmployee.getIdEmployee());
// employeeEntity.setNmEmployee(searchConditionEmployee.getNmEmployee());
// employeeEntity.setKnEmployee(searchConditionEmployee.getKnEmployee());
// employeeEntity.setMailAddress(searchConditionEmployee.getMailAddress());
//
// return employeeEntity;
//
// }
//
// public static Employee createEmployee(EmployeeEntity employeeEntity) {
// return new Employee(
// employeeEntity.getIdEmployee(),
// employeeEntity.getNmEmployee(),
// employeeEntity.getKnEmployee(),
// employeeEntity.getMailAddress(),
// employeeEntity.getPassword(),
// employeeEntity.getFlgAdmin(),
// employeeEntity.getFlgRetirement(),
// employeeEntity.getIdUpdate(),
// employeeEntity.getDateUpdate());
// }
//
// public static List<Employee> createEmployeeList(List<EmployeeEntity> employeeEntityList) {
// return employeeEntityList.stream().map(EmployeeEntity::createEmployee).toList();
// }
//
// public LoginUser createLoginUser() {
// getIdEmployee(),
// getNmEmployee(),
// getKnEmployee(),
// getMailAddress(),
// getPassword(),
// getFlgAdmin(),
// getFlgRetirement(),
// getIdUpdate(),
// getDateUpdate());
//}
//}

View File

@@ -1,5 +0,0 @@
package com.example.demo.entity;
public class a {
}

View File

@@ -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;
@@ -7,5 +9,6 @@ import com.example.demo.entity.EmployeeEntity;
@Repository @Repository
public interface EmployeeRepository extends JpaRepository<EmployeeEntity, Integer> { public interface EmployeeRepository extends JpaRepository<EmployeeEntity, Integer> {
Optional<EmployeeEntity> findByMailAddressAndPassword(String mailAddress, String password);
} }

View File

@@ -0,0 +1,5 @@
package com.example.demo.service;
public interface ApprovalBorrowBooks {
}

View File

@@ -0,0 +1,31 @@
package com.example.demo.service.Impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.example.demo.repository.Borrow_BooksRepository;
import com.example.demo.service.ApprovalBorrowBooks;
@Service
@Transactional
public class ApprovalBorrowBooksImpl implements ApprovalBorrowBooks {
Borrow_BooksRepository borrowbooksRepository;
@Autowired
public ApprovalBorrowBooksImpl(Borrow_BooksRepository borrowbooksRepository) {
this.borrowbooksRepository = borrowbooksRepository;
}
/* 申請情報から全件取得
* @return 取得した情報すべて
*/
public List<???> selectAll() {
return ???Entity.create???List(???Repository.findAll());
}
}

View File

@@ -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;
}
}

View File

@@ -0,0 +1,5 @@
package com.example.demo.service;
public class S {
}

View File

@@ -0,0 +1,15 @@
<!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>
</body>
</html>

View File

@@ -0,0 +1,141 @@
<!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">
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
</div>
</h1>
<!-- 変数名は変更したが、中身は変更していない -->
<!-- ボタンや遷移も手を付けていない -->
<form action="insertEmployee"
id="insertForm"
method="post"
th:object="${insertEmployeeForm}">
<div class="msgBox error" th:if="${messageError != null}">
<span class="error" th:each="message : ${messageError.message}" th:text="${message}"></span>
</div>
<table>
<tr>
<th class="header">申請ID</th>
<td>
<label>
<input class="readOnly"
name="idRquest"
readonly="readonly"
type="text"
value="自動で設定されます"/>
</label>
</td>
</tr>
<tr>
<th class="header">申請者名</th>
<td>
<label>
<input class="readOnly"
name="nmEmployee"
readonly="readonly"
th:value="*{nmEmployee}"
type="text"/>
</label>
</td>
</tr>
<tr>
<th class="header">申請日</th>
<td>
<label>
<input class="readOnly"
name="dataRequest"
readonly="readonly"
th:value="*{dataRequest}"
type="text"/>
</label>
</td>
</tr>
<tr>
<th class="header">ISBN</th>
<td>
<label>
<input class="readOnly"
name="isBn"
readonly="readonly"
th:value="*{isBn}"
type="text"/>
</label>
</td>
</tr>
<tr>
<th class="header">書籍名</th>
<td>
<label>
<input class="readOnly"
name="nmBook"
readonly="readonly"
th:value="*{nmBook}"
type="text"/>
</label>
</td>
</tr>
<tr>
<th class="header">出版社</th>
<td>
<label>
<input class="readOnly"
name="publisher"
readonly="readonly"
th:value="*{publisher}"
type="text"/>
</label>
</td>
</tr>
<tr>
<th class="header">特記事項</th>
<td>
<label>
<input class="readOnly"
name="note"
readonly="readonly"
th:value="*{note}"
type="text"/>
</label>
</td>
</tr>
<tr>
<th class="header">貸出日</th>
<td>
<label>
<input class="readOnly"
name="dateBorrow"
readonly="readonly"
th:value="*{dateBorrow}"
type="text"/>
</label>
</td>
</tr>
<tr>
<th class="header">返却予定日</th>
<td>
<label>
<input class="readOnly"
name="dateScheduledReturn"
readonly="readonly"
th:value="*{date_scheduled_return}"
type="text"/>
</label>
</td>
</tr>
</table>
</form>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<!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>
</body>
</html>

View 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>