Compare commits
10 Commits
280331fdf6
...
49c40a05c4
| Author | SHA1 | Date | |
|---|---|---|---|
| 49c40a05c4 | |||
| cf4eba2761 | |||
|
|
d452eae384 | ||
|
|
79fd664f86 | ||
|
|
d558372236 | ||
|
|
106b614944 | ||
|
|
335ad988e1 | ||
|
|
bce2ad0a5d | ||
|
|
fef19ff579 | ||
|
|
aec3f3d4e6 |
@@ -1,7 +1,5 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -51,7 +49,7 @@ private StorageLocationRepository storageLocationRepository;
|
||||
model.addAttribute("subCategoryList",subCategoryRepository.findByBookCategory_BookCategoryId(bookInsert.getBookCategoryId()));
|
||||
//そのカテゴリに属するサブカテゴリを持ってくる
|
||||
} else{
|
||||
model.addAttribute("subCategoryList",new ArrayList<>());
|
||||
model.addAttribute("subCategoryList",subCategoryRepository.findAll());
|
||||
}
|
||||
model.addAttribute("locationList",storageLocationRepository.findAll());
|
||||
model.addAttribute("bookInsert", bookInsert);
|
||||
@@ -71,7 +69,7 @@ private StorageLocationRepository storageLocationRepository;
|
||||
if(bookInsert.getBookCategoryId() != null) {
|
||||
model.addAttribute("subCategoryList",subCategoryRepository.findByBookCategory_BookCategoryId(bookInsert.getBookCategoryId()));
|
||||
} else{
|
||||
model.addAttribute("subCategoryList",new ArrayList<>());
|
||||
model.addAttribute("subCategoryList",subCategoryRepository.findAll());
|
||||
}
|
||||
model.addAttribute("locationList",storageLocationRepository.findAll());
|
||||
model.addAttribute("bookInsert",bookInsert);
|
||||
|
||||
@@ -5,6 +5,8 @@ import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -28,8 +30,9 @@ public class AccountEntity {
|
||||
@Column(name="login_info_id")
|
||||
private Integer loginInfoId;
|
||||
|
||||
@Column(name="employee_id")
|
||||
private Integer employeeId;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "employee_id")
|
||||
private Employee employee;
|
||||
|
||||
@Column(name="password_hash")
|
||||
private String passwordHash;
|
||||
|
||||
@@ -6,6 +6,6 @@ import com.example.demo.entity.AccountEntity;
|
||||
|
||||
public interface AccountRepository extends JpaRepository<AccountEntity,Integer>{
|
||||
|
||||
AccountEntity findByEmployeeId (Integer employeeId);
|
||||
AccountEntity findByEmployee_EmployeeId (Integer employeeId);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class LoginService {
|
||||
|
||||
public AccountEntity login(LoginForm form) {
|
||||
AccountEntity accountEntity =
|
||||
accountRepository.findByEmployeeId(form.getEmployeeId());
|
||||
accountRepository.findByEmployee_EmployeeId(form.getEmployeeId());
|
||||
|
||||
if(accountEntity == null) {
|
||||
return null;
|
||||
|
||||
@@ -8,9 +8,33 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="header-bar">
|
||||
|
||||
<div class="header-left">
|
||||
ShareBooks
|
||||
</div>
|
||||
|
||||
<div class="header-right">
|
||||
|
||||
<span class="user">
|
||||
<span th:text="${session.loginEmployee.employee.employeeName}"></span>
|
||||
(<span th:text="${session.loginEmployee.adminFlag == 1 ? '管理者' : '一般'}"></span>)
|
||||
</span>
|
||||
|
||||
<a class="button-link" th:href="@{/logout}">
|
||||
ログアウト
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h1>社内図書一覧</h1>
|
||||
|
||||
<div class="float-end">
|
||||
<a th:href="@{/topmenu}">トップメニューへ</a>
|
||||
</div>
|
||||
|
||||
<form class="input-group" th:action="@{/searchBooks}" th:object="${bookSearchForm}" method="get">
|
||||
@@ -32,9 +56,6 @@
|
||||
<p>※「タイトル」「出版社」「著者名」で検索</p>
|
||||
|
||||
|
||||
|
||||
<form method="get" action="bookLend">
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -47,12 +68,12 @@
|
||||
<th>カテゴリー名</th>
|
||||
<th>サブカテゴリー名</th>
|
||||
<th>保管場所</th>
|
||||
<th>本の状態</th>
|
||||
<th>登録日時</th>
|
||||
<th>更新日時</th>
|
||||
<th>寄贈者</th>
|
||||
<th th:if="${session.loginEmployee.adminFlag == 1}">本の状態</th>
|
||||
<th th:if="${session.loginEmployee.adminFlag == 1}">登録日時</th>
|
||||
<th th:if="${session.loginEmployee.adminFlag == 1}">更新日時</th>
|
||||
<th th:if="${session.loginEmployee.adminFlag == 1}">寄贈者</th>
|
||||
<th>貸出状態</th>
|
||||
<th>操作</th>
|
||||
<th th:if="${session.loginEmployee.adminFlag == 1}">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -68,20 +89,23 @@
|
||||
<td th:text="*{book.bookSubcategory.bookCategory.bookCategoryName}"></td>
|
||||
<td th:text="*{book.bookSubcategory.bookSubcategoryName}"></td>
|
||||
<td th:text="*{book.storageLocation.locationName}"></td>
|
||||
<td th:text="*{book.condition == 0 ? '分からない':
|
||||
<td th:if="${session.loginEmployee.adminFlag == 1}"
|
||||
th:text="*{book.condition == 0 ? '分からない':
|
||||
book.condition == 1 ? '新品':
|
||||
book.condition == 2 ? '良好':
|
||||
book.condition == 3 ? '使用感あり':
|
||||
book.condition == 4 ? '痛みあり':
|
||||
'不明'}">
|
||||
</td>
|
||||
<td th:text="*{book.createdAt}"></td>
|
||||
<td th:text="*{book.updatedAt}"></td>
|
||||
<td th:text="*{book.employee != null ? book.employee.employeeName : '-'}"></td>
|
||||
<td
|
||||
th:text="*{book.bookLends != null ? (book.bookLends.bookStatus == 0 ? '貸出可': '貸出不可') : '貸出可'}">
|
||||
</td>
|
||||
<td>
|
||||
<td th:if="${session.loginEmployee.adminFlag == 1}" th:text="*{book.createdAt}"></td>
|
||||
<td th:if="${session.loginEmployee.adminFlag == 1}" th:text="*{book.updatedAt}"></td>
|
||||
<td th:if="${session.loginEmployee.adminFlag == 1}"
|
||||
th:text="*{book.employee != null ? book.employee.employeeName : '-'}"></td>
|
||||
<td th:text="*{book.bookLends != null ?
|
||||
(book.bookLends.bookStatus == 0 ? '貸出可': '貸出不可') : '貸出可'}"></td>
|
||||
|
||||
<td th:if="${session.loginEmployee.adminFlag == 1}">
|
||||
|
||||
<form method="post" action="/bookLend">
|
||||
<input type="hidden" name="bookManageId" th:value="*{book.bookManageId}">
|
||||
<button type="submit"
|
||||
@@ -89,14 +113,21 @@
|
||||
貸出
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form method="post" action="/updateconfirm">
|
||||
<input type="hidden" name="bookManageId" th:value="*{book.bookManageId}">
|
||||
<button type="submit">更新</button>
|
||||
<button type="submit">
|
||||
更新
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form method="get" action="/delete">
|
||||
<input type="hidden" name="bookManageId" th:value="*{book.bookManageId}">
|
||||
<button type="submit">削除</button>
|
||||
<button type="submit">
|
||||
削除
|
||||
</button>
|
||||
</form>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -105,12 +136,11 @@
|
||||
該当する図書がありません
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -8,10 +8,11 @@
|
||||
|
||||
<body>
|
||||
<h1>新規図書登録入力</h1>
|
||||
<br><br>
|
||||
<h4>新しく図書を登録します。必要事項を入力し、「登録」ボタンを押してください</h4>
|
||||
<br>
|
||||
<h4>新しく図書を登録します。必要事項を入力し、「登録」ボタンを押してください。</h4>
|
||||
<span style="color:red;">※は必須項目です</span>
|
||||
<br><br>
|
||||
<br>
|
||||
<h4>図書情報</h4>
|
||||
<form action="/bookInsertConfirm" method="POST" th:object="${bookInsert}">
|
||||
|
||||
|
||||
@@ -19,17 +20,23 @@
|
||||
<input type="text"
|
||||
id="bookManageId"
|
||||
placeholder="登録時に自動採番されます" readonly>
|
||||
<br><br>
|
||||
<div style="font-size:12px; color:rgb(128, 128, 128);">
|
||||
※例:BK-1、BK-2...
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<label for="title">タイトル<span style="color:red;">※</span></label><br>
|
||||
<input type="text" id="title" name="title" placeholder="タイトルを入力" th:value="${bookInsert.title}" required>
|
||||
<br><br>
|
||||
|
||||
<label for="isbn">ISBN<span style="color:red;">※</span></label><br>
|
||||
<input type="text" id="isbn" name="isbn" placeholder="ISBNを入力" th:value="${bookInsert.isbn}" required>
|
||||
<div th:if="${#fields.hasErrors('isbn')}" th:errors="*{isbn}" style="color:red">
|
||||
<input type="text" id="isbn" name="isbn" placeholder="例:978-4-123-45678-9" th:value="${bookInsert.isbn}" required>
|
||||
<div style="font-size:12px; color:rgb(128, 128, 128);">
|
||||
※ハイフン(4つ)を含む形式で入力してください
|
||||
</div>
|
||||
<div th:if="${#fields.hasErrors('isbn')}" th:errors="*{isbn}" style="color:red">
|
||||
</div>
|
||||
<br><br>
|
||||
<br>
|
||||
|
||||
<label for="title">著者名<span style="color:red;">※</span></label><br>
|
||||
<input type="text" id="author" name="author" placeholder="著者名を入力" th:value="${bookInsert.author}" required>
|
||||
@@ -50,30 +57,34 @@
|
||||
<br><br>
|
||||
|
||||
<label for="subcategory">サブカテゴリ<span style="color:red;">※</span></label><br>
|
||||
<select th:field="*{subcategory}">
|
||||
<select th:field="*{subcategory}" required>
|
||||
<option value="">選択してください</option>
|
||||
<option th:each="sub:${subCategoryList}"
|
||||
th:value="${sub.bookSubcategoryId}"
|
||||
th:text="${sub.bookSubcategoryName}" required>
|
||||
th:text="${sub.bookSubcategoryName}">
|
||||
</option>
|
||||
</select>
|
||||
<div th:if="${#fields.hasErrors('subcategory')}" th:errors="*{subcategory}" style="color:red">
|
||||
</div>
|
||||
<br><br>
|
||||
|
||||
<label for="location">保管場所<span style="color:red;">※</span></label><br>
|
||||
<select th:field="*{location}">
|
||||
<select th:field="*{location}" required>
|
||||
<option value="">選択してください</option>
|
||||
<option th:each="location:${locationList}"
|
||||
th:value="${location.locationId}"
|
||||
th:text="${location.locationName}" required>
|
||||
th:text="${location.locationName}" >
|
||||
</option>
|
||||
|
||||
</select>
|
||||
<div th:if="${#fields.hasErrors('location')}" th:errors="*{location}" style="color:red">
|
||||
</div>
|
||||
<br><br>
|
||||
|
||||
<label for="condition">図書状態<span style="color:red;">※</span></label><br>
|
||||
<select th:field="*{condition}" required>
|
||||
<option value="">選択してください</option>
|
||||
<option value="1">新品同様</option>
|
||||
<option value="1">新品</option>
|
||||
<option value="2">良好</option>
|
||||
<option value="3">使用感あり</option>
|
||||
<option value="4">傷みあり</option>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<!-- もどる: 入力中の値を持って入力画面へ -->
|
||||
<form method="post" th:action="@{/bookInsert}" >
|
||||
<input type="hidden" name="bookId" th:value="${bookInsert.bookId}">
|
||||
<input type="hidden" name="bookmanageId" th:value="${bookInsert.bookManageId}">
|
||||
<input type="hidden" name="bookManageId" th:value="${bookInsert.bookManageId}">
|
||||
<input type="hidden" name="title" th:value="${bookInsert.title}">
|
||||
<input type="hidden" name="isbn" th:value="${bookInsert.isbn}">
|
||||
<input type="hidden" name="author" th:value="${bookInsert.author}">
|
||||
|
||||
Reference in New Issue
Block a user