Compare commits
17 Commits
master
...
o-yamamoto
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7499f64fc9 | ||
|
|
e7b3b42feb | ||
|
|
820d030602 | ||
|
|
995fe03b73 | ||
|
|
cd753bfe2c | ||
|
|
05e60a7e47 | ||
|
|
6ab2ca7db8 | ||
|
|
3ab46927bb | ||
|
|
b7b51df086 | ||
|
|
dee43d9263 | ||
|
|
014996e438 | ||
|
|
14c1f9521c | ||
|
|
5ba4106d45 | ||
|
|
53c704d2a7 | ||
|
|
de546cea2f | ||
|
|
d939ad8f0b | ||
|
|
15c21735ee |
20
EM-System/bin/src/main/resources/templates/error.html
Normal file
20
EM-System/bin/src/main/resources/templates/error.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<!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>エラーが発生しました。</h1>
|
||||||
|
|
||||||
|
<div>ログインからやり直してください。</div>
|
||||||
|
<a href="login">ログイン</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<!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="insertDepartment"
|
||||||
|
id="insertForm"
|
||||||
|
method="post"
|
||||||
|
th:object="${insertDepartmentForm}">
|
||||||
|
|
||||||
|
<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"
|
||||||
|
readonly="readonly"
|
||||||
|
type="text"
|
||||||
|
value="自動で設定されます"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部署名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="nmDepartment"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{nmDepartment}"
|
||||||
|
type="text"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="登録"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a href="javascript:onClickEdit()">登録内容の編集</a> | <a href="showMenu">メニューに戻る</a>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function onClickEdit() {
|
||||||
|
const form = document.getElementById('insertForm');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'insertDepartmentInput');
|
||||||
|
|
||||||
|
// 確認画面から編集画面に戻ってきたときのフラグ(未使用)
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("name", "backFlg");
|
||||||
|
inputField.setAttribute("value", "edit");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<!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="insertDepartmentConfirm"
|
||||||
|
method="post"
|
||||||
|
th:object="${insertDepartmentForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部署ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
readonly="readonly"
|
||||||
|
type="text"
|
||||||
|
value="自動で設定されます"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部署名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50"
|
||||||
|
placeholder="部署名"
|
||||||
|
required="required"
|
||||||
|
th:field="*{nmDepartment}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="登録確認"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<a href="showMenu">メニューに戻る</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<!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>
|
||||||
|
<h2>部署登録が完了しました</h2>
|
||||||
|
<br/>
|
||||||
|
<a href="javascript:insertSubmit()">続けて登録する</a> | <a href="showMenu">メニューに戻る</a>
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function insertSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'insertDepartmentInput');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "select");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
<!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="empId"
|
||||||
|
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="knEmployee"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{knEmployee}"
|
||||||
|
type="text"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="mailAddress"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{mailAddress}"
|
||||||
|
type="text"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="password"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{password}"
|
||||||
|
type="password"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">管理者権限</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth1" name="adminAuth" onclick="return false;"
|
||||||
|
th:checked="${insertEmployeeForm .adminAuth == 1}" type="radio"
|
||||||
|
value="1"> 管理者権限
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth0" name="adminAuth" onclick="return false;"
|
||||||
|
th:checked="${insertEmployeeForm.adminAuth == null or insertEmployeeForm.adminAuth == 0}"
|
||||||
|
type="radio"
|
||||||
|
value="0">
|
||||||
|
一般権限
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">所属部署</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<select name="idDepartment" required="required" th:field="*{idDepartment}">
|
||||||
|
<th:block th:each="department : ${departmentFormList}">
|
||||||
|
<th:block
|
||||||
|
th:if="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}">
|
||||||
|
<option th:text="${department.nmDepartment}"
|
||||||
|
th:value="${department.idDepartment}">
|
||||||
|
</option>
|
||||||
|
</th:block>
|
||||||
|
</th:block>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="登録"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a href="javascript:onClickEdit()">登録内容の編集</a> | <a href="showMenu">メニューに戻る</a>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function onClickEdit() {
|
||||||
|
const form = document.getElementById('insertForm');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'insertEmployeeInput');
|
||||||
|
|
||||||
|
// 確認画面から編集画面に戻ってきたときのフラグ(未使用)
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("name", "backFlg");
|
||||||
|
inputField.setAttribute("value", "edit");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
<!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="insertEmployeeConfirm"
|
||||||
|
method="post"
|
||||||
|
th:object="${insertEmployeeForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
readonly="readonly"
|
||||||
|
type="text"
|
||||||
|
value="自動で設定されます"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50"
|
||||||
|
placeholder="社員名"
|
||||||
|
required="required"
|
||||||
|
th:field="*{nmEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名フリガナ</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50"
|
||||||
|
oninput="convertToKatakana(this)"
|
||||||
|
placeholder="フリガナ"
|
||||||
|
required="required"
|
||||||
|
th:field="*{knEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="100"
|
||||||
|
placeholder="メールアドレス"
|
||||||
|
required="required"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
type="email"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="パスワード"
|
||||||
|
required="required"
|
||||||
|
th:field="*{password}"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- *** Chrome等のブラウザの場合自動でセットされる可能性があるので注意書きを外にも *** -->
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td><span
|
||||||
|
style="font-size:8pt; font-weight:bold; color:red;">※半角英数字をそれぞれ1種類以上含む3-10文字</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード確認用</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="パスワード確認用"
|
||||||
|
required="required"
|
||||||
|
th:field="*{passwordConfirm}"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">管理者権限</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth1" name="adminAuth" th:checked="${insertEmployeeForm .adminAuth == 1}"
|
||||||
|
type="radio"
|
||||||
|
value="1"> 管理者権限
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth0" name="adminAuth"
|
||||||
|
th:checked="${insertEmployeeForm.adminAuth == null or insertEmployeeForm.adminAuth == 0}"
|
||||||
|
type="radio"
|
||||||
|
value="0">
|
||||||
|
一般権限
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">所属部署</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<select required="required" th:field="*{idDepartment}">
|
||||||
|
<option th:each="department : ${departmentFormList}"
|
||||||
|
th:selected="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}"
|
||||||
|
th:text="${department.nmDepartment}"
|
||||||
|
th:value="${department.idDepartment}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="登録確認"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<a href="showMenu">メニューに戻る</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<!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>
|
||||||
|
<h2>社員登録が完了しました</h2>
|
||||||
|
<br/>
|
||||||
|
<a href="javascript:insertSubmit()">続けて登録する</a> | <a href="showMenu">メニューに戻る</a>
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function insertSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'insertEmployeeInput');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "select");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
63
EM-System/bin/src/main/resources/templates/login.html
Normal file
63
EM-System/bin/src/main/resources/templates/login.html
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<!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>ログイン</h1>
|
||||||
|
<form action="doLogin"
|
||||||
|
method="post"
|
||||||
|
th:object="${loginInfoForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td style="width: 250px;">
|
||||||
|
<input placeholder="メールアドレス"
|
||||||
|
required="required"
|
||||||
|
style="width: 100%;"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
type="text"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th style="text-align: right;">パスワード</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="パスワード"
|
||||||
|
required="required"
|
||||||
|
style="width: 100%;"
|
||||||
|
th:field="*{password}"
|
||||||
|
type="password"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="ログイン"/>
|
||||||
|
<button onclick="clearInput()">リセット</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function clearInput() {
|
||||||
|
document.getElementById('mailAddress').value = '';
|
||||||
|
document.getElementById('password').value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
124
EM-System/bin/src/main/resources/templates/menu.html
Normal file
124
EM-System/bin/src/main/resources/templates/menu.html
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
<!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>
|
||||||
|
<table class="menuClass">
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><a class="menuClass" href="javascript:selectEmployeeSubmit()"><i class="fas fa-search"></i> 社員検索 </a>
|
||||||
|
</td>
|
||||||
|
<td class="description">登録済みのユーザ一覧表示と</br>更新、削除を行います。</td>
|
||||||
|
<td><a class="menuClass" href="javascript:selectDepartmentSubmit()"><i class="fas fa-search"></i> 部署検索 </a>
|
||||||
|
</td>
|
||||||
|
<td class="description">登録済みの部署一覧表示と</br>更新、削除を行います。</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><a class="menuClass" href="javascript:insertEmployeeSubmit()"><i class="fas fa-plus"></i> 社員登録 </a></td>
|
||||||
|
<td class="description">新規でユーザ追加を行います。</td>
|
||||||
|
<td><a class="menuClass" href="javascript:insertDepartmentSubmit()"><i class="fas fa-plus"></i> 部署登録 </a>
|
||||||
|
</td>
|
||||||
|
<td class="description">新規で部署追加を行います。</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function selectEmployeeSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'selectEmployeeInfo');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "selectEmployeeInfo");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectDepartmentSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'selectDepartment');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "selectDepartment");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertEmployeeSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'insertEmployeeInput');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "insertEmployeeInput");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertDepartmentSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'insertDepartmentInput');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "insertDepartmentInput");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
||||||
114
EM-System/bin/src/main/resources/templates/selectDepartment.html
Normal file
114
EM-System/bin/src/main/resources/templates/selectDepartment.html
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<!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="selectDepartment"
|
||||||
|
method="post"
|
||||||
|
th:object="${searchConditionDepartmentForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部署ID</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="部署ID"
|
||||||
|
th:field="*{idDepartment}"
|
||||||
|
type="number"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部署名</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="部署名"
|
||||||
|
th:field="*{nmDepartment}"
|
||||||
|
type="text"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="検索"/>
|
||||||
|
</td>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<button onclick="clearInput()">クリア</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="${departmentFormList != null and departmentFormList.size() > 0}">
|
||||||
|
<!-- 検索結果が1件以上ある場合 -->
|
||||||
|
<table class="half-table-grid table-striped table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 60px;">部署ID</th>
|
||||||
|
<th style="width: 100px;">部署名</th>
|
||||||
|
<th style="width: 150px;">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="departmentForm : ${departmentFormList}">
|
||||||
|
<td th:text="${departmentForm.idDepartment}"></td>
|
||||||
|
<td th:text="${departmentForm.nmDepartment}"></td>
|
||||||
|
<td>
|
||||||
|
<!-- 更新フォーム -->
|
||||||
|
<form action="showUpdateDepartment" method="post" style="display: inline;">
|
||||||
|
<input name="idDepartment" th:value="${departmentForm.idDepartment}" type="hidden">
|
||||||
|
<input type="submit" value="更新">
|
||||||
|
</form>
|
||||||
|
<!-- 削除フォーム -->
|
||||||
|
<form action="deleteDepartment" method="post" onsubmit="return confirm('本当に削除しますか?');"
|
||||||
|
style="display: inline;">
|
||||||
|
<input name="idDepartment" th:value="${departmentForm.idDepartment}" type="hidden">
|
||||||
|
<input type="submit" value="削除">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</th:block>
|
||||||
|
<th:block th:if="${departmentFormList == null or departmentFormList.size() == 0}">
|
||||||
|
<!-- 検索結果が0件の場合 -->
|
||||||
|
検索結果はありません。
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function clearInput() {
|
||||||
|
document.getElementById('idDepartment').value = '';
|
||||||
|
document.getElementById('nmDepartment').value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
157
EM-System/bin/src/main/resources/templates/selectEmployee.html
Normal file
157
EM-System/bin/src/main/resources/templates/selectEmployee.html
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
<!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="selectEmployeeInfo"
|
||||||
|
method="post"
|
||||||
|
th:object="${searchConditionEmployeeForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員ID</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="社員ID"
|
||||||
|
th:field="*{idEmployee}"
|
||||||
|
type="number"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="社員名"
|
||||||
|
th:field="*{nmEmployee}"
|
||||||
|
type="text"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名フリガナ</th>
|
||||||
|
<td>
|
||||||
|
<input oninput="convertToKatakana(this)"
|
||||||
|
placeholder="フリガナ"
|
||||||
|
th:field="*{knEmployee}"
|
||||||
|
type="text"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="メールアドレス"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
type="email"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">所属部署</th>
|
||||||
|
<td>
|
||||||
|
<select th:field="*{idDepartment}">
|
||||||
|
<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>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="検索"/>
|
||||||
|
</td>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<button onclick="clearInput()">クリア</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>
|
||||||
|
<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>
|
||||||
|
<td>
|
||||||
|
<!-- 更新フォーム -->
|
||||||
|
<form action="showUpdateEmployee" method="post" style="display: inline;">
|
||||||
|
<input name="idEmployee" th:value="${employeeInfoForm.idEmployee}" type="hidden">
|
||||||
|
<input type="submit" value="更新">
|
||||||
|
</form>
|
||||||
|
<!-- 削除フォーム -->
|
||||||
|
<form action="deleteEmployee" method="post" onsubmit="return confirm('本当に削除しますか?');"
|
||||||
|
style="display: inline;">
|
||||||
|
<input name="idEmployee" th:value="${employeeInfoForm.idEmployee}" type="hidden">
|
||||||
|
<input type="submit" value="削除">
|
||||||
|
</form>
|
||||||
|
</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('idEmployee').value = '';
|
||||||
|
document.getElementById('nmEmployee').value = '';
|
||||||
|
document.getElementById('knEmployee').value = '';
|
||||||
|
document.getElementById('mailAddress').value = '';
|
||||||
|
document.getElementById('idDepartment').selectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<!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="/updateDepartmentResult"
|
||||||
|
method="post"
|
||||||
|
onsubmit="return confirm('本当によろしいですか?');"
|
||||||
|
th:object="${updateDepartmentForm}"
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
readonly="readonly"
|
||||||
|
th:field="*{idDepartment}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部署名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="10"
|
||||||
|
placeholder="部署名"
|
||||||
|
required="required"
|
||||||
|
th:field="*{nmDepartment}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="更新"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<a href="javascript:selectSubmit()">一覧に戻る</a>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function selectSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'selectDepartmentAll');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "selectDepartmentAll");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
<!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="/updateEmployeeResult"
|
||||||
|
method="post"
|
||||||
|
onsubmit="return confirm('本当によろしいですか?');"
|
||||||
|
th:object="${updateEmployeeInfoForm}"
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
readonly="readonly"
|
||||||
|
th:field="*{idEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50"
|
||||||
|
placeholder="社員名"
|
||||||
|
required="required"
|
||||||
|
th:field="*{nmEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名フリガナ</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50"
|
||||||
|
oninput="convertToKatakana(this)"
|
||||||
|
placeholder="フリガナ"
|
||||||
|
required="required"
|
||||||
|
th:field="*{knEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="100"
|
||||||
|
placeholder="メールアドレス"
|
||||||
|
required="required"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
type="email"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="パスワード"
|
||||||
|
th:field="*{password}"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- *** Chrome等のブラウザの場合自動でセットされる可能性があるので注意書きを外にも *** -->
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td>
|
||||||
|
<span style="font-size:8pt;
|
||||||
|
font-weight:bold;
|
||||||
|
color:red;">
|
||||||
|
※半角英数字をそれぞれ1種類以上含む3-10文字
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード確認用</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="パスワード確認用"
|
||||||
|
th:field="*{passwordConfirm}"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">管理者権限</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth1" name="adminAuth" th:checked="${updateEmployeeInfoForm.adminAuth == 1}"
|
||||||
|
type="radio"
|
||||||
|
value="1"> 管理者権限
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth0" name="adminAuth"
|
||||||
|
th:checked="${updateEmployeeInfoForm.adminAuth == null or updateEmployeeInfoForm.adminAuth == 0}"
|
||||||
|
type="radio"
|
||||||
|
value="0">
|
||||||
|
一般権限
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">所属部署</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<select required="required" th:field="*{idDepartment}">
|
||||||
|
<option th:each="department : ${departmentFormList}"
|
||||||
|
th:selected="${updateEmployeeInfoForm.idDepartment != null && department.idDepartment == updateEmployeeInfoForm.idDepartment}"
|
||||||
|
th:text="${department.nmDepartment}"
|
||||||
|
th:value="${department.idDepartment}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="更新"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<a href="javascript:selectSubmit()">一覧に戻る</a>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function selectSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'selectAll');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "selectAll");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
<!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="updatePersonalEmployeeResult"
|
||||||
|
method="post"
|
||||||
|
th:object="${updatePersonalEmployeeUserForm}">
|
||||||
|
|
||||||
|
<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">社員名</th>
|
||||||
|
<td>
|
||||||
|
<input maxlength="50"
|
||||||
|
placeholder="社員名"
|
||||||
|
required
|
||||||
|
th:name="nmEmployee"
|
||||||
|
th:value="*{nmEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名フリガナ</th>
|
||||||
|
<td>
|
||||||
|
<input maxlength="50"
|
||||||
|
name="knEmployee"
|
||||||
|
oninput="convertToKatakana(this)"
|
||||||
|
placeholder="フリガナ"
|
||||||
|
required
|
||||||
|
th:value="*{knEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td>
|
||||||
|
<input maxlength="100"
|
||||||
|
name="mailAddress"
|
||||||
|
placeholder="メールアドレス"
|
||||||
|
required
|
||||||
|
th:value="*{mailAddress}"
|
||||||
|
type="email"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード</th>
|
||||||
|
<td>
|
||||||
|
<input name="password"
|
||||||
|
pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="※更新する場合は入力"
|
||||||
|
th:field="*{password}"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- *** Chrome等のブラウザの場合自動でセットされる可能性があるので注意書きを外にも *** -->
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td>
|
||||||
|
<span style="font-size:8pt; font-weight:bold; color:red;">更新する場合は入力してください<br>
|
||||||
|
※半角英数字をそれぞれ1種類以上含む3-10文字</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード確認</th>
|
||||||
|
<td>
|
||||||
|
<input name="passwordConfirm"
|
||||||
|
pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="※更新する場合は再入力"
|
||||||
|
th:field="*{passwordConfirm}"
|
||||||
|
type="password"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input name="submit" type="submit" value="更新"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<input name="idEmployee"
|
||||||
|
th:value="*{idEmployee}"
|
||||||
|
type="hidden"/>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<!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>
|
||||||
|
<h2>更新が完了しました</h2>
|
||||||
|
<br/>
|
||||||
|
<a href="javascript:backSubmit()">戻る</a>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function backSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'updatePersonalEmployeeResult');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "updatePersonalEmployeeResult");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<scope>test</scope>
|
<!-- <scope>test</scope>-->
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AllDepartmentInfo {
|
||||||
|
/**
|
||||||
|
* 課情報
|
||||||
|
*/
|
||||||
|
private final Division division;
|
||||||
|
/**
|
||||||
|
* 部情報
|
||||||
|
*/
|
||||||
|
private final Department department;
|
||||||
|
/**
|
||||||
|
* 本部情報
|
||||||
|
*/
|
||||||
|
private final Headquarters headquarters;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員情報と全ての部署情報を表すモデルクラスです。
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AllEmployeeInfo {
|
||||||
|
/**
|
||||||
|
* 社員情報
|
||||||
|
*/
|
||||||
|
private final Employee employee;
|
||||||
|
/**
|
||||||
|
* 課情報
|
||||||
|
*/
|
||||||
|
private final Division division;
|
||||||
|
/**
|
||||||
|
* 部情報
|
||||||
|
*/
|
||||||
|
private final Department department;
|
||||||
|
/**
|
||||||
|
* 本部情報
|
||||||
|
*/
|
||||||
|
private final Headquarters headquarters;
|
||||||
|
}
|
||||||
@@ -4,18 +4,26 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署情報の概念を表現するモデルクラスです。
|
* 部情報を表すモデルクラスです。
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class Department {
|
public class Department {
|
||||||
/**
|
/**
|
||||||
* 部署ID
|
* 部ID
|
||||||
*/
|
*/
|
||||||
private final Integer idDepartment;
|
private final Integer idDepartment;
|
||||||
/**
|
/**
|
||||||
* 部署名
|
* 部名
|
||||||
*/
|
*/
|
||||||
private final String nmDepartment;
|
private final String nmDepartment;
|
||||||
|
/**
|
||||||
|
* 表示・非表示フラグ
|
||||||
|
*/
|
||||||
|
private final Integer isDisplay;
|
||||||
|
/**
|
||||||
|
* 部ID
|
||||||
|
*/
|
||||||
|
private final Integer idHeadquarters;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署情報の概念を表現するモデルクラスです。※部情報ではない
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DepartmentInfo {
|
||||||
|
/**
|
||||||
|
* 本部ID
|
||||||
|
*/
|
||||||
|
private final Integer idHeadquarters;
|
||||||
|
/**
|
||||||
|
* 本部名
|
||||||
|
*/
|
||||||
|
private final String nmHeadquarters;
|
||||||
|
/**
|
||||||
|
* 部ID
|
||||||
|
*/
|
||||||
|
private final Integer idDepartment;
|
||||||
|
/**
|
||||||
|
* 部名
|
||||||
|
*/
|
||||||
|
private final String nmDepartment;
|
||||||
|
/**
|
||||||
|
* 課ID
|
||||||
|
*/
|
||||||
|
private final Integer idDivision;
|
||||||
|
/**
|
||||||
|
* 課名
|
||||||
|
*/
|
||||||
|
private final String nmDivision;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 課を表現するモデルクラスです
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Division {
|
||||||
|
/**
|
||||||
|
* 課ID
|
||||||
|
*/
|
||||||
|
private final Integer idDivision;
|
||||||
|
/**
|
||||||
|
* 課名
|
||||||
|
*/
|
||||||
|
private final String nmDivision;
|
||||||
|
/**
|
||||||
|
* 表示・非表示フラグ
|
||||||
|
*/
|
||||||
|
private final Integer isDisplay;
|
||||||
|
/**
|
||||||
|
* 部ID
|
||||||
|
*/
|
||||||
|
private final Integer idDepartment;
|
||||||
|
}
|
||||||
@@ -29,6 +29,10 @@ public class Employee {
|
|||||||
* パスワード
|
* パスワード
|
||||||
*/
|
*/
|
||||||
private final String password;
|
private final String password;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private final String hireDate;
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
@@ -36,6 +40,6 @@ public class Employee {
|
|||||||
/**
|
/**
|
||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private final Integer idDepartment;
|
private final Integer idDivision;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public class EmployeeInfo {
|
|||||||
*/
|
*/
|
||||||
private final Employee employee;
|
private final Employee employee;
|
||||||
/**
|
/**
|
||||||
* 部署名
|
* 課情報
|
||||||
*/
|
*/
|
||||||
private final Department department;
|
private final Division division;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本部を表現するモデルクラスです
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Headquarters {
|
||||||
|
/**
|
||||||
|
* 本部ID
|
||||||
|
*/
|
||||||
|
private final Integer idHeadquarters;
|
||||||
|
/**
|
||||||
|
* 本部名
|
||||||
|
*/
|
||||||
|
private final String nmHeadquarters;
|
||||||
|
/**
|
||||||
|
* 表示・非表示フラグ
|
||||||
|
*/
|
||||||
|
private final Integer isDisplay;
|
||||||
|
}
|
||||||
@@ -38,7 +38,7 @@ public class LoginUser {
|
|||||||
/**
|
/**
|
||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private final Integer idDepartment;
|
private final Integer idDivision;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ログインユーザが管理者か
|
* ログインユーザが管理者か
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class SearchConditionDepartment {
|
public class SearchConditionDepartment {
|
||||||
/**
|
/**
|
||||||
* 部署ID
|
* ID
|
||||||
*/
|
*/
|
||||||
private final Integer idDepartment;
|
private final Integer idDivision;
|
||||||
/**
|
/**
|
||||||
* 部署名
|
* 名前
|
||||||
*/
|
*/
|
||||||
private final String nmDepartment;
|
private final String nmDivision;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,6 @@ public class SearchConditionEmployee {
|
|||||||
/**
|
/**
|
||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private final Integer idDepartment;
|
private final Integer idDivision;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.example.rhizome.app.domain.service;
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
public interface DeleteDepartment {
|
public interface DeleteDepartment {
|
||||||
void deleteDepartment(Integer idDepartment);
|
void deleteDepartment(Integer idDivision);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.example.rhizome.app.domain.service;
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import com.example.rhizome.app.infra.entity.DivisionEntity;
|
||||||
|
|
||||||
public interface RegisterDepartment {
|
public interface RegisterDepartment {
|
||||||
void registerDepartment(Department department);
|
void registerDepartment(DivisionEntity divisionEntity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,43 @@
|
|||||||
package com.example.rhizome.app.domain.service;
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.AllDepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import com.example.rhizome.app.domain.model.Division;
|
||||||
|
import com.example.rhizome.app.domain.model.Headquarters;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
|
|
||||||
public interface SearchDepartment {
|
public interface SearchDepartment {
|
||||||
List<Department> selectAll();
|
|
||||||
|
|
||||||
List<Department> searchBy(SearchConditionDepartment searchConditionDepartment);
|
List<AllDepartmentInfo> searchAllDepartmentTable();
|
||||||
|
|
||||||
|
List<AllDepartmentInfo> searchAllDepartmentTable(SearchConditionDepartment searchConditionDepartment);
|
||||||
|
|
||||||
|
boolean searchAllDepartmentTable(
|
||||||
|
SearchConditionDepartment searchHeadquartersTable,
|
||||||
|
SearchConditionDepartment searchDepartmentTable,
|
||||||
|
SearchConditionDepartment searchDivisionTable);
|
||||||
|
|
||||||
|
boolean searchAllDepartmentTable(
|
||||||
|
Integer idHeadquarters,
|
||||||
|
Integer idDepartment,
|
||||||
|
Integer idDivision);
|
||||||
|
|
||||||
|
List<Headquarters> searchByHeadquarters(SearchConditionDepartment searchConditionDepartment);
|
||||||
|
|
||||||
|
List<Department> searchByDepartment(SearchConditionDepartment searchConditionDepartment);
|
||||||
|
|
||||||
|
List<Division> searchByDivision(SearchConditionDepartment searchConditionDepartment);
|
||||||
|
|
||||||
|
List<Department> searchByIdHeadquarters(Integer idHeadquarters);
|
||||||
|
|
||||||
|
List<Division> searchByIdDepartment(Integer idDepartment);
|
||||||
|
|
||||||
|
List<Headquarters> searchHeadquartersByIdHeadquarters(Integer idHeadquarters);
|
||||||
|
|
||||||
|
List<Department> searchDepartmentByIdDepartment(Integer idDepartment);
|
||||||
|
|
||||||
|
List<Division> searchDivisionByIdDivision(Integer idDivision);
|
||||||
|
|
||||||
List<Department> searchByWithLike(SearchConditionDepartment searchConditionDepartment);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package com.example.rhizome.app.domain.service;
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
import com.example.rhizome.app.domain.model.LoginUser;
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface SearchEmployee {
|
public interface SearchEmployee {
|
||||||
List<Employee> searchEmployee(String mailAddress);
|
List<Employee> searchEmployee(String mailAddress);
|
||||||
|
|
||||||
List<Employee> searchEmployeeByIdDepartment(Integer idDepartment);
|
List<Employee> searchEmployeeByIdDepartment(Integer idDivision);
|
||||||
|
|
||||||
LoginUser searchLoginUser(String mailAddress);
|
LoginUser searchLoginUser(String mailAddress);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.example.rhizome.app.domain.service;
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface SearchEmployeeInfo {
|
import com.example.rhizome.app.domain.model.AllEmployeeInfo;
|
||||||
List<EmployeeInfo> selectAll();
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
|
||||||
List<EmployeeInfo> searchBy(SearchConditionEmployee searchConditionEmployee);
|
public interface SearchEmployeeInfo {
|
||||||
|
List<AllEmployeeInfo> selectAll();
|
||||||
|
|
||||||
|
List<AllEmployeeInfo> searchBy(SearchConditionEmployee searchConditionEmployee);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public interface TenureCalc {
|
||||||
|
String tenureCalc(String hireDate);
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.example.rhizome.app.domain.service;
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import com.example.rhizome.app.domain.model.DepartmentInfo;
|
||||||
|
|
||||||
public interface UpdateDepartment {
|
public interface UpdateDepartment {
|
||||||
void updateDepartment(Department department);
|
void updateDepartment(DepartmentInfo departmentInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.service.DeleteDepartment;
|
|
||||||
import com.example.rhizome.app.infra.repository.DepartmentRepository;
|
|
||||||
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.rhizome.app.domain.service.DeleteDepartment;
|
||||||
|
import com.example.rhizome.app.infra.repository.DivisionRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Department レコード削除関連の機能を持つサービス
|
* Department レコード削除関連の機能を持つサービス
|
||||||
*/
|
*/
|
||||||
@@ -13,26 +14,26 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Transactional
|
@Transactional
|
||||||
public class DeleteDepartmentImpl implements DeleteDepartment {
|
public class DeleteDepartmentImpl implements DeleteDepartment {
|
||||||
|
|
||||||
DepartmentRepository departmentRepository;
|
DivisionRepository divisionRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* コンストラクタ
|
* コンストラクタ
|
||||||
*
|
*
|
||||||
* @param departmentRepository DI対象
|
* @param divisionRepository DI対象
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
public DeleteDepartmentImpl(DepartmentRepository departmentRepository) {
|
public DeleteDepartmentImpl(DivisionRepository divisionRepository) {
|
||||||
this.departmentRepository = departmentRepository;
|
this.divisionRepository = divisionRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* idDepartment を元に department データを削除
|
* idDivision を元に division データを削除するメソッド
|
||||||
*
|
*
|
||||||
* @param idDepartment 削除対象のidDepartment
|
* @param idDivision 削除対象のidDivision
|
||||||
*/
|
*/
|
||||||
public void deleteDepartment(Integer idDepartment) {
|
public void deleteDepartment(Integer idDivision) {
|
||||||
departmentRepository.deleteById(idDepartment);
|
divisionRepository.deleteByIdDivision(idDivision);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.service.DeleteEmployee;
|
|
||||||
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
|
||||||
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.rhizome.app.domain.service.DeleteEmployee;
|
||||||
|
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Employee レコード削除関連の機能を持つサービス
|
* Employee レコード削除関連の機能を持つサービス
|
||||||
*/
|
*/
|
||||||
@@ -20,9 +21,8 @@ public class DeleteEmployeeImpl implements DeleteEmployee {
|
|||||||
this.employeeRepository = employeeRepository;
|
this.employeeRepository = employeeRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* idEmployee を元に employee データを削除
|
* idEmployee を元に employee データを削除するメソッド
|
||||||
*
|
*
|
||||||
* @param idEmployee 削除対象のidEmployee
|
* @param idEmployee 削除対象のidEmployee
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
|
||||||
import com.example.rhizome.app.domain.service.RegisterDepartment;
|
|
||||||
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
|
||||||
import com.example.rhizome.app.infra.repository.DepartmentRepository;
|
|
||||||
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.rhizome.app.domain.service.RegisterDepartment;
|
||||||
|
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.DivisionEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.HeadquartersEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.DepartmentRepository;
|
||||||
|
import com.example.rhizome.app.infra.repository.DivisionRepository;
|
||||||
|
import com.example.rhizome.app.infra.repository.HeadquartersRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Department テーブルの登録系の機能を集約させるサービスクラスです。
|
* Department テーブルの登録系の機能を集約させるサービスクラスです。
|
||||||
*/
|
*/
|
||||||
@@ -17,23 +20,65 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
public class RegisterDepartmentImpl implements RegisterDepartment {
|
public class RegisterDepartmentImpl implements RegisterDepartment {
|
||||||
|
|
||||||
DepartmentRepository departmentRepository;
|
DepartmentRepository departmentRepository;
|
||||||
|
DivisionRepository divisionRepository;
|
||||||
|
HeadquartersRepository headquartersRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* コンストラクタ
|
* コンストラクタ
|
||||||
*
|
*
|
||||||
* @param departmentRepository DI対象
|
* @param departmentRepository DI対象
|
||||||
|
* @param divisionRepository DI対象
|
||||||
|
* @param headquartersRepository DI対象
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
public RegisterDepartmentImpl(DepartmentRepository departmentRepository) {
|
public RegisterDepartmentImpl(DepartmentRepository departmentRepository,
|
||||||
|
DivisionRepository divisionRepository,
|
||||||
|
HeadquartersRepository headquartersRepository) {
|
||||||
this.departmentRepository = departmentRepository;
|
this.departmentRepository = departmentRepository;
|
||||||
|
this.divisionRepository = divisionRepository;
|
||||||
|
this.headquartersRepository = headquartersRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* department インスタンスの内容を登録する
|
* division,department,headquartersインスタンスの内容を登録する
|
||||||
*
|
*
|
||||||
* @param department 登録対象のデータ
|
* @param divisionEntity 登録対象のデータ
|
||||||
|
* @param departmentEntity 登録対象のデータ
|
||||||
|
* @param headquartersEntity 登録対象のデータ
|
||||||
*/
|
*/
|
||||||
public void registerDepartment(Department department) {
|
public void registerDepartment(DivisionEntity divisionEntity) {
|
||||||
departmentRepository.save(DepartmentEntity.convertFrom(department));
|
DepartmentEntity departmentEntity = divisionEntity.getDepartment();
|
||||||
|
HeadquartersEntity headquartersEntity = divisionEntity.getDepartment().getHeadquarters();
|
||||||
|
HeadquartersEntity originHeadquartersEntity = headquartersRepository.findByNmHeadquarters(
|
||||||
|
divisionEntity.getDepartment().getHeadquarters().getNmHeadquarters());
|
||||||
|
if (originHeadquartersEntity != null) {
|
||||||
|
headquartersEntity = originHeadquartersEntity;
|
||||||
|
} else {
|
||||||
|
headquartersEntity = new HeadquartersEntity();
|
||||||
|
headquartersEntity.setNmHeadquarters(
|
||||||
|
divisionEntity.getDepartment()
|
||||||
|
.getHeadquarters()
|
||||||
|
.getNmHeadquarters());
|
||||||
|
}
|
||||||
|
|
||||||
|
DepartmentEntity originDepartmentEntity = departmentRepository.findByHeadquartersAndNmDepartment(
|
||||||
|
originHeadquartersEntity,
|
||||||
|
divisionEntity.getDepartment().getNmDepartment());
|
||||||
|
if (originDepartmentEntity != null) {
|
||||||
|
departmentEntity = originDepartmentEntity;
|
||||||
|
} else {
|
||||||
|
departmentEntity = new DepartmentEntity();
|
||||||
|
departmentEntity.setNmDepartment(
|
||||||
|
divisionEntity.getDepartment()
|
||||||
|
.getNmDepartment());
|
||||||
|
}
|
||||||
|
|
||||||
|
divisionEntity.setIsDisplay(0);
|
||||||
|
departmentEntity.setIsDisplay(0);
|
||||||
|
headquartersEntity.setIsDisplay(0);
|
||||||
|
|
||||||
|
departmentEntity.setHeadquarters(headquartersEntity);
|
||||||
|
divisionEntity.setDepartment(departmentEntity);
|
||||||
|
divisionRepository.save(divisionEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
|
||||||
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
|
||||||
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
|
||||||
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
|
||||||
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.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
||||||
|
import com.example.rhizome.app.infra.entity.InsertEmployeeEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Employee テーブルの登録系の機能を集約させるサービスクラスです。
|
* Employee テーブルの登録系の機能を集約させるサービスクラスです。
|
||||||
*/
|
*/
|
||||||
@@ -29,6 +30,6 @@ public class RegisterEmployeeImpl implements RegisterEmployee {
|
|||||||
* @param employee 登録対象のデータ
|
* @param employee 登録対象のデータ
|
||||||
*/
|
*/
|
||||||
public void registerEmployee(Employee employee) {
|
public void registerEmployee(Employee employee) {
|
||||||
employeeRepository.save(EmployeeEntity.convertFrom(employee));
|
employeeRepository.save(InsertEmployeeEntity.convertFrom(employee));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,28 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
|
||||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
|
||||||
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
|
||||||
import com.example.rhizome.app.infra.repository.DepartmentRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import com.example.rhizome.app.domain.model.AllDepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import com.example.rhizome.app.domain.model.Division;
|
||||||
|
import com.example.rhizome.app.domain.model.Headquarters;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.DepartmentInfoEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.DivisionEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.HeadquartersEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.DepartmentInfoRepository;
|
||||||
|
import com.example.rhizome.app.infra.repository.DepartmentRepository;
|
||||||
|
import com.example.rhizome.app.infra.repository.DivisionRepository;
|
||||||
|
import com.example.rhizome.app.infra.repository.HeadquartersRepository;
|
||||||
|
import com.example.rhizome.app.infra.repository.RegisterDepartmentRepository;
|
||||||
|
import com.example.rhizome.app.infra.repository.RegisterDivisionRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署情報検索系の機能を集約させるサービスクラスです。
|
* 部署情報検索系の機能を集約させるサービスクラスです。
|
||||||
@@ -19,17 +30,35 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
@Transactional
|
@Transactional
|
||||||
public class SearchDepartmentImpl implements SearchDepartment {
|
public class SearchDepartmentImpl implements SearchDepartment {
|
||||||
|
DivisionRepository divisionRepository;
|
||||||
DepartmentRepository departmentRepository;
|
DepartmentRepository departmentRepository;
|
||||||
|
HeadquartersRepository headquartersRepository;
|
||||||
|
DepartmentInfoRepository departmentInfoRepository;
|
||||||
|
RegisterDepartmentRepository registerDepartmentRepository;
|
||||||
|
RegisterDivisionRepository registerDivisionRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* コンストラクタ
|
* コンストラクタ
|
||||||
*
|
*
|
||||||
|
* @param divisionRepository DI対象
|
||||||
* @param departmentRepository DI対象
|
* @param departmentRepository DI対象
|
||||||
|
* @param headquartersRepository DI対象
|
||||||
|
* @param departmentInfoRepository DI対象
|
||||||
|
* @param RegisterDepartmentRepository DI対象
|
||||||
|
* @param RegisterDivisionRepository DI対象
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
public SearchDepartmentImpl(DepartmentRepository departmentRepository) {
|
public SearchDepartmentImpl(
|
||||||
|
DepartmentRepository departmentRepository, DivisionRepository divisionRepository,
|
||||||
|
HeadquartersRepository headquartersRepository, DepartmentInfoRepository departmentInfoRepository,
|
||||||
|
RegisterDepartmentRepository registerDepartmentRepository,
|
||||||
|
RegisterDivisionRepository registerDivisionRepository) {
|
||||||
this.departmentRepository = departmentRepository;
|
this.departmentRepository = departmentRepository;
|
||||||
|
this.divisionRepository = divisionRepository;
|
||||||
|
this.headquartersRepository = headquartersRepository;
|
||||||
|
this.departmentInfoRepository = departmentInfoRepository;
|
||||||
|
this.registerDepartmentRepository = registerDepartmentRepository;
|
||||||
|
this.registerDivisionRepository = registerDivisionRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,8 +66,84 @@ public class SearchDepartmentImpl implements SearchDepartment {
|
|||||||
*
|
*
|
||||||
* @return 取得した部署情報レコード全件
|
* @return 取得した部署情報レコード全件
|
||||||
*/
|
*/
|
||||||
public List<Department> selectAll() {
|
public List<AllDepartmentInfo> searchAllDepartmentTable() {
|
||||||
return DepartmentEntity.createDepartmentList(departmentRepository.findAll());
|
return DepartmentInfoEntity.createDepartmentInfoList(departmentInfoRepository.searchAllDepartmentTable());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 課の条件を基に部署情報を全件取得する
|
||||||
|
* @param SearchConditionDepartment 検索条件
|
||||||
|
* @return 検索結果のレコード
|
||||||
|
*/
|
||||||
|
public List<AllDepartmentInfo> searchAllDepartmentTable(SearchConditionDepartment searchConditionDepartment) {
|
||||||
|
return DepartmentInfoEntity.AfterSearchCreateDepartmentInfoList(
|
||||||
|
departmentInfoRepository.findAll(Specification
|
||||||
|
.where(DepartmentInfoRepository.idDivisionEqual(searchConditionDepartment.getIdDivision()))
|
||||||
|
.and(DepartmentInfoRepository.nmDivisionEqual(searchConditionDepartment.getNmDivision()))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 三つの部署の名前を基に部署情報を取得する→重複チェック
|
||||||
|
* @param SearchConditionDepartment searchHeadquartersTable 検索条件
|
||||||
|
* @param SearchConditionDepartment searchDepartmentTable 検索条件
|
||||||
|
* @param SearchConditionDepartment searchDivisionTable 検索条件
|
||||||
|
* @return 重複があればtrue
|
||||||
|
* @return 重複が無ければfalse
|
||||||
|
*/
|
||||||
|
public boolean searchAllDepartmentTable(
|
||||||
|
SearchConditionDepartment searchHeadquartersTable,
|
||||||
|
SearchConditionDepartment searchDepartmentTable,
|
||||||
|
SearchConditionDepartment searchDivisionTable) {
|
||||||
|
|
||||||
|
if (departmentInfoRepository.searchAllDepartmentTable(
|
||||||
|
searchHeadquartersTable.getNmDivision(),
|
||||||
|
searchDepartmentTable.getNmDivision(),
|
||||||
|
searchDivisionTable.getNmDivision()).isEmpty()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 三つの部署のIDを基に部署情報を取得する→重複チェック
|
||||||
|
* @param Integer idHeadquarters 検索条件
|
||||||
|
* @param Integer idDepartment 検索条件
|
||||||
|
* @param Integer idDivision 検索条件
|
||||||
|
* @return 重複があればtrue
|
||||||
|
* @return 重複が無ければfalse
|
||||||
|
*/
|
||||||
|
public boolean searchAllDepartmentTable(
|
||||||
|
Integer idHeadquarters,
|
||||||
|
Integer idDepartment,
|
||||||
|
Integer idDivision) {
|
||||||
|
|
||||||
|
if (departmentInfoRepository.searchAllDepartmentTable(
|
||||||
|
idHeadquarters,
|
||||||
|
idDepartment,
|
||||||
|
idDivision).isEmpty()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* searchConditionDepartment の情報を元に Headquarters のレコードを取得
|
||||||
|
*
|
||||||
|
* @param searchConditionDepartment 検索条件
|
||||||
|
* @return 検索結果のレコード
|
||||||
|
*/
|
||||||
|
public List<Headquarters> searchByHeadquarters(SearchConditionDepartment searchConditionDepartment) {
|
||||||
|
|
||||||
|
return HeadquartersEntity
|
||||||
|
.createHeadquartersList(
|
||||||
|
headquartersRepository.findAll(Specification
|
||||||
|
.where(HeadquartersRepository
|
||||||
|
.idHeadquartersEqual(searchConditionDepartment.getIdDivision()))
|
||||||
|
.and(HeadquartersRepository
|
||||||
|
.nmHeadquartersEqual(searchConditionDepartment.getNmDivision()))));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,36 +152,96 @@ public class SearchDepartmentImpl implements SearchDepartment {
|
|||||||
* @param searchConditionDepartment 検索条件
|
* @param searchConditionDepartment 検索条件
|
||||||
* @return 検索結果のレコード
|
* @return 検索結果のレコード
|
||||||
*/
|
*/
|
||||||
public List<Department> searchBy(SearchConditionDepartment searchConditionDepartment) {
|
public List<Department> searchByDepartment(SearchConditionDepartment searchConditionDepartment) {
|
||||||
// 動的に検索条件を絞り込む
|
// 動的に検索条件を絞り込む
|
||||||
// Specification は Criteria API の Predicate をラップしたもの
|
// // Specification は Criteria API //の Predicate をラップしたもの
|
||||||
return DepartmentEntity
|
return DepartmentEntity
|
||||||
.createDepartmentList(
|
.createDepartmentList(
|
||||||
departmentRepository.findAll(Specification
|
departmentRepository.findAll(Specification
|
||||||
.where(DepartmentRepository.idDepartmentEqual(searchConditionDepartment.getIdDepartment()))
|
.where(DepartmentRepository
|
||||||
.and(DepartmentRepository.nmDepartmentEqual(searchConditionDepartment.getNmDepartment()))
|
.idDepartmentEqual(searchConditionDepartment.getIdDivision()))
|
||||||
)
|
.and(DepartmentRepository
|
||||||
);
|
.nmDepartmentEqual(searchConditionDepartment.getNmDivision()))));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* searchConditionDepartment の情報を元に Department のレコードを取得
|
* searchConditionDepartment の情報を元に Division のレコードを取得
|
||||||
* 部分一致検索
|
|
||||||
*
|
*
|
||||||
* @param searchConditionDepartment 検索条件
|
* @param searchConditionDepartment 検索条件
|
||||||
* @return 検索結果のレコード
|
* @return 検索結果のレコード
|
||||||
*/
|
*/
|
||||||
public List<Department> searchByWithLike(SearchConditionDepartment searchConditionDepartment) {
|
public List<Division> searchByDivision(SearchConditionDepartment searchConditionDepartment) {
|
||||||
// 動的に検索条件を絞り込む
|
// 動的に検索条件を絞り込む
|
||||||
// Specification は Criteria API の Predicate をラップしたもの
|
// // Specification は Criteria AP//I の Predicate をラップしたもの
|
||||||
return DepartmentEntity
|
return DivisionEntity
|
||||||
.createDepartmentList(
|
.createDivisionList(
|
||||||
departmentRepository.findAll(Specification
|
divisionRepository.findAll(Specification
|
||||||
.where(DepartmentRepository.idDepartmentEqual(searchConditionDepartment.getIdDepartment()))
|
.where(DivisionRepository.idDivisionEqual(searchConditionDepartment.getIdDivision()))
|
||||||
.and(DepartmentRepository.nmDepartmentLike(searchConditionDepartment.getNmDepartment()))
|
.and(DivisionRepository.nmDivisionEqual(searchConditionDepartment.getNmDivision()))));
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* idHeadquarters の情報を元に Department のレコードを取得
|
||||||
|
*
|
||||||
|
* @param Integer idHeadquarters 検索条件
|
||||||
|
* @return 検索結果のレコード
|
||||||
|
*/
|
||||||
|
public List<Department> searchByIdHeadquarters(Integer idHeadquarters) {
|
||||||
|
registerDepartmentRepository.findAll(Specification
|
||||||
|
.where(RegisterDepartmentRepository.idHeadquartersEqual(idHeadquarters)));
|
||||||
|
|
||||||
|
return DepartmentEntity
|
||||||
|
.createDepartmentListBy(registerDepartmentRepository.findAll(Specification
|
||||||
|
.where(RegisterDepartmentRepository.idHeadquartersEqual(idHeadquarters))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* idDepartment の情報を元に Division のレコードを取得
|
||||||
|
*
|
||||||
|
* @param Integer idDepartment 検索条件
|
||||||
|
* @return 検索結果のレコード
|
||||||
|
*/
|
||||||
|
public List<Division> searchByIdDepartment(Integer idDepartment) {
|
||||||
|
return DivisionEntity
|
||||||
|
.createRegisterDivisionList(registerDivisionRepository.findAll(Specification
|
||||||
|
.where(RegisterDivisionRepository.idDepartmentEqual(idDepartment))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* idHeadquarters の情報を元に Headquarters のレコードを取得
|
||||||
|
*
|
||||||
|
* @param Integer idHeadquarters 検索条件
|
||||||
|
* @return 検索結果のレコード
|
||||||
|
*/
|
||||||
|
public List<Headquarters> searchHeadquartersByIdHeadquarters(Integer idHeadquarters) {
|
||||||
|
return HeadquartersEntity
|
||||||
|
.createHeadquartersList(headquartersRepository.findAll(Specification
|
||||||
|
.where(HeadquartersRepository.idHeadquartersEqual(idHeadquarters))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* idDepartment の情報を元に Department のレコードを取得
|
||||||
|
*
|
||||||
|
* @param Integer idDepartment 検索条件
|
||||||
|
* @return 検索結果のレコード
|
||||||
|
*/
|
||||||
|
public List<Department> searchDepartmentByIdDepartment(Integer idDepartment) {
|
||||||
|
return DepartmentEntity
|
||||||
|
.createDepartmentList(departmentRepository.findAll(Specification
|
||||||
|
.where(DepartmentRepository.idDepartmentEqual(idDepartment))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* idDivision の情報を元に Division のレコードを取得
|
||||||
|
*
|
||||||
|
* @param Integer idDivision 検索条件
|
||||||
|
* @return 検索結果のレコード
|
||||||
|
*/
|
||||||
|
public List<Division> searchDivisionByIdDivision(Integer idDivision) {
|
||||||
|
return DivisionEntity
|
||||||
|
.createDivisionList(divisionRepository.findAll(Specification
|
||||||
|
.where(DivisionRepository.idDivisionEqual(idDivision))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.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.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
import com.example.rhizome.app.domain.model.LoginUser;
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
import com.example.rhizome.app.domain.service.SearchEmployee;
|
import com.example.rhizome.app.domain.service.SearchEmployee;
|
||||||
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
||||||
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Employee テーブル検索系の機能を集約させるサービスクラスです。
|
* Employee テーブル検索系の機能を集約させるサービスクラスです。
|
||||||
@@ -25,7 +26,6 @@ public class SearchEmployeeImpl implements SearchEmployee {
|
|||||||
this.employeeRepository = employeeRepository;
|
this.employeeRepository = employeeRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mailAddress を元に Employee Table を検索します。
|
* mailAddress を元に Employee Table を検索します。
|
||||||
*
|
*
|
||||||
@@ -53,18 +53,18 @@ public class SearchEmployeeImpl implements SearchEmployee {
|
|||||||
* @return Table から取得したレコードの情報
|
* @return Table から取得したレコードの情報
|
||||||
*/
|
*/
|
||||||
public Employee searchEmployeeByIdEmployee(Integer idEmployee) {
|
public Employee searchEmployeeByIdEmployee(Integer idEmployee) {
|
||||||
return EmployeeEntity.createEmployee(employeeRepository.findByIdEmployee(idEmployee).orElse(new EmployeeEntity()));
|
return EmployeeEntity
|
||||||
|
.createEmployee(employeeRepository.findByIdEmployee(idEmployee).orElse(new EmployeeEntity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* idDepartment を元に Employee Table を検索します。
|
* idDivision を元に Employee Table を検索します。
|
||||||
*
|
*
|
||||||
* @param idDepartment 部署ID
|
* @param idDivision 本部ID
|
||||||
* @return Table から取得したレコードの情報
|
* @return Table から取得したレコードの情報
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Employee> searchEmployeeByIdDepartment(Integer idDepartment) {
|
public List<Employee> searchEmployeeByIdDepartment(Integer idDivision) {
|
||||||
return EmployeeEntity.createEmployeeList(employeeRepository.findByIdDepartment(idDepartment));
|
return EmployeeEntity.createEmployeeList(employeeRepository.findByDivision_idDivision(idDivision));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
import java.util.List;
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
|
||||||
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
|
||||||
import com.example.rhizome.app.infra.entity.EmployeeDepartmentEntity;
|
|
||||||
import com.example.rhizome.app.infra.repository.EmployeeInfoRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import com.example.rhizome.app.domain.model.AllEmployeeInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeDepartmentEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.EmployeeInfoRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SearchEmployeeInfoImpl (employee join department) 検索系の機能を集約させるサービスクラスです
|
* SearchEmployeeInfoImpl (employee join department) 検索系の機能を集約させるサービスクラスです
|
||||||
@@ -26,37 +27,37 @@ public class SearchEmployeeInfoImpl implements SearchEmployeeInfo {
|
|||||||
this.employeeInfoRepository = employeeInfoRepository;
|
this.employeeInfoRepository = employeeInfoRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EmployeeInfo (employee join department) のレコードを全件取得
|
* EmployeeInfo (employee join division join department join headquarters) のレコードを全件取得
|
||||||
*
|
*
|
||||||
* @return 取得したレコード全件
|
* @return 取得したレコード全件
|
||||||
*/
|
*/
|
||||||
public List<EmployeeInfo> selectAll() {
|
public List<AllEmployeeInfo> selectAll() {
|
||||||
|
|
||||||
return EmployeeDepartmentEntity.createEmployeeInfoList(employeeInfoRepository.findAll());
|
return EmployeeDepartmentEntity.createEmployeeInfoList(employeeInfoRepository.findAlltable());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SearchConditionEmployee の情報を元に EmployeeInfo (employee join department) のレコードを取得
|
* SearchConditionEmployee の情報を元に
|
||||||
|
* EmployeeInfo (employee join division join department join headquarters)
|
||||||
|
* のレコードを取得
|
||||||
*
|
*
|
||||||
* @param searchConditionEmployee 検索条件
|
* @param searchConditionEmployee 検索条件
|
||||||
* @return 検索結果のレコードリスト
|
* @return 検索結果のレコードリスト
|
||||||
*/
|
*/
|
||||||
public List<EmployeeInfo> searchBy(SearchConditionEmployee searchConditionEmployee) {
|
public List<AllEmployeeInfo> searchBy(SearchConditionEmployee searchConditionEmployee) {
|
||||||
// 動的に検索条件を絞り込む
|
// 動的に検索条件を絞り込む
|
||||||
// Specification は Criteria API の Predicate をラップしたもの
|
// Specification は Criteria API の Predicate をラップしたもの
|
||||||
|
|
||||||
return EmployeeDepartmentEntity
|
return EmployeeDepartmentEntity
|
||||||
.createEmployeeInfoList(
|
.AfterSearchCreateEmployeeInfoList(
|
||||||
employeeInfoRepository.findAll(Specification
|
employeeInfoRepository.findAll(Specification
|
||||||
.where(EmployeeInfoRepository.idEmployeeEqual(searchConditionEmployee.getIdEmployee()))
|
.where(EmployeeInfoRepository.idEmployeeEqual(searchConditionEmployee.getIdEmployee()))
|
||||||
.and(EmployeeInfoRepository.nmEmployeeEqual(searchConditionEmployee.getNmEmployee()))
|
.and(EmployeeInfoRepository.nmEmployeeEqual(searchConditionEmployee.getNmEmployee()))
|
||||||
.and(EmployeeInfoRepository.knEmployeeEqual(searchConditionEmployee.getKnEmployee()))
|
.and(EmployeeInfoRepository.knEmployeeEqual(searchConditionEmployee.getKnEmployee()))
|
||||||
.and(EmployeeInfoRepository.mailAddressEqual(searchConditionEmployee.getMailAddress()))
|
.and(EmployeeInfoRepository.mailAddressEqual(searchConditionEmployee.getMailAddress()))
|
||||||
.and(EmployeeInfoRepository.idDepartmentEqual(searchConditionEmployee.getIdDepartment()))
|
.and(EmployeeInfoRepository.idDivisionEqual(searchConditionEmployee.getIdDivision()))));
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.Period;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.service.TenureCalc;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TenureCalucImpl implements TenureCalc {
|
||||||
|
/**
|
||||||
|
* hireDate をもとに勤続年数を計算
|
||||||
|
*
|
||||||
|
* @param String hireDate
|
||||||
|
* @return 計算結果の勤続年数
|
||||||
|
*/
|
||||||
|
public String tenureCalc(String hireDate) {
|
||||||
|
String tenure;
|
||||||
|
LocalDate hiredate = LocalDate.parse(hireDate);
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
Period period = Period.between(hiredate, today);
|
||||||
|
|
||||||
|
if (period.getYears() <= 0 && period.getMonths() <= 0) {
|
||||||
|
tenure = "0年0ヶ月";
|
||||||
|
return tenure;
|
||||||
|
} else {
|
||||||
|
tenure = period.getYears() + "年" + period.getMonths() + "ヶ月";
|
||||||
|
return tenure;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,16 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
|
||||||
import com.example.rhizome.app.domain.service.UpdateDepartment;
|
|
||||||
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
|
||||||
import com.example.rhizome.app.infra.repository.DepartmentRepository;
|
|
||||||
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.rhizome.app.domain.model.DepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.service.UpdateDepartment;
|
||||||
|
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.DivisionEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.HeadquartersEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.DivisionRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* department の更新系の機能を集約させるサービスクラスです。
|
* department の更新系の機能を集約させるサービスクラスです。
|
||||||
*/
|
*/
|
||||||
@@ -15,21 +18,33 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Transactional
|
@Transactional
|
||||||
public class UpdateDepartmentImpl implements UpdateDepartment {
|
public class UpdateDepartmentImpl implements UpdateDepartment {
|
||||||
|
|
||||||
DepartmentRepository departmentRepository;
|
DivisionRepository divisionRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public UpdateDepartmentImpl(DepartmentRepository departmentRepository) {
|
public UpdateDepartmentImpl(DivisionRepository divisionRepository) {
|
||||||
this.departmentRepository = departmentRepository;
|
this.divisionRepository = divisionRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* department の情報を元に department table のレコードを更新する
|
* departmentInfo の情報を元に
|
||||||
|
* division table(division join department join headquarters) のレコードを更新する
|
||||||
*
|
*
|
||||||
* @param department 更新のデータ
|
* @param departmentInfo 更新のデータ
|
||||||
*/
|
*/
|
||||||
public void updateDepartment(Department department) {
|
public void updateDepartment(DepartmentInfo departmentInfo) {
|
||||||
|
DivisionEntity divisionEntity = DivisionEntity.convertFrom(departmentInfo);
|
||||||
departmentRepository.save(DepartmentEntity.convertFrom(department));
|
DepartmentEntity departmentEntity = divisionEntity.getDepartment();
|
||||||
|
HeadquartersEntity headquartersEntity = divisionEntity.getDepartment().getHeadquarters();
|
||||||
|
departmentEntity.setNmDepartment(
|
||||||
|
divisionEntity.getDepartment()
|
||||||
|
.getNmDepartment());
|
||||||
|
headquartersEntity.setNmHeadquarters(
|
||||||
|
divisionEntity.getDepartment()
|
||||||
|
.getHeadquarters()
|
||||||
|
.getNmHeadquarters());
|
||||||
|
departmentEntity.setHeadquarters(headquartersEntity);
|
||||||
|
divisionEntity.setDepartment(departmentEntity);
|
||||||
|
divisionRepository.save(divisionEntity);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
|
||||||
import com.example.rhizome.app.domain.service.UpdateEmployee;
|
|
||||||
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
|
||||||
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
|
||||||
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.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.service.UpdateEmployee;
|
||||||
|
import com.example.rhizome.app.infra.entity.InsertEmployeeEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* employee の更新系の機能を集約させるサービスクラスです。
|
* employee の更新系の機能を集約させるサービスクラスです。
|
||||||
*/
|
*/
|
||||||
@@ -30,7 +31,7 @@ public class UpdateEmployeeImpl implements UpdateEmployee {
|
|||||||
*/
|
*/
|
||||||
public void updateEmployee(Employee beforeEmployee, Employee updateEmployee) {
|
public void updateEmployee(Employee beforeEmployee, Employee updateEmployee) {
|
||||||
|
|
||||||
employeeRepository.save(EmployeeEntity.convertFrom(mergeEmployee(beforeEmployee, updateEmployee)));
|
employeeRepository.save(InsertEmployeeEntity.convertFrom(mergeEmployee(beforeEmployee, updateEmployee)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,9 +52,10 @@ public class UpdateEmployeeImpl implements UpdateEmployee {
|
|||||||
updateEmployee.getKnEmployee(),
|
updateEmployee.getKnEmployee(),
|
||||||
updateEmployee.getMailAddress(),
|
updateEmployee.getMailAddress(),
|
||||||
updateEmployee.getPassword().isBlank() ? beforeEmployee.getPassword() : updateEmployee.getPassword(),
|
updateEmployee.getPassword().isBlank() ? beforeEmployee.getPassword() : updateEmployee.getPassword(),
|
||||||
|
updateEmployee.getHireDate(),
|
||||||
updateEmployee.getAdminAuth() == null ? beforeEmployee.getAdminAuth() : updateEmployee.getAdminAuth(),
|
updateEmployee.getAdminAuth() == null ? beforeEmployee.getAdminAuth() : updateEmployee.getAdminAuth(),
|
||||||
updateEmployee.getIdDepartment() == null ? beforeEmployee.getIdDepartment() : updateEmployee.getIdDepartment()
|
updateEmployee.getIdDivision() == null ? beforeEmployee.getIdDivision()
|
||||||
);
|
: updateEmployee.getIdDivision());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,28 @@
|
|||||||
*/
|
*/
|
||||||
package com.example.rhizome.app.infra.entity;
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Fetch;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import com.example.rhizome.app.domain.model.DepartmentInfo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Department テーブルの Entity
|
* Department テーブルの Entity
|
||||||
*
|
*
|
||||||
@@ -25,23 +38,34 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|
||||||
public class DepartmentEntity {
|
public class DepartmentEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署ID
|
* 部ID
|
||||||
*/
|
*/
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "id_department", nullable = false)
|
@Column(name = "id_department", nullable = false)
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
/**
|
/**
|
||||||
* 部署名
|
* 部名
|
||||||
*/
|
*/
|
||||||
@Column(name = "nm_department", nullable = false)
|
@Column(name = "nm_department", nullable = false)
|
||||||
private String nmDepartment;
|
private String nmDepartment;
|
||||||
|
/**
|
||||||
|
* 表示・非表示フラグ
|
||||||
|
*/
|
||||||
|
@Column(name = "is_display", nullable = false)
|
||||||
|
private Integer isDisplay;
|
||||||
|
|
||||||
|
@ManyToOne(cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "id_headquarters")
|
||||||
|
@Fetch(FetchMode.JOIN)
|
||||||
|
private HeadquartersEntity headquarters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DepartmentEntity(DataAccess層依存)から Department(BusinessLogic層依存型)に変換します。
|
* DepartmentEntity(DataAccess層依存)から Department(BusinessLogic層依存型)に変換します。(リスト版)
|
||||||
*
|
*
|
||||||
* @param departmentEntityList department Table のリスト
|
* @param departmentEntityList department Table のリスト
|
||||||
* @return List<Department> リスト
|
* @return List<Department> リスト
|
||||||
@@ -53,20 +77,48 @@ public class DepartmentEntity {
|
|||||||
.stream()
|
.stream()
|
||||||
.map(departmentEntity -> new Department(
|
.map(departmentEntity -> new Department(
|
||||||
departmentEntity.getIdDepartment(),
|
departmentEntity.getIdDepartment(),
|
||||||
departmentEntity.getNmDepartment()
|
departmentEntity.getNmDepartment(),
|
||||||
|
departmentEntity.getIsDisplay(),
|
||||||
|
departmentEntity.getHeadquarters() == null ? null
|
||||||
|
: departmentEntity.getHeadquarters().getIdHeadquarters()
|
||||||
|
|
||||||
)).toList();
|
)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Department(BusinessLogic層依存型) から DepartmentEntity(DataAccess層依存)に変換します。
|
* RegisterDepartmentEntity(DataAccess層依存)から Department(BusinessLogic層依存型)に変換します。(リスト版)
|
||||||
*
|
*
|
||||||
* @param department department モデルの値
|
* @param departmentEntityList RegisterDepartmentEntity のリスト
|
||||||
* @return DepartmentEntity に変換したインスタンス
|
* @return Departmentのリスト
|
||||||
*/
|
*/
|
||||||
public static DepartmentEntity convertFrom(Department department) {
|
public static List<Department> createDepartmentListBy(List<RegisterDepartmentEntity> departmentEntityList) {
|
||||||
|
|
||||||
|
// Stream API を利用するとこうなります。
|
||||||
|
return departmentEntityList
|
||||||
|
.stream()
|
||||||
|
.map(departmentEntity -> new Department(
|
||||||
|
departmentEntity.getIdDepartment(),
|
||||||
|
departmentEntity.getNmDepartment(),
|
||||||
|
departmentEntity.getIsDisplay(),
|
||||||
|
departmentEntity.getIdHeadquarters() == null ? null : departmentEntity.getIdHeadquarters()
|
||||||
|
|
||||||
|
)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DepartmentInfo から DepartmentEntity に変換します。
|
||||||
|
*
|
||||||
|
* @param departmentInfo DepartmentInfo
|
||||||
|
* @return DepartmentEntity のインスタンス
|
||||||
|
*/
|
||||||
|
public static DepartmentEntity convertFrom(DepartmentInfo departmentInfo) {
|
||||||
return new DepartmentEntity(
|
return new DepartmentEntity(
|
||||||
department.getIdDepartment(),
|
departmentInfo.getIdDepartment(),
|
||||||
department.getNmDepartment()
|
departmentInfo.getNmDepartment(),
|
||||||
);
|
(Integer) 0,
|
||||||
|
new HeadquartersEntity(
|
||||||
|
departmentInfo.getIdHeadquarters(),
|
||||||
|
departmentInfo.getNmHeadquarters(),
|
||||||
|
(Integer) 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,165 @@
|
|||||||
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.NamedEntityGraph;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.AllDepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import com.example.rhizome.app.domain.model.DepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.Division;
|
||||||
|
import com.example.rhizome.app.domain.model.Headquarters;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Division join Department,Headquarters テーブルの Entity
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@NamedEntityGraph(name = "division_with_department_with_headquarters", includeAllAttributes = true)
|
||||||
|
public class DepartmentInfoEntity {
|
||||||
|
|
||||||
|
private DivisionEntity division;
|
||||||
|
|
||||||
|
private DepartmentEntity department;
|
||||||
|
|
||||||
|
private HeadquartersEntity headquarters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DepartmentInfo をDepartmentInfoEntityに変換します。
|
||||||
|
*
|
||||||
|
*@param departmentInfo DepartmentInfo のインスタンス
|
||||||
|
*@return DepartmentInfoEntityのインスタンス
|
||||||
|
*/
|
||||||
|
public static DepartmentInfoEntity convertFrom(DepartmentInfo departmentInfo) {
|
||||||
|
return new DepartmentInfoEntity(
|
||||||
|
new DivisionEntity(
|
||||||
|
departmentInfo.getIdDivision(),
|
||||||
|
departmentInfo.getNmDivision(),
|
||||||
|
0,
|
||||||
|
new DepartmentEntity(
|
||||||
|
departmentInfo.getIdDepartment(),
|
||||||
|
departmentInfo.getNmDepartment(),
|
||||||
|
0,
|
||||||
|
new HeadquartersEntity(
|
||||||
|
departmentInfo.getIdHeadquarters(),
|
||||||
|
departmentInfo.getNmHeadquarters(),
|
||||||
|
0))),
|
||||||
|
new DepartmentEntity(
|
||||||
|
departmentInfo.getIdDepartment(),
|
||||||
|
departmentInfo.getNmDepartment(),
|
||||||
|
0,
|
||||||
|
new HeadquartersEntity(
|
||||||
|
departmentInfo.getIdHeadquarters(),
|
||||||
|
departmentInfo.getNmHeadquarters(),
|
||||||
|
0)),
|
||||||
|
new HeadquartersEntity(
|
||||||
|
departmentInfo.getIdHeadquarters(),
|
||||||
|
departmentInfo.getNmHeadquarters(),
|
||||||
|
0)
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DepartmentInfoEntity を AllDepartmentInfo に変換します。
|
||||||
|
*
|
||||||
|
* @param departmentInfoEntity DepartmentInfoEntity のインスタンス
|
||||||
|
* @return AllDepartmentInfo のインスタンス
|
||||||
|
*/
|
||||||
|
public static AllDepartmentInfo createDepartmentInfo(DepartmentInfoEntity departmentInfoEntity) {
|
||||||
|
|
||||||
|
return new AllDepartmentInfo(
|
||||||
|
new Division(
|
||||||
|
departmentInfoEntity.getDivision() == null ? null
|
||||||
|
: departmentInfoEntity.getDivision().getIdDivision(),
|
||||||
|
departmentInfoEntity.getDivision() == null ? null
|
||||||
|
: departmentInfoEntity.getDivision().getNmDivision(),
|
||||||
|
departmentInfoEntity.getDivision() == null ? null
|
||||||
|
: departmentInfoEntity.getDivision().getIsDisplay(),
|
||||||
|
departmentInfoEntity.getDepartment() == null ? null
|
||||||
|
: departmentInfoEntity.getDepartment().getIdDepartment()),
|
||||||
|
new Department(
|
||||||
|
departmentInfoEntity.getDepartment() == null ? null
|
||||||
|
: departmentInfoEntity.getDepartment().getIdDepartment(),
|
||||||
|
departmentInfoEntity.getDepartment() == null ? null
|
||||||
|
: departmentInfoEntity.getDepartment().getNmDepartment(),
|
||||||
|
departmentInfoEntity.getDepartment() == null ? null
|
||||||
|
: departmentInfoEntity.getDepartment().getIsDisplay(),
|
||||||
|
departmentInfoEntity.getHeadquarters() == null ? null
|
||||||
|
: departmentInfoEntity.getHeadquarters().getIdHeadquarters()),
|
||||||
|
new Headquarters(
|
||||||
|
departmentInfoEntity.getHeadquarters() == null ? null
|
||||||
|
: departmentInfoEntity.getHeadquarters().getIdHeadquarters(),
|
||||||
|
departmentInfoEntity.getHeadquarters() == null ? null
|
||||||
|
: departmentInfoEntity.getHeadquarters().getNmHeadquarters(),
|
||||||
|
departmentInfoEntity.getHeadquarters() == null ? null
|
||||||
|
: departmentInfoEntity.getHeadquarters().getIsDisplay()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DepartmentInfoEntity を AllDepartmentInfo に変換します。
|
||||||
|
* (リスト版)
|
||||||
|
*
|
||||||
|
* @param departmentInfoEntity DepartmentInfoEntity インスタンスのリスト
|
||||||
|
* @return AllDepartmentInfo インスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static List<AllDepartmentInfo> createDepartmentInfoList(List<DepartmentInfoEntity> departmentInfoEntity) {
|
||||||
|
|
||||||
|
// StreamAPI を使うとこうなります。
|
||||||
|
return departmentInfoEntity.stream().map(DepartmentInfoEntity::createDepartmentInfo).toList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DivisionEntity を AllDepartmentInfo に変換します。
|
||||||
|
*
|
||||||
|
* @param divisionEntity DivisionEntity インスタンス
|
||||||
|
* @return AllDepartmentInfo インスタンス
|
||||||
|
*/
|
||||||
|
public static AllDepartmentInfo createDepartmentInfo(DivisionEntity divisionEntity) {
|
||||||
|
|
||||||
|
return new AllDepartmentInfo(
|
||||||
|
new Division(
|
||||||
|
divisionEntity.getIdDivision(),
|
||||||
|
divisionEntity.getNmDivision(),
|
||||||
|
divisionEntity.getIsDisplay(),
|
||||||
|
divisionEntity.getDepartment().getIdDepartment()),
|
||||||
|
new Department(
|
||||||
|
divisionEntity.getDepartment() == null ? null
|
||||||
|
: divisionEntity.getDepartment().getIdDepartment(),
|
||||||
|
divisionEntity.getDepartment() == null ? null
|
||||||
|
: divisionEntity.getDepartment().getNmDepartment(),
|
||||||
|
divisionEntity.getDepartment() == null ? null : divisionEntity.getDepartment().getIsDisplay(),
|
||||||
|
divisionEntity.getDepartment().getHeadquarters() == null ? null
|
||||||
|
: divisionEntity.getDepartment().getHeadquarters().getIdHeadquarters()),
|
||||||
|
new Headquarters(
|
||||||
|
divisionEntity.getDepartment().getHeadquarters() == null ? null
|
||||||
|
: divisionEntity.getDepartment().getHeadquarters().getIdHeadquarters(),
|
||||||
|
divisionEntity.getDepartment().getHeadquarters() == null ? null
|
||||||
|
: divisionEntity.getDepartment().getHeadquarters().getNmHeadquarters(),
|
||||||
|
divisionEntity.getDepartment().getHeadquarters() == null ? null
|
||||||
|
: divisionEntity.getDepartment().getHeadquarters().getIsDisplay()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DivisionEntity を AllDepartmentInfo に変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param divisionEntity DivisionEntity インスタンスのリスト
|
||||||
|
* @return AllDepartmentInfo インスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static List<AllDepartmentInfo> AfterSearchCreateDepartmentInfoList(List<DivisionEntity> divisionEntity) {
|
||||||
|
|
||||||
|
// StreamAPI を使うとこうなります。
|
||||||
|
return divisionEntity.stream().map(DepartmentInfoEntity::createDepartmentInfo).toList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Fetch;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.DepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.Division;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
/**
|
||||||
|
* Division テーブルの Entity
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "division")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DivisionEntity {
|
||||||
|
/**
|
||||||
|
* 課ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id_division", nullable = false)
|
||||||
|
private Integer idDivision;
|
||||||
|
/**
|
||||||
|
* 課名
|
||||||
|
*/
|
||||||
|
@Column(name = "nm_division", nullable = false)
|
||||||
|
private String nmDivision;
|
||||||
|
/**
|
||||||
|
* 表示・非表示フラグ
|
||||||
|
*/
|
||||||
|
@Column(name = "is_display", nullable = false)
|
||||||
|
private Integer isDisplay;
|
||||||
|
|
||||||
|
@ManyToOne(cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "id_department")
|
||||||
|
@Fetch(FetchMode.JOIN)
|
||||||
|
private DepartmentEntity department;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DepartmentInfo を DivisionEntity に変換します。
|
||||||
|
*
|
||||||
|
* @param departmentInfo DepartmentInfo のインスタンス
|
||||||
|
* @return DivisionEntity join Department,Headquarters のインスタンス
|
||||||
|
*/
|
||||||
|
public static DivisionEntity convertFrom(DepartmentInfo departmentInfo) {
|
||||||
|
return new DivisionEntity(
|
||||||
|
departmentInfo.getIdDivision(),
|
||||||
|
departmentInfo.getNmDivision(),
|
||||||
|
(Integer) 0,
|
||||||
|
new DepartmentEntity(
|
||||||
|
departmentInfo.getIdDepartment(),
|
||||||
|
departmentInfo.getNmDepartment(),
|
||||||
|
(Integer) 0,
|
||||||
|
new HeadquartersEntity(
|
||||||
|
departmentInfo.getIdHeadquarters(),
|
||||||
|
departmentInfo.getNmHeadquarters(),
|
||||||
|
(Integer) 0)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DivisionEntity を Divisionに変換します。
|
||||||
|
*
|
||||||
|
* @param divisionEntity DivisionEntity のインスタンス
|
||||||
|
* @return Divisionのインスタンス
|
||||||
|
*/
|
||||||
|
public static Division createDivision(DivisionEntity divisionEntity) {
|
||||||
|
// 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
|
||||||
|
return new Division(
|
||||||
|
divisionEntity.getIdDivision(),
|
||||||
|
divisionEntity.getNmDivision(),
|
||||||
|
divisionEntity.getIsDisplay(),
|
||||||
|
divisionEntity.getDepartment().getIdDepartment()
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DivisionEntity を Divisionに変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param divisionEntity DivisionEntity のインスタンスのリスト
|
||||||
|
* @return Divisionのインスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static List<Division> createDivisionList(List<DivisionEntity> divisionEntityList) {
|
||||||
|
|
||||||
|
return divisionEntityList
|
||||||
|
.stream()
|
||||||
|
.map(DivisionEntity::createDivision).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RegisterDivisionEntity を Divisionに変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param divisionEntityList RegisterDivisionEntity のインスタンスのリスト
|
||||||
|
* @return Divisionのインスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static List<Division> createRegisterDivisionList(List<RegisterDivisionEntity> divisionEntityList) {
|
||||||
|
|
||||||
|
return divisionEntityList
|
||||||
|
.stream()
|
||||||
|
.map(divisionEntity -> new Division(
|
||||||
|
divisionEntity.getIdDivision(),
|
||||||
|
divisionEntity.getNmDivision(),
|
||||||
|
divisionEntity.getIsDisplay(),
|
||||||
|
divisionEntity.getIdDepartment() == null ? null : divisionEntity.getIdDepartment()
|
||||||
|
|
||||||
|
)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,118 +1,157 @@
|
|||||||
package com.example.rhizome.app.infra.entity;
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.NamedEntityGraph;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.AllEmployeeInfo;
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import com.example.rhizome.app.domain.model.Division;
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
import com.example.rhizome.app.domain.model.Headquarters;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.hibernate.annotations.Fetch;
|
|
||||||
import org.hibernate.annotations.FetchMode;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Employee + Department の Join 情報を保持するEntity
|
* Employee + Division + Department + Headquarters の Join 情報を保持するEntity
|
||||||
*
|
*
|
||||||
* @author IT-College
|
* @author IT-College
|
||||||
*/
|
*/
|
||||||
@Entity
|
|
||||||
@Table(name = "employee")
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@NamedEntityGraph(
|
@NamedEntityGraph(name = "employee_with_division_with_department_with_headquarters", includeAllAttributes = true)
|
||||||
name = "employee_with_department",
|
|
||||||
includeAllAttributes = true
|
|
||||||
)
|
|
||||||
public class EmployeeDepartmentEntity {
|
public class EmployeeDepartmentEntity {
|
||||||
|
|
||||||
/**
|
private EmployeeEntity Employee;
|
||||||
* 社員ID
|
|
||||||
*/
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "id_employee", nullable = false)
|
|
||||||
private Integer idEmployee;
|
|
||||||
|
|
||||||
/**
|
private DivisionEntity division;
|
||||||
* 社員名
|
|
||||||
*/
|
|
||||||
@Column(name = "nm_employee", nullable = false)
|
|
||||||
private String nmEmployee;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 社員名カナ
|
|
||||||
*/
|
|
||||||
@Column(name = "kn_employee", nullable = false)
|
|
||||||
private String knEmployee;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* メールアドレス
|
|
||||||
*/
|
|
||||||
@Column(name = "mail_address", nullable = false)
|
|
||||||
private String mailAddress;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* パスワード
|
|
||||||
*/
|
|
||||||
@Column(name = "password", nullable = false)
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 管理者権限
|
|
||||||
*/
|
|
||||||
@Column(name = "admin_auth", nullable = false)
|
|
||||||
private Integer adminAuth;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "id_department", referencedColumnName = "id_department", insertable = false, updatable = false)
|
|
||||||
@Fetch(FetchMode.JOIN)
|
|
||||||
private DepartmentEntity department;
|
private DepartmentEntity department;
|
||||||
|
|
||||||
|
private HeadquartersEntity headquarters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。
|
* EmployeeDepartmentEntity(DataAccess層依存) を AllEmployeeInfo(BusinessLogic層依存) に変換します。
|
||||||
*
|
*
|
||||||
* @param employeeDepartmentEntity EmployeeDepartmentEntity のインスタンス
|
* @param employeeDepartmentEntity EmployeeDepartmentEntity のインスタンス
|
||||||
* @return EmployeeInfo のインスタンス
|
* @return AllEmployeeInfo のインスタンス
|
||||||
*/
|
*/
|
||||||
public static EmployeeInfo createEmployeeInfo(EmployeeDepartmentEntity employeeDepartmentEntity) {
|
public static AllEmployeeInfo createEmployeeInfo(EmployeeDepartmentEntity employeeDepartmentEntity) {
|
||||||
|
|
||||||
// コンストラクタを使って書くとSetterを使用するより簡略化出来ます。
|
// コンストラクタを使って書くとSetterを使用するより簡略化出来ます。
|
||||||
// 混乱してしまう人は落ち着いて EmployeeInfo のフィールドを見に行って、
|
// 混乱してしまう人は落ち着いて EmployeeInfo のフィールドを見に行って、
|
||||||
// どうしてこの書き方が出来るのかを理解できる様になりましょう。
|
// どうしてこの書き方が出来るのかを理解できる様になりましょう。
|
||||||
return new EmployeeInfo(
|
return new AllEmployeeInfo(
|
||||||
new Employee(
|
new Employee(
|
||||||
employeeDepartmentEntity.getIdEmployee(),
|
employeeDepartmentEntity.getEmployee().getIdEmployee(),
|
||||||
employeeDepartmentEntity.getNmEmployee(),
|
employeeDepartmentEntity.getEmployee().getNmEmployee(),
|
||||||
employeeDepartmentEntity.getKnEmployee(),
|
employeeDepartmentEntity.getEmployee().getKnEmployee(),
|
||||||
employeeDepartmentEntity.getMailAddress(),
|
employeeDepartmentEntity.getEmployee().getMailAddress(),
|
||||||
employeeDepartmentEntity.getPassword(),
|
employeeDepartmentEntity.getEmployee().getPassword(),
|
||||||
employeeDepartmentEntity.getAdminAuth(),
|
employeeDepartmentEntity.getEmployee().getHireDate(),
|
||||||
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment()
|
employeeDepartmentEntity.getEmployee().getAdminAuth(),
|
||||||
),
|
employeeDepartmentEntity.getDivision() == null ? null
|
||||||
|
: employeeDepartmentEntity.getDivision().getIdDivision()),
|
||||||
|
new Division(
|
||||||
|
employeeDepartmentEntity.getDivision() == null ? null
|
||||||
|
: employeeDepartmentEntity.getDivision().getIdDivision(),
|
||||||
|
employeeDepartmentEntity.getDivision() == null ? null
|
||||||
|
: employeeDepartmentEntity.getDivision().getNmDivision(),
|
||||||
|
employeeDepartmentEntity.getDivision() == null ? null
|
||||||
|
: employeeDepartmentEntity.getDivision().getIsDisplay(),
|
||||||
|
employeeDepartmentEntity.getDepartment() == null ? null
|
||||||
|
: employeeDepartmentEntity.getDepartment().getIdDepartment()),
|
||||||
new Department(
|
new Department(
|
||||||
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment(),
|
employeeDepartmentEntity.getDepartment() == null ? null
|
||||||
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getNmDepartment()
|
: employeeDepartmentEntity.getDepartment().getIdDepartment(),
|
||||||
)
|
employeeDepartmentEntity.getDepartment() == null ? null
|
||||||
);
|
: employeeDepartmentEntity.getDepartment().getNmDepartment(),
|
||||||
|
employeeDepartmentEntity.getDepartment() == null ? null
|
||||||
|
: employeeDepartmentEntity.getDepartment().getIsDisplay(),
|
||||||
|
employeeDepartmentEntity.getHeadquarters() == null ? null
|
||||||
|
: employeeDepartmentEntity.getHeadquarters().getIdHeadquarters()),
|
||||||
|
new Headquarters(
|
||||||
|
employeeDepartmentEntity.getHeadquarters() == null ? null
|
||||||
|
: employeeDepartmentEntity.getHeadquarters().getIdHeadquarters(),
|
||||||
|
employeeDepartmentEntity.getHeadquarters() == null ? null
|
||||||
|
: employeeDepartmentEntity.getHeadquarters().getNmHeadquarters(),
|
||||||
|
employeeDepartmentEntity.getHeadquarters() == null ? null
|
||||||
|
: employeeDepartmentEntity.getHeadquarters().getIsDisplay()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。
|
* EmployeeDepartmentEntity(DataAccess層依存) を AllEmployeeInfo(BusinessLogic層依存) に変換します。
|
||||||
* (リスト版)
|
* (リスト版)
|
||||||
*
|
*
|
||||||
* @param employeeDepartmentEntityList EmployeeDepartmentEntity インスタンスのリスト
|
* @param employeeDepartmentEntityList EmployeeDepartmentEntity インスタンスのリスト
|
||||||
* @return EmployeeInfo インスタンスのリスト
|
* @return AllEmployeeInfo インスタンスのリスト
|
||||||
*/
|
*/
|
||||||
public static List<EmployeeInfo> createEmployeeInfoList(List<EmployeeDepartmentEntity> employeeDepartmentEntityList) {
|
public static List<AllEmployeeInfo> createEmployeeInfoList(
|
||||||
|
List<EmployeeDepartmentEntity> employeeDepartmentEntityList) {
|
||||||
|
|
||||||
// StreamAPI を使うとこうなります。
|
// StreamAPI を使うとこうなります。
|
||||||
return employeeDepartmentEntityList.stream().map(EmployeeDepartmentEntity::createEmployeeInfo).toList();
|
return employeeDepartmentEntityList.stream().map(EmployeeDepartmentEntity::createEmployeeInfo).toList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmployeeEntity(DataAccess層依存) を AllEmployeeInfo(BusinessLogic層依存) に変換します。
|
||||||
|
*
|
||||||
|
* @param employeeEntity EmployeeEntity のインスタンス
|
||||||
|
* @return AllEmployeeInfo のインスタンス
|
||||||
|
*/
|
||||||
|
public static AllEmployeeInfo createEmployeeInfo(EmployeeEntity employeeEntity) {
|
||||||
|
|
||||||
|
return new AllEmployeeInfo(
|
||||||
|
new Employee(
|
||||||
|
employeeEntity.getIdEmployee(),
|
||||||
|
employeeEntity.getNmEmployee(),
|
||||||
|
employeeEntity.getKnEmployee(),
|
||||||
|
employeeEntity.getMailAddress(),
|
||||||
|
employeeEntity.getPassword(),
|
||||||
|
employeeEntity.getHireDate(),
|
||||||
|
employeeEntity.getAdminAuth(),
|
||||||
|
employeeEntity.getDivision() == null ? null : employeeEntity.getDivision().getIdDivision()),
|
||||||
|
new Division(
|
||||||
|
employeeEntity.getDivision() == null ? null : employeeEntity.getDivision().getIdDivision(),
|
||||||
|
employeeEntity.getDivision() == null ? null : employeeEntity.getDivision().getNmDivision(),
|
||||||
|
employeeEntity.getDivision() == null ? null : employeeEntity.getDivision().getIsDisplay(),
|
||||||
|
employeeEntity.getDivision().getDepartment() == null ? null
|
||||||
|
: employeeEntity.getDivision().getDepartment().getIdDepartment()),
|
||||||
|
new Department(
|
||||||
|
employeeEntity.getDivision().getDepartment() == null ? null
|
||||||
|
: employeeEntity.getDivision().getDepartment().getIdDepartment(),
|
||||||
|
employeeEntity.getDivision().getDepartment() == null ? null
|
||||||
|
: employeeEntity.getDivision().getDepartment().getNmDepartment(),
|
||||||
|
employeeEntity.getDivision().getDepartment() == null ? null
|
||||||
|
: employeeEntity.getDivision().getDepartment().getIsDisplay(),
|
||||||
|
employeeEntity.getDivision().getDepartment().getHeadquarters() == null ? null
|
||||||
|
: employeeEntity.getDivision().getDepartment().getHeadquarters().getIdHeadquarters()),
|
||||||
|
new Headquarters(
|
||||||
|
employeeEntity.getDivision().getDepartment().getHeadquarters() == null ? null
|
||||||
|
: employeeEntity.getDivision().getDepartment().getHeadquarters().getIdHeadquarters(),
|
||||||
|
employeeEntity.getDivision().getDepartment().getHeadquarters() == null ? null
|
||||||
|
: employeeEntity.getDivision().getDepartment().getHeadquarters().getNmHeadquarters(),
|
||||||
|
employeeEntity.getDivision().getDepartment().getHeadquarters() == null ? null
|
||||||
|
: employeeEntity.getDivision().getDepartment().getHeadquarters().getIsDisplay()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmployeeEntity(DataAccess層依存) を AllEmployeeInfo(BusinessLogic層依存) に変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param employeeEntity EmployeeEntity のインスタンスのリスト
|
||||||
|
* @return AllEmployeeInfo のインスタンスのリスト
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static List<AllEmployeeInfo> AfterSearchCreateEmployeeInfoList(List<EmployeeEntity> employeeEntityList) {
|
||||||
|
|
||||||
|
// StreamAPI を使うとこうなります。
|
||||||
|
return employeeEntityList.stream().map(EmployeeDepartmentEntity::createEmployeeInfo).toList();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,21 +6,32 @@
|
|||||||
*/
|
*/
|
||||||
package com.example.rhizome.app.infra.entity;
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Fetch;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
import com.example.rhizome.app.domain.model.LoginUser;
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EmployeeテーブルのEntity
|
* EmployeeテーブルのEntity
|
||||||
*
|
*
|
||||||
* @author IT-College
|
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "employee")
|
@Table(name = "employee")
|
||||||
@@ -61,6 +72,11 @@ public class EmployeeEntity {
|
|||||||
@Column(name = "password", nullable = false)
|
@Column(name = "password", nullable = false)
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
@Column(name = "hire_Date", nullable = false)
|
||||||
|
private String hireDate;
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
@@ -70,27 +86,32 @@ public class EmployeeEntity {
|
|||||||
/**
|
/**
|
||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
@Column(name = "id_department", nullable = false)
|
@ManyToOne
|
||||||
private Integer idDepartment;
|
@JoinColumn(name = "id_division")
|
||||||
|
@Fetch(FetchMode.JOIN)
|
||||||
|
private DivisionEntity division;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Employee(BusinessLogic 依存)を EmployeeEntity(DataAccess層依存)に変換します。
|
* EmployeeInfo(BusinessLogic 依存)を EmployeeEntity(DataAccess層依存)に変換します。
|
||||||
*
|
*
|
||||||
* @param employee Employee Table の中身
|
* @param employeeInfo EmployeeInfo Table の中身
|
||||||
* @return EmployeeEntity のインスタンス(1レコード分)
|
* @return EmployeeEntity のインスタンス(1レコード分)
|
||||||
*/
|
*/
|
||||||
public static EmployeeEntity convertFrom(Employee employee) {
|
public static EmployeeEntity convertFrom(EmployeeInfo employeeInfo) {
|
||||||
// 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
|
// 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
|
||||||
return new EmployeeEntity(
|
return new EmployeeEntity(
|
||||||
employee.getIdEmployee(),
|
employeeInfo.getEmployee().getIdEmployee(),
|
||||||
employee.getNmEmployee(),
|
employeeInfo.getEmployee().getNmEmployee(),
|
||||||
employee.getKnEmployee(),
|
employeeInfo.getEmployee().getKnEmployee(),
|
||||||
employee.getMailAddress(),
|
employeeInfo.getEmployee().getMailAddress(),
|
||||||
employee.getPassword(),
|
employeeInfo.getEmployee().getPassword(),
|
||||||
employee.getAdminAuth(),
|
employeeInfo.getEmployee().getHireDate(),
|
||||||
employee.getIdDepartment()
|
employeeInfo.getEmployee().getAdminAuth(),
|
||||||
);
|
new DivisionEntity(
|
||||||
|
employeeInfo.getDivision().getIdDivision(),
|
||||||
|
employeeInfo.getDivision().getNmDivision(),
|
||||||
|
employeeInfo.getDivision().getIsDisplay(),
|
||||||
|
null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,8 +128,6 @@ public class EmployeeEntity {
|
|||||||
employeeEntity.setNmEmployee(searchConditionEmployee.getNmEmployee());
|
employeeEntity.setNmEmployee(searchConditionEmployee.getNmEmployee());
|
||||||
employeeEntity.setKnEmployee(searchConditionEmployee.getKnEmployee());
|
employeeEntity.setKnEmployee(searchConditionEmployee.getKnEmployee());
|
||||||
employeeEntity.setMailAddress(searchConditionEmployee.getMailAddress());
|
employeeEntity.setMailAddress(searchConditionEmployee.getMailAddress());
|
||||||
employeeEntity.setIdDepartment(searchConditionEmployee.getIdDepartment());
|
|
||||||
|
|
||||||
|
|
||||||
return employeeEntity;
|
return employeeEntity;
|
||||||
|
|
||||||
@@ -128,9 +147,9 @@ public class EmployeeEntity {
|
|||||||
employeeEntity.getKnEmployee(),
|
employeeEntity.getKnEmployee(),
|
||||||
employeeEntity.getMailAddress(),
|
employeeEntity.getMailAddress(),
|
||||||
employeeEntity.getPassword(),
|
employeeEntity.getPassword(),
|
||||||
|
employeeEntity.getHireDate(),
|
||||||
employeeEntity.getAdminAuth(),
|
employeeEntity.getAdminAuth(),
|
||||||
employeeEntity.getIdDepartment()
|
employeeEntity.getDivision().getIdDivision());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,8 +186,7 @@ public class EmployeeEntity {
|
|||||||
getMailAddress(),
|
getMailAddress(),
|
||||||
getPassword(),
|
getPassword(),
|
||||||
getAdminAuth(),
|
getAdminAuth(),
|
||||||
getIdDepartment()
|
getDivision().getIdDivision());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.DepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.Headquarters;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HeadquartersテーブルのEntity
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "headquarters")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class HeadquartersEntity {
|
||||||
|
/**
|
||||||
|
* 本部ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id_headquarters", nullable = false)
|
||||||
|
private Integer idHeadquarters;
|
||||||
|
/**
|
||||||
|
* 本部名
|
||||||
|
*/
|
||||||
|
@Column(name = "nm_headquarters", nullable = false)
|
||||||
|
private String nmHeadquarters;
|
||||||
|
/**
|
||||||
|
* 表示・非表示フラグ
|
||||||
|
*/
|
||||||
|
@Column(name = "is_display", nullable = false)
|
||||||
|
private Integer isDisplay;
|
||||||
|
|
||||||
|
public static Headquarters createHeadquarters(HeadquartersEntity headquartersEntity) {
|
||||||
|
// 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
|
||||||
|
return new Headquarters(
|
||||||
|
headquartersEntity.getIdHeadquarters(),
|
||||||
|
headquartersEntity.getNmHeadquarters(),
|
||||||
|
headquartersEntity.getIsDisplay());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* DBから返ってきたHeadquartersEntityのリストをHeadquartersのリストに変換する
|
||||||
|
*
|
||||||
|
* @param HeadquartersEntityのリスト
|
||||||
|
* @return headquartersのリスト
|
||||||
|
*/
|
||||||
|
public static List<Headquarters> createHeadquartersList(List<HeadquartersEntity> headquartersEntityList) {
|
||||||
|
|
||||||
|
return headquartersEntityList
|
||||||
|
.stream()
|
||||||
|
.map(HeadquartersEntity::createHeadquarters).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 三つのテーブルがつながった部署情報であるDepartmentInfoから
|
||||||
|
* 本部情報だけを引っ張ってきてHeadquartersEntityに入れる
|
||||||
|
*
|
||||||
|
* @param DepartmentInfo
|
||||||
|
* @return 新しく作成されたHeadquartersEntity
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static HeadquartersEntity convertFrom(DepartmentInfo departmentInfo) {
|
||||||
|
return new HeadquartersEntity(
|
||||||
|
departmentInfo.getIdHeadquarters(),
|
||||||
|
departmentInfo.getNmHeadquarters(),
|
||||||
|
(Integer) 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員情報登録用のEmployeeテーブルのEntity
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "employee")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
|
||||||
|
public class InsertEmployeeEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id_employee", nullable = false)
|
||||||
|
private Integer idEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
@Column(name = "nm_employee", nullable = false)
|
||||||
|
private String nmEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
@Column(name = "kn_employee", nullable = false)
|
||||||
|
private String knEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
@Column(name = "mail_address", nullable = false)
|
||||||
|
private String mailAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
@Column(name = "password", nullable = false)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
@Column(name = "hire_Date", nullable = false)
|
||||||
|
private String hireDate;
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
|
*/
|
||||||
|
@Column(name = "admin_auth", nullable = false)
|
||||||
|
private Integer adminAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
@Column(name = "id_division", nullable = false)
|
||||||
|
private Integer idDivision;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Employee(BusinessLogic 依存)を InsertEmployeeEntity(DataAccess層依存)に変換します。
|
||||||
|
*
|
||||||
|
* @param employee Employee Table の中身
|
||||||
|
* @return InsertEmployeeEntity のインスタンス(1レコード分)
|
||||||
|
*/
|
||||||
|
public static InsertEmployeeEntity convertFrom(Employee employee) {
|
||||||
|
// 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
|
||||||
|
return new InsertEmployeeEntity(
|
||||||
|
employee.getIdEmployee(),
|
||||||
|
employee.getNmEmployee(),
|
||||||
|
employee.getKnEmployee(),
|
||||||
|
employee.getMailAddress(),
|
||||||
|
employee.getPassword(),
|
||||||
|
employee.getHireDate(),
|
||||||
|
employee.getAdminAuth(),
|
||||||
|
employee.getIdDivision());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員情報登録用のDepartment テーブルの Entity
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "department")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
|
||||||
|
public class RegisterDepartmentEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id_department", nullable = false)
|
||||||
|
private Integer idDepartment;
|
||||||
|
/**
|
||||||
|
* 部名
|
||||||
|
*/
|
||||||
|
@Column(name = "nm_department", nullable = false)
|
||||||
|
private String nmDepartment;
|
||||||
|
/**
|
||||||
|
* 表示・非表示フラグ
|
||||||
|
*/
|
||||||
|
@Column(name = "is_display", nullable = false)
|
||||||
|
private Integer isDisplay;
|
||||||
|
|
||||||
|
@Column(name = "id_headquarters", nullable = false)
|
||||||
|
private Integer idHeadquarters;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package com.example.rhizome.app.infra.repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.data.jpa.repository.EntityGraph;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.entity.DepartmentInfoEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.DivisionEntity;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface DepartmentInfoRepository
|
||||||
|
extends JpaRepository<DivisionEntity, Integer>, JpaSpecificationExecutor<DivisionEntity> {
|
||||||
|
|
||||||
|
static Specification<DivisionEntity> idDivisionEqual(Integer idDivision) {
|
||||||
|
return idDivision == null ? null :
|
||||||
|
// 戻り値の型 Specification<EmployeeDepartmentEntity> にキャスト
|
||||||
|
(Specification<DivisionEntity>)
|
||||||
|
// ラムダ式で記載しているが書いてあることは criteriaBuilder を使って Where句の後の "'idEmployee' = idEmployee(変数)"
|
||||||
|
// を作成している
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.equal(root.get("idDivision"), idDivision);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<DivisionEntity> nmDivisionEqual(String nmDivision) {
|
||||||
|
return (nmDivision == null || nmDivision.isEmpty()) ? null
|
||||||
|
: (Specification<DivisionEntity>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder
|
||||||
|
.equal(root.get("nmDivision"), nmDivision);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<DivisionEntity> nmDepartmentEqual(String nmDepartment) {
|
||||||
|
return (nmDepartment == null || nmDepartment.isEmpty()) ? null
|
||||||
|
: (Specification<DivisionEntity>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder
|
||||||
|
.equal(root.join("department").get("nmDepartment"), nmDepartment);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<DivisionEntity> nmHeadquartersEqual(String nmHeadquarters) {
|
||||||
|
return (nmHeadquarters == null || nmHeadquarters.isEmpty()) ? null
|
||||||
|
: (Specification<DivisionEntity>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder
|
||||||
|
.equal(root.join("department").join("headquarters").get("nmHeadquarters"), nmHeadquarters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Query("SELECT DISTINCT new com.example.rhizome.app.infra.entity.DepartmentInfoEntity(di,de,h)FROM DivisionEntity di "
|
||||||
|
+ "INNER JOIN di.department de "
|
||||||
|
+ "INNER JOIN de.headquarters h ")
|
||||||
|
List<DepartmentInfoEntity> searchAllDepartmentTable();
|
||||||
|
|
||||||
|
@EntityGraph(attributePaths = { "department", "department.headquarters" })
|
||||||
|
List<DivisionEntity> findAll(@Nullable Specification<DivisionEntity> spec);
|
||||||
|
|
||||||
|
@EntityGraph(attributePaths = { "department", "department.headquarters" })
|
||||||
|
void save(@Nullable Specification<DivisionEntity> spec);
|
||||||
|
|
||||||
|
@Query("SELECT DISTINCT new com.example.rhizome.app.infra.entity.DepartmentInfoEntity(di,de,h)FROM DivisionEntity di "
|
||||||
|
+ "INNER JOIN di.department de "
|
||||||
|
+ "INNER JOIN de.headquarters h "
|
||||||
|
+ "WHERE di.nmDivision = :nmDivision "
|
||||||
|
+ "AND de.nmDepartment = :nmDepartment "
|
||||||
|
+ "AND h.nmHeadquarters = :nmHeadquarters"
|
||||||
|
+ "")
|
||||||
|
List<DepartmentInfoEntity> searchAllDepartmentTable(
|
||||||
|
@Param("nmHeadquarters") String nmHeadquarters,
|
||||||
|
@Param("nmDepartment") String nmDepartment,
|
||||||
|
@Param("nmDivision") String nmDivision);
|
||||||
|
|
||||||
|
@Query("SELECT DISTINCT new com.example.rhizome.app.infra.entity.DepartmentInfoEntity(di,de,h)FROM DivisionEntity di "
|
||||||
|
+ "INNER JOIN di.department de "
|
||||||
|
+ "INNER JOIN de.headquarters h "
|
||||||
|
+ "WHERE di.idDivision = :idDivision "
|
||||||
|
+ "AND de.idDepartment = :idDepartment "
|
||||||
|
+ "AND h.idHeadquarters = :idHeadquarters"
|
||||||
|
+ "")
|
||||||
|
List<DepartmentInfoEntity> searchAllDepartmentTable(
|
||||||
|
@Param("idHeadquarters") Integer idHeadquarters,
|
||||||
|
@Param("idDepartment") Integer idDepartment,
|
||||||
|
@Param("idDivision") Integer idDivision);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.example.rhizome.app.infra.repository;
|
package com.example.rhizome.app.infra.repository;
|
||||||
|
|
||||||
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.HeadquartersEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specification:
|
* Specification:
|
||||||
@@ -20,12 +21,11 @@ import org.springframework.stereotype.Repository;
|
|||||||
* 戻り値はクエリを格納しているPredicateオブジェクトとなります。
|
* 戻り値はクエリを格納しているPredicateオブジェクトとなります。
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface DepartmentRepository extends JpaRepository<DepartmentEntity, Integer>, JpaSpecificationExecutor<DepartmentEntity> {
|
public interface DepartmentRepository
|
||||||
|
extends JpaRepository<DepartmentEntity, Integer>, JpaSpecificationExecutor<DepartmentEntity> {
|
||||||
|
|
||||||
static Specification<DepartmentEntity> idDepartmentEqual(Integer idDepartment) {
|
static Specification<DepartmentEntity> idDepartmentEqual(Integer idDepartment) {
|
||||||
return idDepartment == null ?
|
return idDepartment == null ? null :
|
||||||
null :
|
|
||||||
// 戻り値の型 Specification<DepartmentEntity> にキャスト
|
// 戻り値の型 Specification<DepartmentEntity> にキャスト
|
||||||
(Specification<DepartmentEntity>)
|
(Specification<DepartmentEntity>)
|
||||||
// ラムダ式で記載しているが書いてあることは criteriaBuilder を使って Where句の後の "'idDepartment' = idDepartment(変数)"
|
// ラムダ式で記載しているが書いてあることは criteriaBuilder を使って Where句の後の "'idDepartment' = idDepartment(変数)"
|
||||||
@@ -34,17 +34,17 @@ public interface DepartmentRepository extends JpaRepository<DepartmentEntity, In
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Specification<DepartmentEntity> nmDepartmentEqual(String nmDepartment) {
|
static Specification<DepartmentEntity> nmDepartmentEqual(String nmDepartment) {
|
||||||
return (nmDepartment == null || nmDepartment.isEmpty()) ?
|
return (nmDepartment == null || nmDepartment.isEmpty()) ? null
|
||||||
null :
|
: (Specification<DepartmentEntity>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder
|
||||||
(Specification<DepartmentEntity>)
|
.like(root.get("nmDepartment"), nmDepartment);
|
||||||
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.like(root.get("nmDepartment"), nmDepartment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Specification<DepartmentEntity> nmDepartmentLike(String nmDepartment) {
|
static Specification<DepartmentEntity> nmDepartmentLike(String nmDepartment) {
|
||||||
return (nmDepartment == null || nmDepartment.isEmpty()) ?
|
return (nmDepartment == null || nmDepartment.isEmpty()) ? null
|
||||||
null :
|
: (Specification<DepartmentEntity>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder
|
||||||
(Specification<DepartmentEntity>)
|
.like(root.get("nmDepartment"), "%" + nmDepartment + "%");
|
||||||
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.like(root.get("nmDepartment"), "%" + nmDepartment + "%");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DepartmentEntity findByHeadquartersAndNmDepartment(HeadquartersEntity headquartersEntity, String nmDepartment);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.example.rhizome.app.infra.repository;
|
||||||
|
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.entity.DivisionEntity;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface DivisionRepository
|
||||||
|
extends JpaRepository<DivisionEntity, Integer>, JpaSpecificationExecutor<DivisionEntity> {
|
||||||
|
|
||||||
|
static Specification<DivisionEntity> idDivisionEqual(Integer idDivision) {
|
||||||
|
return idDivision == null ? null :
|
||||||
|
// 戻り値の型 Specification<DepartmentEntity> にキャスト
|
||||||
|
(Specification<DivisionEntity>)
|
||||||
|
// ラムダ式で記載しているが書いてあることは criteriaBuilder を使って Where句の後の "'idDepartment' = idDepartment(変数)"
|
||||||
|
// を作成している
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.equal(root.get("idDivision"), idDivision);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<DivisionEntity> nmDivisionEqual(String nmDivision) {
|
||||||
|
return (nmDivision == null || nmDivision.isEmpty()) ? null
|
||||||
|
: (Specification<DivisionEntity>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder
|
||||||
|
.like(root.get("nmDivision"), nmDivision);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<DivisionEntity> idDepartmentEqual(Integer idDepartment) {
|
||||||
|
return idDepartment == null ? null :
|
||||||
|
// 戻り値の型 Specification<DepartmentEntity> にキャスト
|
||||||
|
(Specification<DivisionEntity>)
|
||||||
|
// ラムダ式で記載しているが書いてあることは criteriaBuilder を使って Where句の後の "'idDepartment' = idDepartment(変数)"
|
||||||
|
// を作成している
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.equal(root.get("idDepartment"), idDepartment);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
@Query("DELETE FROM DivisionEntity di "
|
||||||
|
+ "WHERE di.idDivision =:idDivision")
|
||||||
|
|
||||||
|
void deleteByIdDivision(Integer idDivision);
|
||||||
|
}
|
||||||
@@ -1,11 +1,18 @@
|
|||||||
package com.example.rhizome.app.infra.repository;
|
package com.example.rhizome.app.infra.repository;
|
||||||
|
|
||||||
import com.example.rhizome.app.infra.entity.EmployeeDepartmentEntity;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.data.jpa.repository.EntityGraph;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeDepartmentEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ワンポイント情報(ここで登場する関数型インターフェース Specification について解説します)
|
* ワンポイント情報(ここで登場する関数型インターフェース Specification について解説します)
|
||||||
* Specification:
|
* Specification:
|
||||||
@@ -20,42 +27,48 @@ import org.springframework.stereotype.Repository;
|
|||||||
* 戻り値はクエリを格納しているPredicateオブジェクトとなります。
|
* 戻り値はクエリを格納しているPredicateオブジェクトとなります。
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface EmployeeInfoRepository extends JpaRepository<EmployeeDepartmentEntity, Integer>, JpaSpecificationExecutor<EmployeeDepartmentEntity> {
|
public interface EmployeeInfoRepository
|
||||||
|
extends JpaRepository<EmployeeEntity, Integer>, JpaSpecificationExecutor<EmployeeEntity> {
|
||||||
|
|
||||||
static Specification<EmployeeDepartmentEntity> idEmployeeEqual(Integer idEmployee) {
|
static Specification<EmployeeEntity> idEmployeeEqual(Integer idEmployee) {
|
||||||
return idEmployee == null ?
|
return idEmployee == null ? null :
|
||||||
null :
|
|
||||||
// 戻り値の型 Specification<EmployeeDepartmentEntity> にキャスト
|
// 戻り値の型 Specification<EmployeeDepartmentEntity> にキャスト
|
||||||
(Specification<EmployeeDepartmentEntity>)
|
(Specification<EmployeeEntity>)
|
||||||
// ラムダ式で記載しているが書いてあることは criteriaBuilder を使って Where句の後の "'idEmployee' = idEmployee(変数)"
|
// ラムダ式で記載しているが書いてあることは criteriaBuilder を使って Where句の後の "'idEmployee' = idEmployee(変数)"
|
||||||
// を作成している
|
// を作成している
|
||||||
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.equal(root.get("idEmployee"), idEmployee);
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.equal(root.get("idEmployee"), idEmployee);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Specification<EmployeeDepartmentEntity> nmEmployeeEqual(String nmEmployee) {
|
static Specification<EmployeeEntity> nmEmployeeEqual(String nmEmployee) {
|
||||||
return (nmEmployee == null || nmEmployee.isEmpty()) ?
|
return (nmEmployee == null || nmEmployee.isEmpty()) ? null
|
||||||
null :
|
: (Specification<EmployeeEntity>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder
|
||||||
(Specification<EmployeeDepartmentEntity>)
|
.like(root.get("nmEmployee"), "%" + nmEmployee + "%");
|
||||||
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.like(root.get("nmEmployee"), "%" + nmEmployee + "%");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Specification<EmployeeDepartmentEntity> knEmployeeEqual(String knEmployee) {
|
static Specification<EmployeeEntity> knEmployeeEqual(String knEmployee) {
|
||||||
return (knEmployee == null || knEmployee.isEmpty()) ?
|
return (knEmployee == null || knEmployee.isEmpty()) ? null
|
||||||
null :
|
: (Specification<EmployeeEntity>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder
|
||||||
(Specification<EmployeeDepartmentEntity>)
|
.like(root.get("knEmployee"), "%" + knEmployee + "%");
|
||||||
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.like(root.get("knEmployee"), "%" + knEmployee + "%");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Specification<EmployeeDepartmentEntity> mailAddressEqual(String mailAddress) {
|
static Specification<EmployeeEntity> mailAddressEqual(String mailAddress) {
|
||||||
return (mailAddress == null || mailAddress.isEmpty()) ?
|
return (mailAddress == null || mailAddress.isEmpty()) ? null
|
||||||
null :
|
: (Specification<EmployeeEntity>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder
|
||||||
(Specification<EmployeeDepartmentEntity>)
|
.like(root.get("mailAddress"), "%" + mailAddress + "%");
|
||||||
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.like(root.get("mailAddress"), "%" + mailAddress + "%");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Specification<EmployeeDepartmentEntity> idDepartmentEqual(Integer idDepartment) {
|
static Specification<EmployeeEntity> idDivisionEqual(Integer idDivision) {
|
||||||
return (root, query, criteriaBuilder) ->
|
return (root, query, criteriaBuilder) -> idDivision == null ? null
|
||||||
idDepartment == null ? null :
|
: criteriaBuilder.equal(root.join("division").get("idDivision"), idDivision);
|
||||||
criteriaBuilder.equal(root.join("department").get("idDepartment"), idDepartment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Query("SELECT DISTINCT new com.example.rhizome.app.infra.entity.EmployeeDepartmentEntity(e,di,de,h)FROM EmployeeEntity e "
|
||||||
|
+ "INNER JOIN e.division di "
|
||||||
|
+ "INNER JOIN di.department de "
|
||||||
|
+ "INNER JOIN de.headquarters h ")
|
||||||
|
List<EmployeeDepartmentEntity> findAlltable();
|
||||||
|
|
||||||
|
//全てのテーブルを結合してから検索
|
||||||
|
@EntityGraph(attributePaths = { "division", "division.department", "division.department.headquarters" })
|
||||||
|
List<EmployeeEntity> findAll(@Nullable Specification<EmployeeEntity> spec);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
package com.example.rhizome.app.infra.repository;
|
package com.example.rhizome.app.infra.repository;
|
||||||
|
|
||||||
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
||||||
|
import com.example.rhizome.app.infra.entity.InsertEmployeeEntity;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface EmployeeRepository extends JpaRepository<EmployeeEntity, Integer> {
|
public interface EmployeeRepository extends JpaRepository<EmployeeEntity, Integer> {
|
||||||
Optional<EmployeeEntity> findByMailAddressAndPassword(String mailAddress, String password);
|
Optional<EmployeeEntity> findByMailAddressAndPassword(String mailAddress, String password);
|
||||||
@@ -24,5 +26,7 @@ public interface EmployeeRepository extends JpaRepository<EmployeeEntity, Intege
|
|||||||
/**
|
/**
|
||||||
* IDで検索
|
* IDで検索
|
||||||
**/
|
**/
|
||||||
List<EmployeeEntity> findByIdDepartment(Integer idDepartment);
|
List<EmployeeEntity> findByDivision_idDivision(Integer idDivision);
|
||||||
|
|
||||||
|
void save(InsertEmployeeEntity insertEmployeeEntity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.example.rhizome.app.infra.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.entity.HeadquartersEntity;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface HeadquartersRepository
|
||||||
|
extends JpaRepository<HeadquartersEntity, Integer>, JpaSpecificationExecutor<HeadquartersEntity> {
|
||||||
|
static Specification<HeadquartersEntity> idHeadquartersEqual(Integer idHeadquarters) {
|
||||||
|
return idHeadquarters == null ? null :
|
||||||
|
// 戻り値の型 Specification<DepartmentEntity> にキャスト
|
||||||
|
(Specification<HeadquartersEntity>)
|
||||||
|
// ラムダ式で記載しているが書いてあることは criteriaBuilder を使って Where句の後の "'idDepartment' = idDepartment(変数)"
|
||||||
|
// を作成している
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.equal(root.get("idHeadquarters"),
|
||||||
|
idHeadquarters);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<HeadquartersEntity> nmHeadquartersEqual(String nmHeadquarters) {
|
||||||
|
return (nmHeadquarters == null || nmHeadquarters.isEmpty()) ? null
|
||||||
|
: (Specification<HeadquartersEntity>) (root, criteriaQuery, criteriaBuilder) -> criteriaBuilder
|
||||||
|
.like(root.get("nmHeadquarters"), nmHeadquarters);
|
||||||
|
}
|
||||||
|
|
||||||
|
HeadquartersEntity findByNmHeadquarters(String nmHeadquarters);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.example.rhizome.app.infra.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.entity.RegisterDepartmentEntity;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface RegisterDepartmentRepository
|
||||||
|
extends JpaRepository<RegisterDepartmentEntity, Integer>, JpaSpecificationExecutor<RegisterDepartmentEntity> {
|
||||||
|
static Specification<RegisterDepartmentEntity> idHeadquartersEqual(Integer idHeadquarters) {
|
||||||
|
|
||||||
|
return idHeadquarters == null ? null :
|
||||||
|
//戻り値の型 Specification<DepartmentEntity> にキャスト
|
||||||
|
(Specification<RegisterDepartmentEntity>)
|
||||||
|
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.equal(root.get("idHeadquarters"),
|
||||||
|
idHeadquarters);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,18 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
@@ -10,18 +23,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAt
|
|||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.DELETE_DEPARTMENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 削除処理のコントロータ
|
* 削除処理のコントロータ
|
||||||
@@ -45,8 +46,7 @@ public class DeleteDepartmentController {
|
|||||||
DeleteDepartment deleteDepartment,
|
DeleteDepartment deleteDepartment,
|
||||||
SearchDepartment searchDepartment,
|
SearchDepartment searchDepartment,
|
||||||
SearchEmployee searchEmployee,
|
SearchEmployee searchEmployee,
|
||||||
HttpSession httpSession
|
HttpSession httpSession) {
|
||||||
) {
|
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.deleteDepartment = deleteDepartment;
|
this.deleteDepartment = deleteDepartment;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
@@ -56,26 +56,26 @@ public class DeleteDepartmentController {
|
|||||||
/**
|
/**
|
||||||
* 削除処理のコントローラ
|
* 削除処理のコントローラ
|
||||||
*
|
*
|
||||||
* @param idDepartment 削除対象のidDepartment
|
* @param idDivision 削除対象のidDivision
|
||||||
* @param model ビューにデータを渡すためのコンテナ
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
* @return 遷移先の画面
|
* @return 遷移先の画面
|
||||||
*/
|
*/
|
||||||
@PermissionCheck
|
@PermissionCheck
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@RequestMapping(value = DELETE_DEPARTMENT, method = RequestMethod.POST)
|
@RequestMapping(value = DELETE_DEPARTMENT, method = RequestMethod.POST)
|
||||||
public String deleteEmployee(@RequestParam("idDepartment") Integer idDepartment, Model model) {
|
public String deleteEmployee(@RequestParam("idDivision") Integer idDivision, Model model) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// 削除処理実施
|
// 削除処理実施
|
||||||
deleteExec(model, idDepartment);
|
deleteExec(model, idDivision);
|
||||||
|
|
||||||
// 部署一覧を取得し、画面に返す用のクラスに詰め替える
|
// 部署一覧を取得し、画面に返す用のクラスに詰め替える
|
||||||
// 作成した部署一覧をセット
|
// 作成した部署一覧をセット
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
DepartmentForm.convertFrom(searchDepartment.selectAll())
|
DepartmentForm.convertFrom(
|
||||||
);
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
|
|
||||||
// 検索画面に遷移
|
// 検索画面に遷移
|
||||||
return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_ALL;
|
return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_ALL;
|
||||||
@@ -98,27 +98,27 @@ public class DeleteDepartmentController {
|
|||||||
* @param model ビューにデータを渡すためのコンテナ
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
* @param idDepartment 削除対象のidDepartment
|
* @param idDepartment 削除対象のidDepartment
|
||||||
*/
|
*/
|
||||||
private void deleteExec(Model model, Integer idDepartment) {
|
private void deleteExec(Model model, Integer idDivision) {
|
||||||
|
|
||||||
final String DELETE_TARGET_ID_CAN_NOT_DELETE = "1名以上が所属している部署は削除出来ません。";
|
final String DELETE_TARGET_ID_CAN_NOT_DELETE = "1名以上が所属している部署は削除出来ません。";
|
||||||
final String DELETE_COMPLETE = "削除しました。";
|
final String DELETE_COMPLETE = "削除しました。";
|
||||||
|
|
||||||
// 1名上所属している人が居れば削除不可
|
// 1名上所属している人が居れば削除不可
|
||||||
if (!searchEmployee.searchEmployeeByIdDepartment(idDepartment).isEmpty()) {
|
if (!searchEmployee.searchEmployeeByIdDepartment(idDivision).isEmpty()) {
|
||||||
// 削除対象だった場合
|
// 削除対象だった場合
|
||||||
// エラーメッセージをセット
|
// エラーメッセージをセット
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DELETE_TARGET_ID_CAN_NOT_DELETE));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR,
|
||||||
|
new MessageForm(DELETE_TARGET_ID_CAN_NOT_DELETE));
|
||||||
// 検索画面に遷移
|
// 検索画面に遷移
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 削除を実施
|
// 削除を実施
|
||||||
deleteDepartment.deleteDepartment(idDepartment);
|
deleteDepartment.deleteDepartment(idDivision);
|
||||||
|
|
||||||
// 削除完了したメッセージをセット
|
// 削除完了したメッセージをセット
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_INFO, new MessageForm(DELETE_COMPLETE));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_INFO, new MessageForm(DELETE_COMPLETE));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,21 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.domain.model.LoginUser;
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
@@ -12,19 +27,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTa
|
|||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.DELETE_EMPLOYEE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 削除処理のコントロータ
|
* 削除処理のコントロータ
|
||||||
@@ -66,14 +68,16 @@ public class DeleteEmployeeController {
|
|||||||
// 作成した部署一覧をセット
|
// 作成した部署一覧をセット
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
DepartmentForm.convertFrom(searchDepartment.selectAll())
|
DepartmentForm.convertFrom(
|
||||||
|
searchDepartment.searchAllDepartmentTable())
|
||||||
);
|
);
|
||||||
|
|
||||||
// 削除処理実施
|
// 削除処理実施
|
||||||
deleteExec(
|
deleteExec(
|
||||||
model,
|
model,
|
||||||
idEmployee,
|
idEmployee,
|
||||||
LoginUserForm.convertTo((LoginUserForm) httpSession.getAttribute(SessionKeyword.LOGIN_USER)));
|
LoginUserForm.convertTo(
|
||||||
|
(LoginUserForm) httpSession.getAttribute(SessionKeyword.LOGIN_USER)));
|
||||||
|
|
||||||
// 検索画面に遷移
|
// 検索画面に遷移
|
||||||
return "forward:" + TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_INFO_FORM_EMPTY;
|
return "forward:" + TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_INFO_FORM_EMPTY;
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.service.impl.LoginImpl;
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
|
||||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
import javax.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 javax.servlet.http.HttpSession;
|
import com.example.rhizome.app.domain.service.impl.LoginImpl;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class IndexController {
|
public class IndexController {
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
@@ -7,21 +21,9 @@ import com.example.rhizome.app.domain.service.SearchDepartment;
|
|||||||
import com.example.rhizome.app.domain.service.impl.SearchDepartmentImpl;
|
import com.example.rhizome.app.domain.service.impl.SearchDepartmentImpl;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
import com.example.rhizome.app.presentation.form.InsertDepartmentForm;
|
import com.example.rhizome.app.presentation.form.InsertDepartmentForm;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_DEPARTMENT_CONFIRM;
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_DEPARTMENT_INPUT_HTML;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新規部署情報チェック用のコントローラ
|
* 新規部署情報チェック用のコントローラ
|
||||||
@@ -41,8 +43,7 @@ public class InsertDepartmentConfirmController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
public InsertDepartmentConfirmController(
|
public InsertDepartmentConfirmController(
|
||||||
HttpSession httpSession,
|
HttpSession httpSession,
|
||||||
SearchDepartmentImpl searchDepartment
|
SearchDepartmentImpl searchDepartment) {
|
||||||
) {
|
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
}
|
}
|
||||||
@@ -64,10 +65,14 @@ public class InsertDepartmentConfirmController {
|
|||||||
@RequestMapping(value = INSERT_DEPARTMENT_CONFIRM, method = RequestMethod.POST)
|
@RequestMapping(value = INSERT_DEPARTMENT_CONFIRM, method = RequestMethod.POST)
|
||||||
public String insertDepartmentConfirm(InsertDepartmentForm insertDepartmentForm, Model model) {
|
public String insertDepartmentConfirm(InsertDepartmentForm insertDepartmentForm, Model model) {
|
||||||
|
|
||||||
final String DUPLICATION = "既に同名の部署が存在します。";
|
final String DUPLICATION = "既に同名の本部名または部または課が存在します。";
|
||||||
final String IRREGULARITY = "部署名が不正です。";
|
final String IRREGULARITY = "本部名または部または課が不正です。";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
model.addAttribute(
|
||||||
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
|
DepartmentForm.convertFrom(
|
||||||
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
|
|
||||||
// 入力内容に誤りがあるか
|
// 入力内容に誤りがあるか
|
||||||
if (insertDepartmentForm.haveNmDepartment()) {
|
if (insertDepartmentForm.haveNmDepartment()) {
|
||||||
@@ -79,12 +84,22 @@ public class InsertDepartmentConfirmController {
|
|||||||
// 登録画面に遷移
|
// 登録画面に遷移
|
||||||
return INSERT_DEPARTMENT_INPUT_HTML;
|
return INSERT_DEPARTMENT_INPUT_HTML;
|
||||||
}
|
}
|
||||||
// 部署名で重複が無いかチェック
|
//重複のチェック用の各部署のSearchConditionDeopartmentを用意
|
||||||
if (!searchDepartment.searchBy(
|
SearchConditionDepartment searchHeadquartersTable = new SearchConditionDepartment(
|
||||||
new SearchConditionDepartment(
|
|
||||||
null,
|
null,
|
||||||
insertDepartmentForm.getNmDepartment())).isEmpty()) {
|
insertDepartmentForm.getNmHeadquarters());
|
||||||
|
SearchConditionDepartment searchDepartmentTable = new SearchConditionDepartment(
|
||||||
|
null,
|
||||||
|
insertDepartmentForm.getNmDepartment());
|
||||||
|
SearchConditionDepartment searchDivisionTable = new SearchConditionDepartment(
|
||||||
|
null,
|
||||||
|
insertDepartmentForm.getNmDivision());
|
||||||
|
|
||||||
|
// 部署の組み合わせで重複が無いかチェック
|
||||||
|
if (searchDepartment.searchAllDepartmentTable(
|
||||||
|
searchHeadquartersTable,
|
||||||
|
searchDepartmentTable,
|
||||||
|
searchDivisionTable)) {
|
||||||
|
|
||||||
// 存在する場合はエラーメッセージを設定して更新入力画面に遷移
|
// 存在する場合はエラーメッセージを設定して更新入力画面に遷移
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
||||||
@@ -98,7 +113,6 @@ public class InsertDepartmentConfirmController {
|
|||||||
// 登録確認画面に遷移
|
// 登録確認画面に遷移
|
||||||
return TransitionTargetPageNameKeyword.INSERT_DEPARTMENT_CONFIRM_HTML;
|
return TransitionTargetPageNameKeyword.INSERT_DEPARTMENT_CONFIRM_HTML;
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// ログイン情報の破棄
|
// ログイン情報の破棄
|
||||||
httpSession.invalidate();
|
httpSession.invalidate();
|
||||||
@@ -112,6 +126,3 @@ public class InsertDepartmentConfirmController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
import java.util.logging.Level;
|
||||||
import com.example.rhizome.app.domain.service.RegisterDepartment;
|
import java.util.logging.Logger;
|
||||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import javax.servlet.http.HttpSession;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
|
||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
|
||||||
import com.example.rhizome.app.presentation.form.InsertDepartmentForm;
|
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
|
||||||
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;
|
||||||
@@ -17,12 +14,19 @@ 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 javax.servlet.http.HttpSession;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import java.util.logging.Level;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import java.util.logging.Logger;
|
import com.example.rhizome.app.domain.model.DepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_DEPARTMENT;
|
import com.example.rhizome.app.domain.service.RegisterDepartment;
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_DEPARTMENT_INPUT_HTML;
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.impl.SearchDepartmentImpl;
|
||||||
|
import com.example.rhizome.app.infra.entity.DivisionEntity;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.InsertDepartmentForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新規登録用のコントローラ
|
* 新規登録用のコントローラ
|
||||||
@@ -30,6 +34,8 @@ import static com.example.rhizome.app.presentation.controller.pageproperty.Trans
|
|||||||
@Controller
|
@Controller
|
||||||
public class InsertDepartmentController {
|
public class InsertDepartmentController {
|
||||||
|
|
||||||
|
private final SearchDepartmentImpl searchDepartmentImpl;
|
||||||
|
|
||||||
// ログ出力用インスタンス
|
// ログ出力用インスタンス
|
||||||
private final static Logger LOGGER = Logger.getLogger(InsertDepartmentController.class.getName());
|
private final static Logger LOGGER = Logger.getLogger(InsertDepartmentController.class.getName());
|
||||||
|
|
||||||
@@ -41,10 +47,12 @@ public class InsertDepartmentController {
|
|||||||
SearchDepartment searchDepartment;
|
SearchDepartment searchDepartment;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public InsertDepartmentController(HttpSession httpSession, RegisterDepartment registerDepartment, SearchDepartment searchDepartment) {
|
public InsertDepartmentController(HttpSession httpSession, RegisterDepartment registerDepartment,
|
||||||
|
SearchDepartment searchDepartment, SearchDepartmentImpl searchDepartmentImpl) {
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.registerDepartment = registerDepartment;
|
this.registerDepartment = registerDepartment;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
|
this.searchDepartmentImpl = searchDepartmentImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModelAttribute
|
@ModelAttribute
|
||||||
@@ -73,8 +81,7 @@ public class InsertDepartmentController {
|
|||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
DepartmentForm.convertFrom(
|
DepartmentForm.convertFrom(
|
||||||
searchDepartment.selectAll()
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
));
|
|
||||||
|
|
||||||
// 入力内容に誤りがあるか
|
// 入力内容に誤りがあるか
|
||||||
if (insertDepartmentForm.haveNmDepartment()) {
|
if (insertDepartmentForm.haveNmDepartment()) {
|
||||||
@@ -86,12 +93,18 @@ public class InsertDepartmentController {
|
|||||||
// 登録画面に遷移
|
// 登録画面に遷移
|
||||||
return INSERT_DEPARTMENT_INPUT_HTML;
|
return INSERT_DEPARTMENT_INPUT_HTML;
|
||||||
}
|
}
|
||||||
// 部署名で重複が無いかチェック
|
|
||||||
if (!searchDepartment.searchBy(
|
|
||||||
new SearchConditionDepartment(
|
|
||||||
null,
|
|
||||||
insertDepartmentForm.getNmDepartment())).isEmpty()) {
|
|
||||||
|
|
||||||
|
// 部署の組み合わせで重複が無いかチェック
|
||||||
|
if (searchDepartment.searchAllDepartmentTable(
|
||||||
|
new SearchConditionDepartment(
|
||||||
|
insertDepartmentForm.getIdHeadquarters(),
|
||||||
|
insertDepartmentForm.getNmHeadquarters()),
|
||||||
|
new SearchConditionDepartment(
|
||||||
|
insertDepartmentForm.getIdDepartment(),
|
||||||
|
insertDepartmentForm.getNmDepartment()),
|
||||||
|
new SearchConditionDepartment(
|
||||||
|
insertDepartmentForm.getIdDivision(),
|
||||||
|
insertDepartmentForm.getNmDivision()))) {
|
||||||
|
|
||||||
// 存在する場合はエラーメッセージを設定して更新入力画面に遷移
|
// 存在する場合はエラーメッセージを設定して更新入力画面に遷移
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
||||||
@@ -99,9 +112,13 @@ public class InsertDepartmentController {
|
|||||||
|
|
||||||
return TransitionTargetPageNameKeyword.INSERT_DEPARTMENT_INPUT_HTML;
|
return TransitionTargetPageNameKeyword.INSERT_DEPARTMENT_INPUT_HTML;
|
||||||
}
|
}
|
||||||
|
//divisionEntityにinsertDepartmentFormで画面から渡ってきた値を入れる
|
||||||
|
DepartmentInfo departmentInfo = InsertDepartmentForm.convertTo(insertDepartmentForm);
|
||||||
|
DivisionEntity divisionEntity = DivisionEntity.convertFrom(departmentInfo);
|
||||||
|
|
||||||
// 登録処理
|
// 登録処理
|
||||||
registerDepartment.registerDepartment(InsertDepartmentForm.convertTo(insertDepartmentForm));
|
registerDepartment.registerDepartment(divisionEntity);
|
||||||
|
|
||||||
// 登録結果画面に遷移
|
// 登録結果画面に遷移
|
||||||
return TransitionTargetPageNameKeyword.INSERT_DEPARTMENT_RESULT_HTML;
|
return TransitionTargetPageNameKeyword.INSERT_DEPARTMENT_RESULT_HTML;
|
||||||
|
|
||||||
@@ -118,6 +135,3 @@ public class InsertDepartmentController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import java.util.logging.Level;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import java.util.logging.Logger;
|
||||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import javax.servlet.http.HttpSession;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
|
||||||
import com.example.rhizome.app.presentation.form.InsertDepartmentForm;
|
|
||||||
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;
|
||||||
@@ -13,9 +12,15 @@ 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 javax.servlet.http.HttpSession;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import java.util.logging.Level;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import java.util.logging.Logger;
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.DepartmentInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.DivisionInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.HeadquartersInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.InsertDepartmentForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登録画面表示用コントローラ
|
* 登録画面表示用コントローラ
|
||||||
@@ -35,8 +40,7 @@ public class InsertDepartmentInputController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
public InsertDepartmentInputController(
|
public InsertDepartmentInputController(
|
||||||
HttpSession httpSession,
|
HttpSession httpSession,
|
||||||
SearchDepartment searchDepartment
|
SearchDepartment searchDepartment) {
|
||||||
) {
|
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
}
|
}
|
||||||
@@ -46,7 +50,6 @@ public class InsertDepartmentInputController {
|
|||||||
return new InsertDepartmentForm();
|
return new InsertDepartmentForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署登録画面表示処理
|
* 部署登録画面表示処理
|
||||||
*
|
*
|
||||||
@@ -60,6 +63,19 @@ public class InsertDepartmentInputController {
|
|||||||
public String insertInput(InsertDepartmentForm insertDepartmentForm, Model model) {
|
public String insertInput(InsertDepartmentForm insertDepartmentForm, Model model) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
//各部署情報を重複魚消して表示するために別々に画面へ送る
|
||||||
|
model.addAttribute(
|
||||||
|
PageReturnAttributeKeyword.HEADQUARTERS_FORM_LIST,
|
||||||
|
HeadquartersInfoForm.convertFrom(
|
||||||
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
|
model.addAttribute(
|
||||||
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
|
DepartmentInfoForm.convertFromTo(
|
||||||
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
|
model.addAttribute(
|
||||||
|
PageReturnAttributeKeyword.DIVISION_FORM_LIST,
|
||||||
|
DivisionInfoForm.convertFromTo(
|
||||||
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
// パラメータをセット
|
// パラメータをセット
|
||||||
model.addAttribute(PageReturnAttributeKeyword.INSERT_DEPARTMENT_FORM, insertDepartmentForm);
|
model.addAttribute(PageReturnAttributeKeyword.INSERT_DEPARTMENT_FORM, insertDepartmentForm);
|
||||||
|
|
||||||
@@ -79,6 +95,3 @@ public class InsertDepartmentInputController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,20 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
@@ -12,19 +27,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTa
|
|||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
import com.example.rhizome.app.presentation.form.InsertEmployeeForm;
|
import com.example.rhizome.app.presentation.form.InsertEmployeeForm;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_CONFIRM;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新規登録者情報チェック用のコントローラ
|
* 新規登録者情報チェック用のコントローラ
|
||||||
@@ -46,8 +48,7 @@ public class InsertEmployeeConfirmController {
|
|||||||
public InsertEmployeeConfirmController(
|
public InsertEmployeeConfirmController(
|
||||||
HttpSession httpSession,
|
HttpSession httpSession,
|
||||||
SearchDepartmentImpl searchDepartment,
|
SearchDepartmentImpl searchDepartment,
|
||||||
SearchEmployeeImpl searchEmployee
|
SearchEmployeeImpl searchEmployee) {
|
||||||
) {
|
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
this.searchEmployee = searchEmployee;
|
this.searchEmployee = searchEmployee;
|
||||||
@@ -76,8 +77,7 @@ public class InsertEmployeeConfirmController {
|
|||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
DepartmentForm.convertFrom(
|
DepartmentForm.convertFrom(
|
||||||
searchDepartment.selectAll()
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
));
|
|
||||||
|
|
||||||
// 登録用パラメータチェック
|
// 登録用パラメータチェック
|
||||||
List<String> error = insertEmployeeForm.validateParameter();
|
List<String> error = insertEmployeeForm.validateParameter();
|
||||||
@@ -86,7 +86,8 @@ public class InsertEmployeeConfirmController {
|
|||||||
if (!error.isEmpty()) {
|
if (!error.isEmpty()) {
|
||||||
// 誤りがあった場合
|
// 誤りがあった場合
|
||||||
// 誤りがあった箇所のエラーメッセージを表示
|
// 誤りがあった箇所のエラーメッセージを表示
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(String.join(", ", error) + "が不正です。"));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR,
|
||||||
|
new MessageForm(String.join(", ", error) + "が不正です。"));
|
||||||
// 画面に返す為の登録情報をセット
|
// 画面に返す為の登録情報をセット
|
||||||
model.addAttribute(PageReturnAttributeKeyword.INSERT_EMPLOYEE_FORM, insertEmployeeForm);
|
model.addAttribute(PageReturnAttributeKeyword.INSERT_EMPLOYEE_FORM, insertEmployeeForm);
|
||||||
// 登録画面に遷移
|
// 登録画面に遷移
|
||||||
@@ -114,7 +115,6 @@ public class InsertEmployeeConfirmController {
|
|||||||
// 登録確認画面に遷移
|
// 登録確認画面に遷移
|
||||||
return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_CONFIRM_HTML;
|
return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_CONFIRM_HTML;
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// ログイン情報の破棄
|
// ログイン情報の破棄
|
||||||
httpSession.invalidate();
|
httpSession.invalidate();
|
||||||
@@ -128,6 +128,3 @@ public class InsertEmployeeConfirmController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
||||||
@@ -11,20 +27,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTa
|
|||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
import com.example.rhizome.app.presentation.form.InsertEmployeeForm;
|
import com.example.rhizome.app.presentation.form.InsertEmployeeForm;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_EMPLOYEE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新規登録用のコントローラ
|
* 新規登録用のコントローラ
|
||||||
@@ -43,7 +45,8 @@ public class InsertEmployeeController {
|
|||||||
SearchDepartment searchDepartment;
|
SearchDepartment searchDepartment;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public InsertEmployeeController(HttpSession httpSession, RegisterEmployeeImpl registerEmployee, SearchDepartmentImpl searchDepartment) {
|
public InsertEmployeeController(HttpSession httpSession, RegisterEmployeeImpl registerEmployee,
|
||||||
|
SearchDepartmentImpl searchDepartment) {
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.registerEmployee = registerEmployee;
|
this.registerEmployee = registerEmployee;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
@@ -72,8 +75,7 @@ public class InsertEmployeeController {
|
|||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
DepartmentForm.convertFrom(
|
DepartmentForm.convertFrom(
|
||||||
searchDepartment.selectAll()
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
));
|
|
||||||
|
|
||||||
// Confirm画面から渡ってきた値をチェック
|
// Confirm画面から渡ってきた値をチェック
|
||||||
List<String> error = validateParameter(
|
List<String> error = validateParameter(
|
||||||
@@ -81,14 +83,15 @@ public class InsertEmployeeController {
|
|||||||
insertEmployeeForm.getKnEmployee(),
|
insertEmployeeForm.getKnEmployee(),
|
||||||
insertEmployeeForm.getMailAddress(),
|
insertEmployeeForm.getMailAddress(),
|
||||||
insertEmployeeForm.getPassword(),
|
insertEmployeeForm.getPassword(),
|
||||||
|
insertEmployeeForm.getHireDate(),
|
||||||
insertEmployeeForm.getAdminAuth(),
|
insertEmployeeForm.getAdminAuth(),
|
||||||
insertEmployeeForm.getIdDepartment()
|
insertEmployeeForm.getIdDivision());
|
||||||
);
|
|
||||||
|
|
||||||
// エラーが1件以上有る場合
|
// エラーが1件以上有る場合
|
||||||
if (!error.isEmpty()) {
|
if (!error.isEmpty()) {
|
||||||
// エラー内容を画面に表示
|
// エラー内容を画面に表示
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(String.join(", ", error) + "が不正です。"));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR,
|
||||||
|
new MessageForm(String.join(", ", error) + "が不正です。"));
|
||||||
// 登録画面に遷移
|
// 登録画面に遷移
|
||||||
return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_INPUT_HTML;
|
return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_INPUT_HTML;
|
||||||
}
|
}
|
||||||
@@ -125,14 +128,15 @@ public class InsertEmployeeController {
|
|||||||
String employeeKana,
|
String employeeKana,
|
||||||
String mailAddress,
|
String mailAddress,
|
||||||
String password,
|
String password,
|
||||||
|
String hireDate,
|
||||||
Integer management,
|
Integer management,
|
||||||
Integer departmentId
|
Integer departmentId) {
|
||||||
) {
|
|
||||||
|
|
||||||
final String EMPLOYEE_NAME_NULL_BLANK = "社員名";
|
final String EMPLOYEE_NAME_NULL_BLANK = "社員名";
|
||||||
final String EMPLOYEE_KANA_NULL_BLANK = "社員名フリガナ";
|
final String EMPLOYEE_KANA_NULL_BLANK = "社員名フリガナ";
|
||||||
final String MAIL_ADDRESS_NULL_BLANK = "メールアドレス";
|
final String MAIL_ADDRESS_NULL_BLANK = "メールアドレス";
|
||||||
final String PASSWORD_NULL_BLANK = "パスワード";
|
final String PASSWORD_NULL_BLANK = "パスワード";
|
||||||
|
final String HIREDATE_NULL_BLANK = "入社年月日";
|
||||||
final String MANAGEMENT_ERROR = "管理者権限指定";
|
final String MANAGEMENT_ERROR = "管理者権限指定";
|
||||||
final String DEPARTMENT_ID_NULL_BLANK = "所属部署";
|
final String DEPARTMENT_ID_NULL_BLANK = "所属部署";
|
||||||
|
|
||||||
@@ -161,6 +165,11 @@ public class InsertEmployeeController {
|
|||||||
// エラー内容を追加
|
// エラー内容を追加
|
||||||
error.add(PASSWORD_NULL_BLANK);
|
error.add(PASSWORD_NULL_BLANK);
|
||||||
}
|
}
|
||||||
|
// null or 空文字判定
|
||||||
|
if (isNullOrBlank(hireDate)) {
|
||||||
|
// エラー内容を追加
|
||||||
|
error.add(HIREDATE_NULL_BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
// 管理者権限の値が不正か
|
// 管理者権限の値が不正か
|
||||||
if (management == null) {
|
if (management == null) {
|
||||||
@@ -193,6 +202,3 @@ public class InsertEmployeeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,33 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
||||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
import com.example.rhizome.app.presentation.form.DepartmentInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.DivisionInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.HeadquartersInfoForm;
|
||||||
import com.example.rhizome.app.presentation.form.InsertEmployeeForm;
|
import com.example.rhizome.app.presentation.form.InsertEmployeeForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_INPUT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登録画面表示用コントローラ
|
* 登録画面表示用コントローラ
|
||||||
@@ -38,7 +46,8 @@ public class InsertEmployeeInputController {
|
|||||||
SearchDepartment searchDepartment;
|
SearchDepartment searchDepartment;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public InsertEmployeeInputController(HttpSession httpSession, RegisterEmployee registerEmployee, SearchDepartment searchDepartment) {
|
public InsertEmployeeInputController(HttpSession httpSession, RegisterEmployee registerEmployee,
|
||||||
|
SearchDepartment searchDepartment) {
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.registerEmployee = registerEmployee;
|
this.registerEmployee = registerEmployee;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
@@ -49,11 +58,10 @@ public class InsertEmployeeInputController {
|
|||||||
return new InsertEmployeeForm();
|
return new InsertEmployeeForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登録画面表示処理
|
* 社員情報登録画面の表示を行う
|
||||||
*
|
*
|
||||||
* @param insertEmployeeForm 登録画面のフォーム
|
* @param InsertEmployeeFormを保持したインスタンス
|
||||||
* @param model ビューにデータを渡すためのコンテナ
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
* @return 遷移先の画面
|
* @return 遷移先の画面
|
||||||
*/
|
*/
|
||||||
@@ -63,8 +71,10 @@ public class InsertEmployeeInputController {
|
|||||||
public String insertInput(InsertEmployeeForm insertEmployeeForm, Model model) {
|
public String insertInput(InsertEmployeeForm insertEmployeeForm, Model model) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// 部署コードリストを作成し、画面に返す値としてセット
|
// 部署コードリストを作成し、画面に返す値としてセット
|
||||||
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(searchDepartment.selectAll()));
|
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, HeadquartersInfoForm.convertFrom(
|
||||||
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
|
|
||||||
// パラメータをセット
|
// パラメータをセット
|
||||||
model.addAttribute(PageReturnAttributeKeyword.INSERT_EMPLOYEE_FORM, insertEmployeeForm);
|
model.addAttribute(PageReturnAttributeKeyword.INSERT_EMPLOYEE_FORM, insertEmployeeForm);
|
||||||
@@ -84,7 +94,50 @@ public class InsertEmployeeInputController {
|
|||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員情報登録画面の部情報のプルダウンの表示を行う
|
||||||
|
*
|
||||||
|
* @param idHeadquarters
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
//画面で本部のプルダウンが選択された時にJSでこのメソッドに飛ぶ
|
||||||
|
@GetMapping("insertEmployeeInput/searchDepartment")
|
||||||
|
@ResponseBody
|
||||||
|
public List<DepartmentInfoForm> departmentsByHeadquarters(
|
||||||
|
@RequestParam("id_headquarters") Integer idHeadquarters) {
|
||||||
|
List<DepartmentInfoForm> departmentByHeadquarters = DepartmentInfoForm.convertFrom(
|
||||||
|
searchDepartment.searchByIdHeadquarters(idHeadquarters));
|
||||||
|
return departmentByHeadquarters
|
||||||
|
.stream()
|
||||||
|
.map(DepartmentInfoForm -> new DepartmentInfoForm(
|
||||||
|
DepartmentInfoForm.getIdDepartment(),
|
||||||
|
DepartmentInfoForm.getNmDepartment()))
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員情報登録画面の課情報のプルダウンの表示を行う
|
||||||
|
*
|
||||||
|
* @param idDepartment
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
//画面で部のプルダウンが選択された時にJSでこのメソッドに飛ぶ
|
||||||
|
@GetMapping("/insertEmployeeInput/searchDepartment/searchDivision")
|
||||||
|
@ResponseBody
|
||||||
|
public List<DivisionInfoForm> divisionBydepartment(
|
||||||
|
@RequestParam("id_department") Integer idDepartment) {
|
||||||
|
List<DivisionInfoForm> divisionByDepartment = DivisionInfoForm.convertFrom(
|
||||||
|
searchDepartment.searchByIdDepartment(idDepartment));
|
||||||
|
return divisionByDepartment
|
||||||
|
.stream()
|
||||||
|
.map(DivisionInfoForm -> new DivisionInfoForm(
|
||||||
|
DivisionInfoForm.getIdDivision(),
|
||||||
|
DivisionInfoForm.getNmDivision()))
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.rhizome.app.domain.model.LoginInfo;
|
import com.example.rhizome.app.domain.model.LoginInfo;
|
||||||
import com.example.rhizome.app.domain.model.LoginUser;
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
@@ -11,18 +24,6 @@ import com.example.rhizome.app.presentation.form.LoginInfoForm;
|
|||||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
import com.example.rhizome.app.presentation.form.UpdatePersonalUserForm;
|
import com.example.rhizome.app.presentation.form.UpdatePersonalUserForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.DO_LOGIN;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ログイン関連のコントローラ
|
* ログイン関連のコントローラ
|
||||||
@@ -70,7 +71,8 @@ public class LoginController {
|
|||||||
if (!LoginUserForm.checkParameter(loginInfoForm)) {
|
if (!LoginUserForm.checkParameter(loginInfoForm)) {
|
||||||
|
|
||||||
// mail,passwordが仕様を満たしていない場合
|
// mail,passwordが仕様を満たしていない場合
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(MAIL_ADDRESS_PASSWORD_ERROR));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR,
|
||||||
|
new MessageForm(MAIL_ADDRESS_PASSWORD_ERROR));
|
||||||
|
|
||||||
// エラーだった場合に login.html に処理を戻す。mailAddress, password を login.htmlに表示するために
|
// エラーだった場合に login.html に処理を戻す。mailAddress, password を login.htmlに表示するために
|
||||||
// ここで addAttribute する
|
// ここで addAttribute する
|
||||||
@@ -104,7 +106,8 @@ public class LoginController {
|
|||||||
if (!loginUser.isAdminUser()) {
|
if (!loginUser.isAdminUser()) {
|
||||||
// 管理者ではない場合直で自分の情報を更新するページに遷移する
|
// 管理者ではない場合直で自分の情報を更新するページに遷移する
|
||||||
// 編集対象のログイン者の情報を画面に渡す値にセット
|
// 編集対象のログイン者の情報を画面に渡す値にセット
|
||||||
model.addAttribute(PageReturnAttributeKeyword.UPDATE_PERSONAL_EMPLOYEE_USER_FORM, UpdatePersonalUserForm.convertFrom(loginUser));
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_PERSONAL_EMPLOYEE_USER_FORM,
|
||||||
|
UpdatePersonalUserForm.convertFrom(loginUser));
|
||||||
// 個人の情報更新ページに遷移
|
// 個人の情報更新ページに遷移
|
||||||
return TransitionTargetPageNameKeyword.UPDATE_PERSONAL_EMPLOYEE_INPUT_HTML;
|
return TransitionTargetPageNameKeyword.UPDATE_PERSONAL_EMPLOYEE_INPUT_HTML;
|
||||||
}
|
}
|
||||||
@@ -142,7 +145,6 @@ public class LoginController {
|
|||||||
// セッションにない場合は画面からの input 値 を取得
|
// セッションにない場合は画面からの input 値 を取得
|
||||||
return new LoginInfo(
|
return new LoginInfo(
|
||||||
loginInfoForm.getMailAddress(),
|
loginInfoForm.getMailAddress(),
|
||||||
loginInfoForm.getPassword()
|
loginInfoForm.getPassword());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import java.util.logging.Level;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
import java.util.logging.Logger;
|
||||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
|
||||||
|
import javax.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;
|
||||||
@@ -12,11 +14,11 @@ 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 javax.servlet.http.HttpSession;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import java.util.logging.Level;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import java.util.logging.Logger;
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.LOGOUT;
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ログアウト処理のコントローラ
|
* ログアウト処理のコントローラ
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* メニュー画面表示用コントローラ
|
* メニュー画面表示用コントローラ
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
@@ -7,16 +19,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAt
|
|||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
import com.example.rhizome.app.presentation.form.SearchConditionDepartmentForm;
|
import com.example.rhizome.app.presentation.form.SearchConditionDepartmentForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
|
* 部署検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
|
||||||
@@ -60,8 +62,11 @@ public class SelectDepartmentController {
|
|||||||
// 作成した部署一覧をセット
|
// 作成した部署一覧をセット
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
DepartmentForm.convertFrom(searchDepartment.searchByWithLike(SearchConditionDepartmentForm.convertTo(searchConditionDepartmentForm)))
|
DepartmentForm.convertFrom(
|
||||||
);
|
searchDepartment.searchAllDepartmentTable(
|
||||||
|
SearchConditionDepartmentForm.convertTo(searchConditionDepartmentForm))
|
||||||
|
|
||||||
|
));
|
||||||
|
|
||||||
// 検索ページに遷移
|
// 検索ページに遷移
|
||||||
return TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_HTML;
|
return TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_HTML;
|
||||||
@@ -92,13 +97,12 @@ public class SelectDepartmentController {
|
|||||||
public String selectAll(Model model) {
|
public String selectAll(Model model) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// 部署一覧を取得し、画面に返す用のクラスに詰め替える
|
// 部署一覧を取得し、画面に返す用のクラスに詰め替える
|
||||||
// 作成した部署一覧をセット
|
// 作成した部署一覧をセット
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
DepartmentForm.convertFrom(searchDepartment.selectAll())
|
DepartmentForm.convertFrom(
|
||||||
);
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
|
|
||||||
// 検索ページに遷移
|
// 検索ページに遷移
|
||||||
return TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_HTML;
|
return TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_HTML;
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import java.util.List;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import java.util.logging.Level;
|
||||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
import java.util.logging.Logger;
|
||||||
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import javax.servlet.http.HttpSession;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
|
||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
|
||||||
import com.example.rhizome.app.presentation.form.EmployeeInfoForm;
|
|
||||||
import com.example.rhizome.app.presentation.form.SearchConditionEmployeeForm;
|
|
||||||
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;
|
||||||
@@ -16,9 +13,16 @@ 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 javax.servlet.http.HttpSession;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import java.util.logging.Level;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import java.util.logging.Logger;
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
||||||
|
import com.example.rhizome.app.domain.service.TenureCalc;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.EmployeeInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.SearchConditionEmployeeForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 社員検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
|
* 社員検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
|
||||||
@@ -34,12 +38,13 @@ public class SelectEmployeeController {
|
|||||||
HttpSession httpSession;
|
HttpSession httpSession;
|
||||||
SearchDepartment searchDepartment;
|
SearchDepartment searchDepartment;
|
||||||
SearchEmployeeInfo searchEmployeeInfo;
|
SearchEmployeeInfo searchEmployeeInfo;
|
||||||
|
TenureCalc tenureCalc;
|
||||||
@Autowired
|
@Autowired
|
||||||
public SelectEmployeeController(HttpSession httpSession, SearchDepartment searchDepartment, SearchEmployeeInfo searchEmployeeInfo) {
|
public SelectEmployeeController(HttpSession httpSession, SearchDepartment searchDepartment, SearchEmployeeInfo searchEmployeeInfo ,TenureCalc tenureCalc) {
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
this.searchEmployeeInfo = searchEmployeeInfo;
|
this.searchEmployeeInfo = searchEmployeeInfo;
|
||||||
|
this.tenureCalc = tenureCalc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModelAttribute
|
@ModelAttribute
|
||||||
@@ -65,13 +70,23 @@ public class SelectEmployeeController {
|
|||||||
// 作成した部署一覧をセット
|
// 作成した部署一覧をセット
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
DepartmentForm.convertFrom(searchDepartment.selectAll())
|
DepartmentForm.convertFrom(
|
||||||
|
searchDepartment.searchAllDepartmentTable())
|
||||||
);
|
);
|
||||||
|
|
||||||
// 検索条件を元に検索を実施
|
// 検索条件を元に検索を実施
|
||||||
// 取得した EmployeeInfo( employee + department )の情報を画面に返す用の型に詰め替えてセット
|
// 取得した EmployeeInfo( employee + department )の情報を画面に返す用の型に詰め替えてセット
|
||||||
model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST, EmployeeInfoForm.convertFrom(searchEmployeeInfo.searchBy(SearchConditionEmployeeForm.convertTo(searchConditionEmployeeForm))));
|
//プラスで勤続年数を計算してformにセット
|
||||||
|
|
||||||
|
List<EmployeeInfoForm>employeeInfoForm = EmployeeInfoForm.convertFrom(
|
||||||
|
searchEmployeeInfo.searchBy(
|
||||||
|
SearchConditionEmployeeForm.convertTo(searchConditionEmployeeForm)));
|
||||||
|
for(EmployeeInfoForm form:employeeInfoForm) {
|
||||||
|
String tenure = tenureCalc.tenureCalc(form.getHireDate());
|
||||||
|
form.setTenure(tenure);
|
||||||
|
}
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST, employeeInfoForm);
|
||||||
// 検索ページに遷移
|
// 検索ページに遷移
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_HTML;
|
return TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_HTML;
|
||||||
|
|
||||||
|
|
||||||
@@ -105,15 +120,19 @@ public class SelectEmployeeController {
|
|||||||
// 作成した部署一覧をセット
|
// 作成した部署一覧をセット
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
DepartmentForm.convertFrom(searchDepartment.selectAll())
|
DepartmentForm.convertFrom(
|
||||||
|
searchDepartment.searchAllDepartmentTable())
|
||||||
);
|
);
|
||||||
|
|
||||||
// 検索条件を元に検索を実施
|
// 検索条件を元に検索を実施
|
||||||
model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST,
|
List<EmployeeInfoForm>employeeInfoForm =EmployeeInfoForm.convertFrom(
|
||||||
EmployeeInfoForm.convertFrom(
|
searchEmployeeInfo.selectAll());
|
||||||
searchEmployeeInfo.searchBy(
|
for(EmployeeInfoForm form:employeeInfoForm) {
|
||||||
SearchConditionEmployeeForm.convertTo(searchConditionEmployeeForm())
|
String tenure = tenureCalc.tenureCalc(form.getHireDate());
|
||||||
)));
|
form.setTenure(tenure);
|
||||||
|
}
|
||||||
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST,employeeInfoForm);
|
||||||
|
|
||||||
// 検索ページに遷移
|
// 検索ページに遷移
|
||||||
return TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_HTML;
|
return TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_HTML;
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import java.util.List;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import java.util.logging.Level;
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import java.util.logging.Logger;
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
|
||||||
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
import javax.servlet.http.HttpSession;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
|
||||||
import com.example.rhizome.app.presentation.form.SearchConditionEmployeeForm;
|
|
||||||
import com.example.rhizome.app.presentation.form.UpdateDepartmentForm;
|
|
||||||
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;
|
||||||
@@ -18,10 +14,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import java.util.List;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import java.util.logging.Level;
|
import com.example.rhizome.app.domain.model.AllDepartmentInfo;
|
||||||
import java.util.logging.Logger;
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.SearchConditionEmployeeForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.UpdateDepartmentForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新対象の Department が存在するか確認する為のコントローラ
|
* 更新対象の Department が存在するか確認する為のコントローラ
|
||||||
@@ -59,24 +61,24 @@ public class UpdateDepartmentController {
|
|||||||
@PermissionCheck
|
@PermissionCheck
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@RequestMapping(value = TransitionTargetPageNameKeyword.SHOW_UPDATE_DEPARTMENT, method = RequestMethod.POST)
|
@RequestMapping(value = TransitionTargetPageNameKeyword.SHOW_UPDATE_DEPARTMENT, method = RequestMethod.POST)
|
||||||
public String showUpdateEmployee(@RequestParam("idDepartment") Integer idDepartment, Model model) {
|
public String showUpdateEmployee(@RequestParam("idDivision") Integer idDivision, Model model) {
|
||||||
final String UPDATE_TARGET_ID_NOT_FOUND = "更新対象のデータが見つかりません。";
|
final String UPDATE_TARGET_ID_NOT_FOUND = "更新対象のデータが見つかりません。";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// id を条件に更新対象のレコードを検索、取得する
|
// id を条件に更新対象のレコードを検索、取得する
|
||||||
List<Department> departmentList = searchDepartment.searchBy(
|
List<AllDepartmentInfo>divisionList = searchDepartment.searchAllDepartmentTable(
|
||||||
new SearchConditionDepartment(idDepartment,
|
new SearchConditionDepartment(idDivision,
|
||||||
null));
|
null));
|
||||||
|
|
||||||
// DBに更新対象のデータがあるか
|
// DBに更新対象のデータがあるか
|
||||||
if (departmentList.isEmpty()) {
|
if (divisionList.isEmpty()) {
|
||||||
// ない場合はエラーメッセージをセットして検索画面に戻る
|
// ない場合はエラーメッセージをセットして検索画面に戻る
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(UPDATE_TARGET_ID_NOT_FOUND));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(UPDATE_TARGET_ID_NOT_FOUND));
|
||||||
return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_HTML;
|
return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新画面に表示する値をセット
|
// 更新画面に表示する値をセット
|
||||||
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM, UpdateDepartmentForm.convertFrom(departmentList.get(0)));
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM, UpdateDepartmentForm.convertFrom(divisionList.get(0)));
|
||||||
|
|
||||||
// Update画面に遷移
|
// Update画面に遷移
|
||||||
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
||||||
|
|||||||
@@ -1,8 +1,23 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import com.example.rhizome.app.domain.model.Division;
|
||||||
|
import com.example.rhizome.app.domain.model.Headquarters;
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
import com.example.rhizome.app.domain.service.UpdateDepartment;
|
import com.example.rhizome.app.domain.service.UpdateDepartment;
|
||||||
@@ -11,16 +26,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTa
|
|||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
import com.example.rhizome.app.presentation.form.UpdateDepartmentForm;
|
import com.example.rhizome.app.presentation.form.UpdateDepartmentForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* department を更新して結果を返す為のコントローラ
|
* department を更新して結果を返す為のコントローラ
|
||||||
@@ -38,7 +43,8 @@ public class UpdateDepartmentResultController {
|
|||||||
UpdateDepartment updateDepartment;
|
UpdateDepartment updateDepartment;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public UpdateDepartmentResultController(HttpSession httpSession, SearchDepartment searchDepartment, UpdateDepartment updateDepartment) {
|
public UpdateDepartmentResultController(HttpSession httpSession, SearchDepartment searchDepartment,
|
||||||
|
UpdateDepartment updateDepartment) {
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
this.updateDepartment = updateDepartment;
|
this.updateDepartment = updateDepartment;
|
||||||
@@ -62,18 +68,75 @@ public class UpdateDepartmentResultController {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// 更新対象の部署データがない
|
// 更新対象の部署データがない
|
||||||
if (updateDepartmentForm.getNmDepartment().isBlank()) {
|
if (updateDepartmentForm.getNmHeadquarters().isBlank() ||
|
||||||
|
updateDepartmentForm.getNmDepartment().isBlank() ||
|
||||||
|
updateDepartmentForm.getNmDivision().isBlank()) {
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(NOTHING));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(NOTHING));
|
||||||
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM, updateDepartmentForm);
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM, updateDepartmentForm);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 部署名で重複が無いかチェック
|
// 部署名で重複が無いかチェック
|
||||||
if (!searchDepartment.searchBy(
|
List<Headquarters> beforeHeadquartersList = searchDepartment
|
||||||
|
.searchHeadquartersByIdHeadquarters(updateDepartmentForm.getIdHeadquarters());
|
||||||
|
List<Department> beforeDepartmentList = searchDepartment
|
||||||
|
.searchDepartmentByIdDepartment(updateDepartmentForm.getIdDepartment());
|
||||||
|
List<Division> beforeDivisionList = searchDepartment
|
||||||
|
.searchDivisionByIdDivision(updateDepartmentForm.getIdDivision());
|
||||||
|
|
||||||
|
Headquarters beforeHeadquarters = beforeHeadquartersList.get(0);
|
||||||
|
Department beforeDepartment = beforeDepartmentList.get(0);
|
||||||
|
Division beforeDivision = beforeDivisionList.get(0);
|
||||||
|
|
||||||
|
Headquarters afterHeadquarters = new Headquarters(
|
||||||
|
updateDepartmentForm.getIdHeadquarters(),
|
||||||
|
updateDepartmentForm.getNmHeadquarters(),
|
||||||
|
null);
|
||||||
|
Department afterDepartment = new Department(
|
||||||
|
updateDepartmentForm.getIdDepartment(),
|
||||||
|
updateDepartmentForm.getNmDepartment(),
|
||||||
|
null,
|
||||||
|
updateDepartmentForm.getIdHeadquarters());
|
||||||
|
Division afterDivision = new Division(
|
||||||
|
updateDepartmentForm.getIdDivision(),
|
||||||
|
updateDepartmentForm.getNmDivision(),
|
||||||
|
null,
|
||||||
|
updateDepartmentForm.getIdDepartment());
|
||||||
|
|
||||||
|
if (searchDepartment.searchAllDepartmentTable(
|
||||||
|
new SearchConditionDepartment(
|
||||||
|
updateDepartmentForm.getIdHeadquarters(),
|
||||||
|
updateDepartmentForm.getNmHeadquarters()),
|
||||||
|
new SearchConditionDepartment(
|
||||||
|
updateDepartmentForm.getIdDepartment(),
|
||||||
|
updateDepartmentForm.getNmDepartment()),
|
||||||
|
new SearchConditionDepartment(
|
||||||
|
updateDepartmentForm.getIdDivision(),
|
||||||
|
updateDepartmentForm.getNmDivision()))
|
||||||
|
|
||||||
|
|| (!beforeHeadquarters.getNmHeadquarters().equals(afterHeadquarters.getNmHeadquarters())
|
||||||
|
&&
|
||||||
|
!searchDepartment.searchByHeadquarters(
|
||||||
new SearchConditionDepartment(
|
new SearchConditionDepartment(
|
||||||
null,
|
null,
|
||||||
updateDepartmentForm.getNmDepartment())).isEmpty()) {
|
updateDepartmentForm.getNmHeadquarters()))
|
||||||
|
.isEmpty())
|
||||||
|
|| (!beforeDepartment.getNmDepartment().equals(afterDepartment.getNmDepartment())
|
||||||
|
&&
|
||||||
|
!searchDepartment.searchByDepartment(
|
||||||
|
new SearchConditionDepartment(
|
||||||
|
null,
|
||||||
|
updateDepartmentForm.getNmDepartment()))
|
||||||
|
.isEmpty())
|
||||||
|
|| (!beforeDivision.getNmDivision().equals(afterDivision.getNmDivision())
|
||||||
|
&&
|
||||||
|
!searchDepartment.searchByDivision(
|
||||||
|
new SearchConditionDepartment(
|
||||||
|
null,
|
||||||
|
updateDepartmentForm.getNmDivision()))
|
||||||
|
.isEmpty())
|
||||||
|
|
||||||
|
) {
|
||||||
// 存在する場合はエラーメッセージを設定して更新入力画面に遷移
|
// 存在する場合はエラーメッセージを設定して更新入力画面に遷移
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
||||||
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM, updateDepartmentForm);
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM, updateDepartmentForm);
|
||||||
@@ -85,14 +148,14 @@ public class UpdateDepartmentResultController {
|
|||||||
updateDepartment.updateDepartment(UpdateDepartmentForm.convertTo(updateDepartmentForm));
|
updateDepartment.updateDepartment(UpdateDepartmentForm.convertTo(updateDepartmentForm));
|
||||||
|
|
||||||
// 部署一覧取得
|
// 部署一覧取得
|
||||||
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(searchDepartment.selectAll()));
|
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(
|
||||||
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
// 更新結果のメッセージを画面にセットし一覧画面に遷移
|
// 更新結果のメッセージを画面にセットし一覧画面に遷移
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_INFO, new MessageForm(UPDATE_COMPLETE));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_INFO, new MessageForm(UPDATE_COMPLETE));
|
||||||
|
|
||||||
// forward 先で不用意な動作をしないために UpdateEmployeeInfoForm をクリア
|
// forward 先で不用意な動作をしないために UpdateEmployeeInfoForm をクリア
|
||||||
return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_ALL;
|
return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_ALL;
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// ログイン情報の破棄
|
// ログイン情報の破棄
|
||||||
httpSession.invalidate();
|
httpSession.invalidate();
|
||||||
|
|||||||
@@ -1,29 +1,38 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import java.util.List;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import java.util.logging.Level;
|
||||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
import java.util.logging.Logger;
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
|
||||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
import javax.servlet.http.HttpSession;
|
||||||
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
|
||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
|
||||||
import com.example.rhizome.app.presentation.form.SearchConditionEmployeeForm;
|
|
||||||
import com.example.rhizome.app.presentation.form.UpdateEmployeeInfoForm;
|
|
||||||
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.GetMapping;
|
||||||
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 org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import java.util.List;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import java.util.logging.Level;
|
import com.example.rhizome.app.domain.model.AllDepartmentInfo;
|
||||||
import java.util.logging.Logger;
|
import com.example.rhizome.app.domain.model.AllEmployeeInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.DepartmentInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.DivisionInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.HeadquartersInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.SearchConditionEmployeeForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.UpdateEmployeeInfoForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新対象の employee が存在するか確認する為のコントローラ
|
* 更新対象の employee が存在するか確認する為のコントローラ
|
||||||
@@ -39,12 +48,15 @@ public class UpdateEmployeeController {
|
|||||||
HttpSession httpSession;
|
HttpSession httpSession;
|
||||||
SearchDepartment searchDepartment;
|
SearchDepartment searchDepartment;
|
||||||
SearchEmployeeInfo searchEmployeeInfo;
|
SearchEmployeeInfo searchEmployeeInfo;
|
||||||
|
RegisterEmployee registerEmployee;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public UpdateEmployeeController(HttpSession httpSession, SearchDepartment searchDepartment, SearchEmployeeInfo searchEmployeeInfo) {
|
public UpdateEmployeeController(HttpSession httpSession, SearchDepartment searchDepartment,
|
||||||
|
SearchEmployeeInfo searchEmployeeInfo, RegisterEmployee registerEmployee) {
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
this.searchEmployeeInfo = searchEmployeeInfo;
|
this.searchEmployeeInfo = searchEmployeeInfo;
|
||||||
|
this.registerEmployee = registerEmployee;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModelAttribute
|
@ModelAttribute
|
||||||
@@ -66,11 +78,11 @@ public class UpdateEmployeeController {
|
|||||||
final String UPDATE_TARGET_ID_NOT_FOUND = "更新対象のデータが見つかりません。";
|
final String UPDATE_TARGET_ID_NOT_FOUND = "更新対象のデータが見つかりません。";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 部署一覧を取得し画面に返す値としてセット
|
// 部署コードリストを作成し、画面に返す値としてセット
|
||||||
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(searchDepartment.selectAll()));
|
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, HeadquartersInfoForm.convertFrom(
|
||||||
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
// id を条件に更新対象のレコードを検索、取得する
|
// id を条件に更新対象のレコードを検索、取得する
|
||||||
List<EmployeeInfo> employeeInfoList = searchEmployeeInfo.searchBy(
|
List<AllEmployeeInfo> employeeInfoList = searchEmployeeInfo.searchBy(
|
||||||
new SearchConditionEmployee(idEmployee,
|
new SearchConditionEmployee(idEmployee,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@@ -80,17 +92,26 @@ public class UpdateEmployeeController {
|
|||||||
// DBに更新対象のデータがあるか
|
// DBに更新対象のデータがあるか
|
||||||
if (employeeInfoList.isEmpty()) {
|
if (employeeInfoList.isEmpty()) {
|
||||||
// ない場合はエラーメッセージをセットして検索画面に戻る
|
// ない場合はエラーメッセージをセットして検索画面に戻る
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(UPDATE_TARGET_ID_NOT_FOUND));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR,
|
||||||
|
new MessageForm(UPDATE_TARGET_ID_NOT_FOUND));
|
||||||
return "forward:" + TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_INFO;
|
return "forward:" + TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_INFO;
|
||||||
}
|
}
|
||||||
|
//idDivisionからidHeadquartersを調べてUpdateEmployeeInfoFormに入れる
|
||||||
|
UpdateEmployeeInfoForm updateInfo = UpdateEmployeeInfoForm.convertFrom(employeeInfoList.get(0));
|
||||||
|
SearchConditionDepartment beforeUpdate = new SearchConditionDepartment(
|
||||||
|
updateInfo.getIdDivision(),
|
||||||
|
null);
|
||||||
|
List<AllDepartmentInfo> afterSearchDepartment = searchDepartment.searchAllDepartmentTable(beforeUpdate);
|
||||||
|
|
||||||
|
updateInfo.setIdHeadquarters(afterSearchDepartment.get(0).getHeadquarters().getIdHeadquarters());
|
||||||
|
|
||||||
// 更新画面に遷移
|
// 更新画面に遷移
|
||||||
model.addAttribute(PageReturnAttributeKeyword.UPDATE_EMPLOYEE_INFO_FORM, UpdateEmployeeInfoForm.convertFrom(employeeInfoList.get(0)));
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_EMPLOYEE_INFO_FORM,
|
||||||
|
updateInfo);
|
||||||
|
|
||||||
// Update画面に遷移
|
// Update画面に遷移
|
||||||
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// ログイン情報の破棄
|
// ログイン情報の破棄
|
||||||
httpSession.invalidate();
|
httpSession.invalidate();
|
||||||
@@ -104,4 +125,50 @@ public class UpdateEmployeeController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員情報更新画面の部情報のプルダウンの表示を行う
|
||||||
|
*
|
||||||
|
* @param idHeadquarters
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
//画面で本部のプルダウンが選択された時にJSでこのメソッドに飛ぶ
|
||||||
|
@GetMapping("updateEmployeeInput/searchDepartment")
|
||||||
|
@ResponseBody
|
||||||
|
public List<DepartmentInfoForm> departmentsByHeadquarters(
|
||||||
|
@RequestParam("id_headquarters") Integer idHeadquarters) {
|
||||||
|
List<DepartmentInfoForm> departmentByHeadquarters = DepartmentInfoForm.convertFrom(
|
||||||
|
searchDepartment.searchByIdHeadquarters(idHeadquarters));
|
||||||
|
return departmentByHeadquarters
|
||||||
|
.stream()
|
||||||
|
.map(DepartmentInfoForm -> new DepartmentInfoForm(
|
||||||
|
DepartmentInfoForm.getIdDepartment(),
|
||||||
|
DepartmentInfoForm.getNmDepartment()))
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員情報更新画面の課情報のプルダウンの表示を行う
|
||||||
|
*
|
||||||
|
* @param idDepartment
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
//画面で部のプルダウンが選択された時にJSでこのメソッドに飛ぶ
|
||||||
|
@GetMapping("/updateEmployeeInput/searchDepartment/searchDivision")
|
||||||
|
@ResponseBody
|
||||||
|
public List<DivisionInfoForm> divisionBydepartment(
|
||||||
|
@RequestParam("id_department") Integer idDepartment) {
|
||||||
|
List<DivisionInfoForm> divisionByDepartment = DivisionInfoForm.convertFrom(
|
||||||
|
searchDepartment.searchByIdDepartment(idDepartment));
|
||||||
|
return divisionByDepartment
|
||||||
|
.stream()
|
||||||
|
.map(DivisionInfoForm -> new DivisionInfoForm(
|
||||||
|
DivisionInfoForm.getIdDivision(),
|
||||||
|
DivisionInfoForm.getNmDivision()))
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,20 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
@@ -15,18 +29,6 @@ import com.example.rhizome.app.presentation.form.DepartmentForm;
|
|||||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
import com.example.rhizome.app.presentation.form.UpdateEmployeeInfoForm;
|
import com.example.rhizome.app.presentation.form.UpdateEmployeeInfoForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* employee を更新して結果を返す為のコントローラ
|
* employee を更新して結果を返す為のコントローラ
|
||||||
@@ -91,7 +93,8 @@ public class UpdateEmployeeResultController {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
// 部署一覧取得
|
// 部署一覧取得
|
||||||
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(searchDepartment.selectAll()));
|
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(
|
||||||
|
searchDepartment.searchAllDepartmentTable()));
|
||||||
|
|
||||||
// パスワードが仕様を満たしているか確認
|
// パスワードが仕様を満たしているか確認
|
||||||
String error = UpdateEmployeeInfoForm.validatePassword(
|
String error = UpdateEmployeeInfoForm.validatePassword(
|
||||||
@@ -148,7 +151,11 @@ public class UpdateEmployeeResultController {
|
|||||||
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//勤続年数は更新対象ではないのでそのまま移し替える
|
||||||
|
updateEmployeeInfoForm.setHireDate(beforeEmployee.getHireDate());
|
||||||
|
|
||||||
// 画面用の型からビジネスロジック用のモデルに変換し、Updateを実行
|
// 画面用の型からビジネスロジック用のモデルに変換し、Updateを実行
|
||||||
|
|
||||||
updateEmployee.updateEmployee(beforeEmployee, UpdateEmployeeInfoForm.convertTo(updateEmployeeInfoForm));
|
updateEmployee.updateEmployee(beforeEmployee, UpdateEmployeeInfoForm.convertTo(updateEmployeeInfoForm));
|
||||||
|
|
||||||
// Update後の情報を再取得
|
// Update後の情報を再取得
|
||||||
|
|||||||
@@ -1,6 +1,20 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.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.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
@@ -12,18 +26,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTa
|
|||||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
import com.example.rhizome.app.presentation.form.UpdatePersonalUserForm;
|
import com.example.rhizome.app.presentation.form.UpdatePersonalUserForm;
|
||||||
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 javax.servlet.http.HttpSession;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 個人情報更新用コントローラ
|
* 個人情報更新用コントローラ
|
||||||
@@ -134,11 +136,15 @@ public class UpdatePersonalEmployeeResultController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//更新前のEmployeeの情報を取得
|
//更新前のEmployeeの情報を取得
|
||||||
|
Employee beforeEmployee =searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee());
|
||||||
|
|
||||||
|
updatePersonalUserForm.setHireDate(beforeEmployee.getHireDate());
|
||||||
|
|
||||||
// 画面用のインスタンスから更新用のインスタンスに変換し、Update実施
|
// 画面用のインスタンスから更新用のインスタンスに変換し、Update実施
|
||||||
updateEmployee.updateEmployee(
|
updateEmployee.updateEmployee(
|
||||||
searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee()),
|
beforeEmployee,
|
||||||
UpdatePersonalUserForm.convertTo(updatePersonalUserForm)
|
UpdatePersonalUserForm.convertTo(updatePersonalUserForm))
|
||||||
);
|
;
|
||||||
|
|
||||||
// ログイン者の情報をセッション情報に格納
|
// ログイン者の情報をセッション情報に格納
|
||||||
httpSession.setAttribute(
|
httpSession.setAttribute(
|
||||||
|
|||||||
@@ -16,5 +16,7 @@ public class PageReturnAttributeKeyword {
|
|||||||
public static final String LOGIN_INFO_FORM = "loginInfoForm";
|
public static final String LOGIN_INFO_FORM = "loginInfoForm";
|
||||||
public static final String UPDATE_PERSONAL_EMPLOYEE_USER_FORM = "updatePersonalEmployeeUserForm";
|
public static final String UPDATE_PERSONAL_EMPLOYEE_USER_FORM = "updatePersonalEmployeeUserForm";
|
||||||
public static final String EMPLOYEE_INFO_FORM_LIST = "employeeInfoFormList";
|
public static final String EMPLOYEE_INFO_FORM_LIST = "employeeInfoFormList";
|
||||||
|
public static final String HEADQUARTERS_FORM_LIST = "headquartersFormList";
|
||||||
|
public static final String DIVISION_FORM_LIST = "divisionFormList";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.AllDepartmentInfo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面の表示に使う部署コード管理用のクラス
|
* 画面の表示に使う部署コード管理用のクラス
|
||||||
*/
|
*/
|
||||||
@@ -15,14 +16,29 @@ import java.util.List;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class DepartmentForm {
|
public class DepartmentForm {
|
||||||
/**
|
/**
|
||||||
* 部署ID
|
* 本部ID
|
||||||
|
*/
|
||||||
|
private Integer idHeadquarters;
|
||||||
|
/**
|
||||||
|
* 本部名
|
||||||
|
*/
|
||||||
|
private String nmHeadquarters;
|
||||||
|
/**
|
||||||
|
* 部ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
/**
|
/**
|
||||||
* 部署名
|
* 部名
|
||||||
*/
|
*/
|
||||||
private String nmDepartment;
|
private String nmDepartment;
|
||||||
|
/**
|
||||||
|
* 課ID
|
||||||
|
*/
|
||||||
|
private Integer idDivision;
|
||||||
|
/**
|
||||||
|
* 課名
|
||||||
|
*/
|
||||||
|
private String nmDivision;
|
||||||
/**
|
/**
|
||||||
* business 層の Department クラスから画面用(presentation 層)の DepartmentForm に
|
* business 層の Department クラスから画面用(presentation 層)の DepartmentForm に
|
||||||
* 変換します。
|
* 変換します。
|
||||||
@@ -30,8 +46,15 @@ public class DepartmentForm {
|
|||||||
* @param department business 層の Department インスタンス
|
* @param department business 層の Department インスタンス
|
||||||
* @return 画面用(presentation 層)の DepartmentForm インスタンス
|
* @return 画面用(presentation 層)の DepartmentForm インスタンス
|
||||||
*/
|
*/
|
||||||
public static DepartmentForm convertFrom(Department department) {
|
public static DepartmentForm convertFrom(AllDepartmentInfo allDepartmentInfo) {
|
||||||
return new DepartmentForm(department.getIdDepartment(), department.getNmDepartment());
|
return new DepartmentForm(
|
||||||
|
allDepartmentInfo.getHeadquarters().getIdHeadquarters(),
|
||||||
|
allDepartmentInfo.getHeadquarters().getNmHeadquarters(),
|
||||||
|
allDepartmentInfo.getDepartment().getIdDepartment(),
|
||||||
|
allDepartmentInfo.getDepartment().getNmDepartment(),
|
||||||
|
allDepartmentInfo.getDivision().getIdDivision(),
|
||||||
|
allDepartmentInfo.getDivision().getNmDivision()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +64,8 @@ public class DepartmentForm {
|
|||||||
* @param departmentList business 層の Department インスタンスのリスト
|
* @param departmentList business 層の Department インスタンスのリスト
|
||||||
* @return 画面用(presentation 層)の DepartmentForm インスタンスのリスト
|
* @return 画面用(presentation 層)の DepartmentForm インスタンスのリスト
|
||||||
*/
|
*/
|
||||||
public static List<DepartmentForm> convertFrom(List<Department> departmentList) {
|
public static List<DepartmentForm> convertFrom(List<AllDepartmentInfo>allDepartmentInfoList
|
||||||
return departmentList.stream().map(DepartmentForm::convertFrom).toList();
|
) {
|
||||||
|
return allDepartmentInfoList.stream().map(DepartmentForm::convertFrom).distinct().toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.AllDepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DepartmentInfoForm {
|
||||||
|
/**
|
||||||
|
* 部ID
|
||||||
|
*/
|
||||||
|
|
||||||
|
private Integer idDepartment;
|
||||||
|
/**
|
||||||
|
* 部名
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String nmDepartment;
|
||||||
|
|
||||||
|
|
||||||
|
public static DepartmentInfoForm convertFrom(Department department) {
|
||||||
|
return new DepartmentInfoForm(
|
||||||
|
department.getIdDepartment(),
|
||||||
|
department.getNmDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public static List<DepartmentInfoForm> convertFrom(List<Department>DepartmentList
|
||||||
|
) {
|
||||||
|
return DepartmentList.stream().map(DepartmentInfoForm::convertFrom).toList();
|
||||||
|
}
|
||||||
|
public static DepartmentInfoForm convertFrom(AllDepartmentInfo allDepartmentInfo) {
|
||||||
|
return new DepartmentInfoForm(
|
||||||
|
allDepartmentInfo.getDepartment().getIdDepartment(),
|
||||||
|
allDepartmentInfo.getDepartment().getNmDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public static List<DepartmentInfoForm> convertFromTo(List<AllDepartmentInfo>AllDepartmentInfoList
|
||||||
|
) {
|
||||||
|
return AllDepartmentInfoList.stream().map(DepartmentInfoForm::convertFrom).distinct().toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.AllDepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.Division;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DivisionInfoForm {
|
||||||
|
/**
|
||||||
|
* 課ID
|
||||||
|
*/
|
||||||
|
private Integer idDivision;
|
||||||
|
/**
|
||||||
|
* 課名
|
||||||
|
*/
|
||||||
|
private String nmDivision;
|
||||||
|
|
||||||
|
|
||||||
|
public static DivisionInfoForm convertFrom(Division division) {
|
||||||
|
return new DivisionInfoForm(
|
||||||
|
division.getIdDivision(),
|
||||||
|
division.getNmDivision()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public static List<DivisionInfoForm> convertFrom(List<Division>divisionList
|
||||||
|
) {
|
||||||
|
return divisionList.stream().map(DivisionInfoForm::convertFrom).toList();
|
||||||
|
}
|
||||||
|
public static DivisionInfoForm convertFrom(AllDepartmentInfo allDepartmentInfo) {
|
||||||
|
return new DivisionInfoForm(
|
||||||
|
allDepartmentInfo.getDivision().getIdDivision(),
|
||||||
|
allDepartmentInfo.getDivision().getNmDivision()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public static List<DivisionInfoForm> convertFromTo(List<AllDepartmentInfo>AllDepartmentInfoList
|
||||||
|
) {
|
||||||
|
return AllDepartmentInfoList.stream().map(DivisionInfoForm::convertFrom).distinct().toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.AllEmployeeInfo;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面に表示するために employee と department を Join した構造を扱うクラス
|
* 画面に表示するために employee と department を Join した構造を扱うクラス
|
||||||
*/
|
*/
|
||||||
@@ -37,46 +37,73 @@ public class EmployeeInfoForm {
|
|||||||
*/
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
/**
|
/**
|
||||||
* パスワード
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private String hireDate;
|
||||||
|
/**
|
||||||
|
* 勤続年数
|
||||||
|
*/
|
||||||
|
private String tenure;
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
private Integer adminAuth;
|
private Integer adminAuth;
|
||||||
/**
|
/**
|
||||||
* 部署ID
|
* 本部ID
|
||||||
|
*/
|
||||||
|
private Integer idHeadquarters;
|
||||||
|
/**
|
||||||
|
* 本部名
|
||||||
|
*/
|
||||||
|
private String nmHeadquarters;
|
||||||
|
/**
|
||||||
|
* 部ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
/**
|
/**
|
||||||
* 部署名
|
* 部名
|
||||||
*/
|
*/
|
||||||
private String nmDepartment;
|
private String nmDepartment;
|
||||||
|
/**
|
||||||
|
* 課ID
|
||||||
|
*/
|
||||||
|
private Integer idDivision;
|
||||||
|
/**
|
||||||
|
* 課名
|
||||||
|
*/
|
||||||
|
private String nmDivision;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の EmployeeInfo クラスから画面用(presentation 層)の EmployeeInfoForm に
|
* AllEmployeeInfo からEmployeeInfoForm に変換します。
|
||||||
* 変換します。
|
|
||||||
*
|
*
|
||||||
* @param employeeInfo business 層の EmployeeInfo インスタンス
|
* @param allEmployeeInfo AllEmployeeInfo インスタンス
|
||||||
* @return クラスから画面用(presentation 層)の EmployeeInfoForm インスタンス
|
* @return EmployeeInfoForm インスタンス
|
||||||
*/
|
*/
|
||||||
public static EmployeeInfoForm convertFrom(EmployeeInfo employeeInfo) {
|
public static EmployeeInfoForm convertFrom(AllEmployeeInfo allEmployeeInfo) {
|
||||||
return new EmployeeInfoForm(
|
return new EmployeeInfoForm(
|
||||||
employeeInfo.getEmployee().getIdEmployee(),
|
allEmployeeInfo.getEmployee().getIdEmployee(),
|
||||||
employeeInfo.getEmployee().getNmEmployee(),
|
allEmployeeInfo.getEmployee().getNmEmployee(),
|
||||||
employeeInfo.getEmployee().getKnEmployee(),
|
allEmployeeInfo.getEmployee().getKnEmployee(),
|
||||||
employeeInfo.getEmployee().getMailAddress(),
|
allEmployeeInfo.getEmployee().getMailAddress(),
|
||||||
employeeInfo.getEmployee().getPassword(),
|
allEmployeeInfo.getEmployee().getPassword(),
|
||||||
employeeInfo.getEmployee().getAdminAuth(),
|
allEmployeeInfo.getEmployee().getHireDate(),
|
||||||
employeeInfo.getDepartment().getIdDepartment(),
|
null,
|
||||||
employeeInfo.getDepartment().getNmDepartment()
|
allEmployeeInfo.getEmployee().getAdminAuth(),
|
||||||
);
|
allEmployeeInfo.getHeadquarters().getIdHeadquarters(),
|
||||||
|
allEmployeeInfo.getHeadquarters().getNmHeadquarters(),
|
||||||
|
allEmployeeInfo.getDepartment().getIdDepartment(),
|
||||||
|
allEmployeeInfo.getDepartment().getNmDepartment(),
|
||||||
|
allEmployeeInfo.getDivision().getIdDivision(),
|
||||||
|
allEmployeeInfo.getDivision().getNmDivision());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の EmployeeInfo クラスから画面用(presentation 層)の EmployeeInfoForm に
|
* AllEmployeeInfo からEmployeeInfoForm に変換します。(リスト版)
|
||||||
* 変換します。(リスト版)
|
|
||||||
*
|
*
|
||||||
* @param employeeInfoList business 層の EmployeeInfo インスタンスのリスト
|
* @param allEmployeeInfo AllEmployeeInfo インスタンスのリスト
|
||||||
* @return クラスから画面用(presentation 層)の EmployeeInfoForm インスタンスのリスト
|
* @return EmployeeInfoForm インスタンスのリスト
|
||||||
*/
|
*/
|
||||||
public static List<EmployeeInfoForm> convertFrom(List<EmployeeInfo> employeeInfoList) {
|
public static List<EmployeeInfoForm> convertFrom(List<AllEmployeeInfo> allEmployeeInfoList) {
|
||||||
return employeeInfoList.stream().map(EmployeeInfoForm::convertFrom).toList();
|
return allEmployeeInfoList.stream().map(EmployeeInfoForm::convertFrom).toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.AllDepartmentInfo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class HeadquartersInfoForm {
|
||||||
|
/**
|
||||||
|
* 本部ID
|
||||||
|
*/
|
||||||
|
private Integer idHeadquarters;
|
||||||
|
/**
|
||||||
|
* 本部名
|
||||||
|
*/
|
||||||
|
private String nmHeadquarters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AllDepartmentInfoから HeadquartersInfoFormに変換します。
|
||||||
|
*
|
||||||
|
* @param allDepartmentInfo AllDepartmentInfo インスタンス
|
||||||
|
* @return HeadquartersInfoForm インスタンス
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static HeadquartersInfoForm convertFrom(AllDepartmentInfo allDepartmentInfo) {
|
||||||
|
return new HeadquartersInfoForm(
|
||||||
|
allDepartmentInfo.getHeadquarters().getIdHeadquarters(),
|
||||||
|
allDepartmentInfo.getHeadquarters().getNmHeadquarters());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AllDepartmentInfoから HeadquartersInfoFormに変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param allDepartmentInfo AllDepartmentInfo インスタンスのリスト
|
||||||
|
* @return HeadquartersInfoForm インスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static List<HeadquartersInfoForm> convertFrom(List<AllDepartmentInfo> allDepartmentInfoList) {
|
||||||
|
return allDepartmentInfoList.stream().map(HeadquartersInfoForm::convertFrom).distinct().toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import com.example.rhizome.app.domain.model.DepartmentInfo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -12,29 +13,63 @@ import lombok.NoArgsConstructor;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class InsertDepartmentForm {
|
public class InsertDepartmentForm {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署ID
|
* 本部ID
|
||||||
|
*/
|
||||||
|
private Integer idHeadquarters;
|
||||||
|
/**
|
||||||
|
* 本部名
|
||||||
|
*/
|
||||||
|
private String nmHeadquarters;
|
||||||
|
/**
|
||||||
|
* 部ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
/**
|
/**
|
||||||
* 部署名
|
* 部名
|
||||||
*/
|
*/
|
||||||
private String nmDepartment;
|
private String nmDepartment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面用(presentation 層)の InsertDepartmentForm クラス を Business 層の Department クラスに変換
|
* 課ID
|
||||||
|
*/
|
||||||
|
private Integer idDivision;
|
||||||
|
/**
|
||||||
|
* 課名
|
||||||
|
*/
|
||||||
|
private String nmDivision;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面用(presentation 層)の InsertDepartmentForm クラス を Business 層の DepartmentInfo クラスに変換
|
||||||
*
|
*
|
||||||
* @param insertDepartmentForm presentation 層用のクラス
|
* @param insertDepartmentForm presentation 層用のクラス
|
||||||
* @return Business 層用のモデル
|
* @return DepartmentFormのインスタンス
|
||||||
*/
|
*/
|
||||||
public static Department convertTo(InsertDepartmentForm insertDepartmentForm) {
|
public static DepartmentInfo convertTo(InsertDepartmentForm insertDepartmentForm) {
|
||||||
return new Department(insertDepartmentForm.getIdDepartment(), insertDepartmentForm.getNmDepartment());
|
return new DepartmentInfo(insertDepartmentForm.getIdHeadquarters(),
|
||||||
|
insertDepartmentForm.getNmHeadquarters(),
|
||||||
|
insertDepartmentForm.getIdDepartment(),
|
||||||
|
insertDepartmentForm.getNmDepartment(),
|
||||||
|
insertDepartmentForm.getIdDivision(),
|
||||||
|
insertDepartmentForm.getNmDivision());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean haveNmDepartment() {
|
public boolean haveNmDepartment() {
|
||||||
return nmDepartment.isBlank();
|
|
||||||
|
if (idHeadquarters == null && nmHeadquarters.isBlank()) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (idDepartment == null && nmDepartment.isBlank()) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (idDivision == null && nmDivision.isBlank()) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面から渡ってきた登録内容をまとめ、再度画面に表示する為のクラス
|
* 画面から渡ってきた登録内容をまとめ、再度画面に表示する為のクラス
|
||||||
*/
|
*/
|
||||||
@@ -40,6 +41,10 @@ public class InsertEmployeeForm {
|
|||||||
* 確認用パスワード
|
* 確認用パスワード
|
||||||
*/
|
*/
|
||||||
private String passwordConfirm;
|
private String passwordConfirm;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private String hireDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
@@ -47,10 +52,20 @@ public class InsertEmployeeForm {
|
|||||||
private Integer adminAuth;
|
private Integer adminAuth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署ID
|
* 本部ID
|
||||||
|
*/
|
||||||
|
private Integer idHeadquarters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 課ID
|
||||||
|
*/
|
||||||
|
private Integer idDivision;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* パスワードのValidation
|
* パスワードのValidation
|
||||||
* チェック対象にエラーが有った場合エラーリストに文言を追加する
|
* チェック対象にエラーが有った場合エラーリストに文言を追加する
|
||||||
@@ -105,9 +120,9 @@ public class InsertEmployeeForm {
|
|||||||
insertEmployeeForm.getKnEmployee(),
|
insertEmployeeForm.getKnEmployee(),
|
||||||
insertEmployeeForm.getMailAddress(),
|
insertEmployeeForm.getMailAddress(),
|
||||||
insertEmployeeForm.getPassword(),
|
insertEmployeeForm.getPassword(),
|
||||||
|
insertEmployeeForm.getHireDate(),
|
||||||
insertEmployeeForm.getAdminAuth(),
|
insertEmployeeForm.getAdminAuth(),
|
||||||
insertEmployeeForm.getIdDepartment()
|
insertEmployeeForm.getIdDivision());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,6 +136,7 @@ public class InsertEmployeeForm {
|
|||||||
final String MAIL_ADDRESS_NULL_BLANK = "メールアドレス";
|
final String MAIL_ADDRESS_NULL_BLANK = "メールアドレス";
|
||||||
final String MANAGEMENT_ERROR = "管理者権限指定";
|
final String MANAGEMENT_ERROR = "管理者権限指定";
|
||||||
final String DEPARTMENT_ID_NULL_BLANK = "所属部署";
|
final String DEPARTMENT_ID_NULL_BLANK = "所属部署";
|
||||||
|
final String HIREDATE_NULL_BLANK = "入社年月日";
|
||||||
|
|
||||||
List<String> error = new ArrayList<>();
|
List<String> error = new ArrayList<>();
|
||||||
|
|
||||||
@@ -141,9 +157,12 @@ public class InsertEmployeeForm {
|
|||||||
error.add(MANAGEMENT_ERROR);
|
error.add(MANAGEMENT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idDepartment == null) {
|
if (idDivision == null) {
|
||||||
error.add(DEPARTMENT_ID_NULL_BLANK);
|
error.add(DEPARTMENT_ID_NULL_BLANK);
|
||||||
}
|
}
|
||||||
|
if (isNullOrBlank(hireDate)) {
|
||||||
|
error.add(HIREDATE_NULL_BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.LoginUser;
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -37,7 +37,7 @@ public class LoginUserForm {
|
|||||||
private Integer adminAuth;
|
private Integer adminAuth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署ID
|
* 課ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
|
|
||||||
@@ -56,8 +56,7 @@ public class LoginUserForm {
|
|||||||
loginUser.getMailAddress(),
|
loginUser.getMailAddress(),
|
||||||
loginUser.getPassword(),
|
loginUser.getPassword(),
|
||||||
loginUser.getAdminAuth(),
|
loginUser.getAdminAuth(),
|
||||||
loginUser.getIdDepartment()
|
loginUser.getIdDivision());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,8 +74,7 @@ public class LoginUserForm {
|
|||||||
loginUserForm.getMailAddress(),
|
loginUserForm.getMailAddress(),
|
||||||
loginUserForm.getPassword(),
|
loginUserForm.getPassword(),
|
||||||
loginUserForm.getAdminAuth(),
|
loginUserForm.getAdminAuth(),
|
||||||
loginUserForm.getIdDepartment()
|
loginUserForm.getIdDepartment());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面から渡ってきた検索条件をまとめ、再度画面に表示する為のクラス
|
* 画面から渡ってきた検索条件をまとめ、再度画面に表示する為のクラス
|
||||||
*/
|
*/
|
||||||
@@ -18,11 +19,11 @@ public class SearchConditionDepartmentForm {
|
|||||||
/**
|
/**
|
||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDivision;
|
||||||
/**
|
/**
|
||||||
* 部署名
|
* 部署名
|
||||||
*/
|
*/
|
||||||
private String nmDepartment;
|
private String nmDivision;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の Department クラスから画面用(presentation 層)の SearchConditionDepartmentForm に
|
* business 層の Department クラスから画面用(presentation 層)の SearchConditionDepartmentForm に
|
||||||
@@ -55,9 +56,8 @@ public class SearchConditionDepartmentForm {
|
|||||||
*/
|
*/
|
||||||
public static SearchConditionDepartment convertTo(SearchConditionDepartmentForm searchConditionDepartmentForm) {
|
public static SearchConditionDepartment convertTo(SearchConditionDepartmentForm searchConditionDepartmentForm) {
|
||||||
return new SearchConditionDepartment(
|
return new SearchConditionDepartment(
|
||||||
searchConditionDepartmentForm.getIdDepartment(),
|
searchConditionDepartmentForm.getIdDivision(),
|
||||||
searchConditionDepartmentForm.nmDepartment
|
searchConditionDepartmentForm.nmDivision);
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -32,7 +33,7 @@ public class SearchConditionEmployeeForm {
|
|||||||
/**
|
/**
|
||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDivision;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の SearchConditionEmployee クラスから画面用(presentation 層)の SearchConditionEmployeeForm に
|
* business 層の SearchConditionEmployee クラスから画面用(presentation 層)の SearchConditionEmployeeForm に
|
||||||
@@ -47,8 +48,7 @@ public class SearchConditionEmployeeForm {
|
|||||||
searchConditionEmployee.getNmEmployee(),
|
searchConditionEmployee.getNmEmployee(),
|
||||||
searchConditionEmployee.getKnEmployee(),
|
searchConditionEmployee.getKnEmployee(),
|
||||||
searchConditionEmployee.getMailAddress(),
|
searchConditionEmployee.getMailAddress(),
|
||||||
searchConditionEmployee.getIdDepartment()
|
searchConditionEmployee.getIdDivision());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,7 +64,6 @@ public class SearchConditionEmployeeForm {
|
|||||||
searchConditionEmployeeForm.getNmEmployee(),
|
searchConditionEmployeeForm.getNmEmployee(),
|
||||||
searchConditionEmployeeForm.getKnEmployee(),
|
searchConditionEmployeeForm.getKnEmployee(),
|
||||||
searchConditionEmployeeForm.getMailAddress(),
|
searchConditionEmployeeForm.getMailAddress(),
|
||||||
searchConditionEmployeeForm.getIdDepartment()
|
searchConditionEmployeeForm.getIdDivision());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +1,74 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import com.example.rhizome.app.domain.model.AllDepartmentInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.DepartmentInfo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面の表示に使う部署コード管理用のクラス
|
* 画面の表示に使う部署コード管理用のクラス
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
|
||||||
public class UpdateDepartmentForm {
|
public class UpdateDepartmentForm {
|
||||||
/**
|
/**
|
||||||
* 部署ID
|
* 本部ID
|
||||||
|
*/
|
||||||
|
private Integer idHeadquarters;
|
||||||
|
/**
|
||||||
|
* 本部名
|
||||||
|
*/
|
||||||
|
private String nmHeadquarters;
|
||||||
|
/**
|
||||||
|
* 部ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
/**
|
/**
|
||||||
* 部署名
|
* 部名
|
||||||
*/
|
*/
|
||||||
private String nmDepartment;
|
private String nmDepartment;
|
||||||
|
/**
|
||||||
|
* 課ID
|
||||||
|
*/
|
||||||
|
private Integer idDivision;
|
||||||
|
/**
|
||||||
|
* 課名
|
||||||
|
*/
|
||||||
|
private String nmDivision;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の Department クラスから画面用(presentation 層)の UpdateDepartmentForm に
|
* AllDepartmentInfoクラスから UpdateDepartmentForm に変換します。
|
||||||
* 変換します。
|
|
||||||
*
|
*
|
||||||
* @param department business 層の Department インスタンス
|
* @param allDepartmentInfo AllDepartmentInfo インスタンス
|
||||||
* @return 画面用(presentation 層)の UpdateDepartmentForm インスタンス
|
* @return 画面用(presentation 層)の UpdateDepartmentForm インスタンス
|
||||||
*/
|
*/
|
||||||
public static UpdateDepartmentForm convertFrom(Department department) {
|
public static UpdateDepartmentForm convertFrom(AllDepartmentInfo allDepartmentInfo) {
|
||||||
return new UpdateDepartmentForm(department.getIdDepartment(), department.getNmDepartment());
|
return new UpdateDepartmentForm(
|
||||||
|
allDepartmentInfo.getHeadquarters().getIdHeadquarters(),
|
||||||
|
allDepartmentInfo.getHeadquarters().getNmHeadquarters(),
|
||||||
|
allDepartmentInfo.getDepartment().getIdDepartment(),
|
||||||
|
allDepartmentInfo.getDepartment().getNmDepartment(),
|
||||||
|
allDepartmentInfo.getDivision().getIdDivision(),
|
||||||
|
allDepartmentInfo.getDivision().getNmDivision());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の Department クラスから画面用(presentation 層)の UpdateDepartmentForm に
|
* UpdateDepartmentFormから DepartmentInfo に変換します。
|
||||||
* 変換します。(リスト版)
|
|
||||||
*
|
*
|
||||||
* @param departmentList business 層の Department インスタンスのリスト
|
* @param updateDepartmentForm UpdateDepartmentFormインスタンス
|
||||||
* @return 画面用(presentation 層)の UpdateDepartmentForm インスタンスのリスト
|
* @return DepartmentInfo インスタンス
|
||||||
*/
|
*/
|
||||||
public static List<UpdateDepartmentForm> convertFrom(List<Department> departmentList) {
|
public static DepartmentInfo convertTo(UpdateDepartmentForm updateDepartmentForm) {
|
||||||
return departmentList.stream().map(UpdateDepartmentForm::convertFrom).toList();
|
return new DepartmentInfo(
|
||||||
}
|
updateDepartmentForm.getIdHeadquarters(),
|
||||||
|
updateDepartmentForm.getNmHeadquarters(),
|
||||||
/**
|
|
||||||
* presentation 層の UpdateDepartmentForm クラスから Business 層の Department クラスに
|
|
||||||
* 変換します。
|
|
||||||
*
|
|
||||||
* @param updateDepartmentForm presentation 層のインスタンス
|
|
||||||
* @return Business 層の Department インスタンス
|
|
||||||
*/
|
|
||||||
public static Department convertTo(UpdateDepartmentForm updateDepartmentForm) {
|
|
||||||
return new Department(
|
|
||||||
updateDepartmentForm.getIdDepartment(),
|
updateDepartmentForm.getIdDepartment(),
|
||||||
updateDepartmentForm.getNmDepartment()
|
updateDepartmentForm.getNmDepartment(),
|
||||||
|
updateDepartmentForm.getIdDivision(),
|
||||||
|
updateDepartmentForm.getNmDivision()
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.AllEmployeeInfo;
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面から渡ってきた更新内容をまとめ、再度画面に表示する為のクラス
|
* 画面から渡ってきた更新内容をまとめ、再度画面に表示する為のクラス
|
||||||
*/
|
*/
|
||||||
@@ -40,44 +41,52 @@ public class UpdateEmployeeInfoForm {
|
|||||||
* パスワード確認用
|
* パスワード確認用
|
||||||
*/
|
*/
|
||||||
private String passwordConfirm;
|
private String passwordConfirm;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private String hireDate;
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
private Integer adminAuth;
|
private Integer adminAuth;
|
||||||
/**
|
/**
|
||||||
* 部署ID
|
* 部ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDivision;
|
||||||
|
/**
|
||||||
|
* 本部ID
|
||||||
|
*/
|
||||||
|
private Integer idHeadquarters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の EmployeeInfo クラスから画面用(presentation 層)の UpdateEmployeeInfoForm に
|
* AllEmployeeInfo クラスからUpdateEmployeeInfoForm に変換します。
|
||||||
* 変換します。
|
|
||||||
*
|
*
|
||||||
* @param employeeInfo business 層の EmployeeInfo インスタンス
|
* @param allemployeeInfo AllEmployeeInfo インスタンス
|
||||||
* @return 画面用(presentation 層)の UpdateEmployeeInfoForm インスタンス
|
* @return 画面用(presentation 層)の UpdateEmployeeInfoForm インスタンス
|
||||||
*/
|
*/
|
||||||
public static UpdateEmployeeInfoForm convertFrom(EmployeeInfo employeeInfo) {
|
public static UpdateEmployeeInfoForm convertFrom(AllEmployeeInfo allemployeeInfo) {
|
||||||
return new UpdateEmployeeInfoForm(
|
return new UpdateEmployeeInfoForm(
|
||||||
employeeInfo.getEmployee().getIdEmployee(),
|
allemployeeInfo.getEmployee().getIdEmployee(),
|
||||||
employeeInfo.getEmployee().getNmEmployee(),
|
allemployeeInfo.getEmployee().getNmEmployee(),
|
||||||
employeeInfo.getEmployee().getKnEmployee(),
|
allemployeeInfo.getEmployee().getKnEmployee(),
|
||||||
employeeInfo.getEmployee().getMailAddress(),
|
allemployeeInfo.getEmployee().getMailAddress(),
|
||||||
employeeInfo.getEmployee().getPassword(),
|
allemployeeInfo.getEmployee().getPassword(),
|
||||||
null,
|
null,
|
||||||
employeeInfo.getEmployee().getAdminAuth(),
|
allemployeeInfo.getEmployee().getHireDate(),
|
||||||
employeeInfo.getDepartment().getIdDepartment()
|
allemployeeInfo.getEmployee().getAdminAuth(),
|
||||||
);
|
allemployeeInfo.getDivision().getIdDivision(),
|
||||||
|
allemployeeInfo.getHeadquarters().getIdHeadquarters());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の EmployeeInfo クラスから画面用(presentation 層)の UpdateEmployeeInfoForm に
|
* AllEmployeeInfo クラスから画面用 UpdateEmployeeInfoForm に変換します。(リスト版)
|
||||||
* 変換します。(リスト版)
|
|
||||||
*
|
*
|
||||||
* @param employeeInfoList business 層の EmployeeInfo インスタンスのリスト
|
* @param allemployeeInfoList business 層の AllEmployeeInfo インスタンスのリスト
|
||||||
* @return 画面用(presentation 層)の UpdateEmployeeInfoForm インスタンスのリスト
|
* @return 画面用(presentation 層)の UpdateEmployeeInfoForm インスタンスのリスト
|
||||||
*/
|
*/
|
||||||
public static List<UpdateEmployeeInfoForm> convertFrom(List<EmployeeInfo> employeeInfoList) {
|
public static List<UpdateEmployeeInfoForm> convertFrom(List<AllEmployeeInfo> allemployeeInfoList) {
|
||||||
return employeeInfoList.stream().map(UpdateEmployeeInfoForm::convertFrom).toList();
|
return allemployeeInfoList.stream().map(UpdateEmployeeInfoForm::convertFrom).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,9 +103,9 @@ public class UpdateEmployeeInfoForm {
|
|||||||
updateEmployeeInfoForm.getKnEmployee(),
|
updateEmployeeInfoForm.getKnEmployee(),
|
||||||
updateEmployeeInfoForm.getMailAddress(),
|
updateEmployeeInfoForm.getMailAddress(),
|
||||||
updateEmployeeInfoForm.getPassword(),
|
updateEmployeeInfoForm.getPassword(),
|
||||||
|
updateEmployeeInfoForm.getHireDate(),
|
||||||
updateEmployeeInfoForm.getAdminAuth(),
|
updateEmployeeInfoForm.getAdminAuth(),
|
||||||
updateEmployeeInfoForm.getIdDepartment()
|
updateEmployeeInfoForm.getIdDivision());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,7 +128,6 @@ public class UpdateEmployeeInfoForm {
|
|||||||
errorFlag = true;
|
errorFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return errorFlag;
|
return errorFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.example.rhizome.app.presentation.form;
|
|||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
import com.example.rhizome.app.domain.model.LoginUser;
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -37,7 +38,10 @@ public class UpdatePersonalUserForm {
|
|||||||
* パスワード確認用
|
* パスワード確認用
|
||||||
*/
|
*/
|
||||||
private String passwordConfirm;
|
private String passwordConfirm;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private String hireDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面用(presentation 層)の UpdatePersonalUserForm クラスから business 層の Employee クラスに
|
* 画面用(presentation 層)の UpdatePersonalUserForm クラスから business 層の Employee クラスに
|
||||||
@@ -53,9 +57,9 @@ public class UpdatePersonalUserForm {
|
|||||||
updatePersonalUserForm.getKnEmployee(),
|
updatePersonalUserForm.getKnEmployee(),
|
||||||
updatePersonalUserForm.getMailAddress(),
|
updatePersonalUserForm.getMailAddress(),
|
||||||
updatePersonalUserForm.getPassword(),
|
updatePersonalUserForm.getPassword(),
|
||||||
|
updatePersonalUserForm.getHireDate(),
|
||||||
null,
|
null,
|
||||||
null
|
null);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +76,9 @@ public class UpdatePersonalUserForm {
|
|||||||
employee.getKnEmployee(),
|
employee.getKnEmployee(),
|
||||||
employee.getMailAddress(),
|
employee.getMailAddress(),
|
||||||
employee.getPassword(),
|
employee.getPassword(),
|
||||||
null
|
null,
|
||||||
|
employee.getHireDate()
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,8 +96,8 @@ public class UpdatePersonalUserForm {
|
|||||||
loginUser.getKnEmployee(),
|
loginUser.getKnEmployee(),
|
||||||
loginUser.getMailAddress(),
|
loginUser.getMailAddress(),
|
||||||
loginUser.getPassword(),
|
loginUser.getPassword(),
|
||||||
null
|
null,
|
||||||
);
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +120,6 @@ public class UpdatePersonalUserForm {
|
|||||||
errorFlag = true;
|
errorFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return errorFlag;
|
return errorFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">部署ID</th>
|
<th class="header"> 本部ID</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="readOnly"
|
<input class="readOnly"
|
||||||
@@ -41,7 +41,30 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">部署名</th>
|
<th class="header">本部名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="nmHeadquarters"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{nmHeadquarters}"
|
||||||
|
type="text"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
readonly="readonly"
|
||||||
|
type="text"
|
||||||
|
value="自動で設定されます"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部名</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="readOnly"
|
<input class="readOnly"
|
||||||
@@ -52,6 +75,31 @@
|
|||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">課ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
readonly="readonly"
|
||||||
|
type="text"
|
||||||
|
value="自動で設定されます"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">課名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="nmDivision"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{nmDivision}"
|
||||||
|
type="text"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="btnArea" colspan="2">
|
<td class="btnArea" colspan="2">
|
||||||
<input type="submit" value="登録"/>
|
<input type="submit" value="登録"/>
|
||||||
|
|||||||
@@ -20,9 +20,7 @@
|
|||||||
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
<form action="insertDepartmentConfirm"
|
<form action="insertDepartmentConfirm" method="post" th:object="${insertDepartmentForm}" id="insertDepartmentForm">
|
||||||
method="post"
|
|
||||||
th:object="${insertDepartmentForm}">
|
|
||||||
|
|
||||||
<div class="msgBox error" th:if="${messageError} != null">
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
<span class="error" th:text="${messageError.message}"></span>
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
@@ -30,30 +28,109 @@
|
|||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">部署ID</th>
|
<th class="header">本部ID</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="readOnly"
|
<input class="readOnly" readonly="readonly" type="text" value="自動で設定されます" />
|
||||||
readonly="readonly"
|
</label>
|
||||||
type="text"
|
</td>
|
||||||
value="自動で設定されます"
|
</tr>
|
||||||
/>
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">本部名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50" placeholder="本部名" th:field="*{nmHeadquarters}" type="text"
|
||||||
|
id="nmHeadquarters1" />
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">部署名</th>
|
<th class="header"></th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input maxlength="50"
|
<select th:field="*{nmHeadquarters}" id="nmHeadquarters2">
|
||||||
placeholder="部署名"
|
<option value="">本部を選択</option>
|
||||||
required="required"
|
<option th:each="headquarters : ${headquartersFormList}"
|
||||||
th:field="*{nmDepartment}"
|
th:selected="${insertDepartmentForm.idHeadquarters != null && headquarters.idHeadquarters == insertDepartmentForm.idHeadquarters}"
|
||||||
type="text"
|
th:text="${headquarters.nmHeadquarters}" th:value="${headquarters.nmHeadquarters}">
|
||||||
/>
|
</option>
|
||||||
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">部ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly" readonly="readonly" type="text" value="自動で設定されます" />
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">部名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50" placeholder="部名" th:field="*{nmDepartment}" type="text"
|
||||||
|
id="nmDepartment1" />
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header"></th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<select th:field="*{nmDepartment}" id="nmDepartment2">
|
||||||
|
<option value="">部を選択</option>
|
||||||
|
<option th:each="department : ${departmentFormList}"
|
||||||
|
th:selected="${insertDepartmentForm.idDepartment != null && department.idDepartment == insertDepartmentForm.idDepartment}"
|
||||||
|
th:text="${department.nmDepartment}" th:value="${department.nmDepartment}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">課ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly" readonly="readonly" type="text" value="自動で設定されます" />
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header">課名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50" placeholder="課名" th:field="*{nmDivision}" type="text" id="nmDivision1" />
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="header"></th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<select th:field="*{nmDivision}" id="nmDivision2">
|
||||||
|
<option value="">課を選択</option>
|
||||||
|
<option th:each="division : ${divisionFormList}"
|
||||||
|
th:selected="${insertDepartmentForm.idDivision != null && division.idDivision == insertDepartmentForm.idDivision}"
|
||||||
|
th:text="${division.nmDivision}" th:value="${division.nmDivision}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="btnArea" colspan="2">
|
<td class="btnArea" colspan="2">
|
||||||
<input type="submit" value="登録確認" />
|
<input type="submit" value="登録確認" />
|
||||||
@@ -63,4 +140,51 @@
|
|||||||
</form>
|
</form>
|
||||||
<a href="showMenu">メニューに戻る</a>
|
<a href="showMenu">メニューに戻る</a>
|
||||||
</body>
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
const nmHeadquarters1 = document.getElementById('nmHeadquarters1');
|
||||||
|
const nmHeadquarters2 = document.getElementById('nmHeadquarters2');
|
||||||
|
|
||||||
|
document.getElementById('insertDepartmentForm').addEventListener('submit', function (e) {
|
||||||
|
if (nmHeadquarters1.value !== "") {
|
||||||
|
nmHeadquarters2.removeAttribute('name');
|
||||||
|
} else if (nmHeadquarters2.value !== "") {
|
||||||
|
nmHeadquarters1.removeAttribute('name');
|
||||||
|
}
|
||||||
|
// ↓両方の入力欄が空で登録確認ボタンを押した時用どちらかの空の情報を送る
|
||||||
|
// (どちらかじゃないと","が入ってしまう)
|
||||||
|
else if (nmHeadquarters2.value === "" && nmHeadquarters1.value === "") {
|
||||||
|
nmHeadquarters2.removeAttribute('name');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const nmDepartment1 = document.getElementById('nmDepartment1');
|
||||||
|
const nmDepartment2 = document.getElementById('nmDepartment2');
|
||||||
|
|
||||||
|
if (nmDepartment1.value !== "") {
|
||||||
|
nmDepartment2.removeAttribute('name');
|
||||||
|
} else if (nmDepartment2.value !== "") {
|
||||||
|
nmDepartment1.removeAttribute('name');
|
||||||
|
// ↓両方の入力欄が空で登録確認ボタンを押した時用どちらかの空の情報を送る
|
||||||
|
// (どちらかじゃないと","が入ってしまう)
|
||||||
|
} else if (nmDepartment1.value === "" && nmDepartment2.value === "") {
|
||||||
|
nmDepartment2.removeAttribute('name');
|
||||||
|
}
|
||||||
|
|
||||||
|
const nmDivision1 = document.getElementById('nmDivision1');
|
||||||
|
const nmDivision2 = document.getElementById('nmDivision2');
|
||||||
|
|
||||||
|
if (document.getElementById('nmDivision1').value !== "") {
|
||||||
|
document.getElementById('nmDivision2').removeAttribute('name');
|
||||||
|
} else if (document.getElementById('nmDivision2').value !== "") {
|
||||||
|
document.getElementById('nmDivision1').removeAttribute('name');
|
||||||
|
// ↓両方の入力欄が空で登録確認ボタンを押した時用どちらかの空の情報を送る
|
||||||
|
// (どちらかじゃないと","が入ってしまう)
|
||||||
|
} else if (nmDivision1.value === "" && nmDivision2.value === "") {
|
||||||
|
nmDivision2.removeAttribute('name');
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -89,6 +89,18 @@
|
|||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">入社年月日</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="hireDate"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{hireDate}"
|
||||||
|
type="date"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">管理者権限</th>
|
<th class="header">管理者権限</th>
|
||||||
<td>
|
<td>
|
||||||
@@ -107,20 +119,52 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">所属部署</th>
|
<th class="header" style="vertical-align: top;">所属部署</th>
|
||||||
<td>
|
<td>
|
||||||
|
<label>
|
||||||
|
<select name="idHeadquarters" required="required" th:field="*{idHeadquarters}">
|
||||||
|
<th:block th:each="headquarters : ${departmentFormList}">
|
||||||
|
<th:block
|
||||||
|
th:if="${insertEmployeeForm.idHeadquarters != null && headquarters.idHeadquarters == insertEmployeeForm.idHeadquarters}">>
|
||||||
|
<option
|
||||||
|
th:utext="
|
||||||
|
${headquarters.nmHeadquarters}"
|
||||||
|
th:value="${headquarters.idHeadquarters}">
|
||||||
|
</option>
|
||||||
|
</th:block>
|
||||||
|
</th:block>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
<label>
|
<label>
|
||||||
<select name="idDepartment" required="required" th:field="*{idDepartment}">
|
<select name="idDepartment" required="required" th:field="*{idDepartment}">
|
||||||
<th:block th:each="department : ${departmentFormList}">
|
<th:block th:each="department : ${departmentFormList}">
|
||||||
<th:block
|
<th:block
|
||||||
th:if="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}">
|
th:if="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}">>
|
||||||
<option th:text="${department.nmDepartment}"
|
<option
|
||||||
|
th:utext="
|
||||||
|
${department.nmDepartment}"
|
||||||
th:value="${department.idDepartment}">
|
th:value="${department.idDepartment}">
|
||||||
</option>
|
</option>
|
||||||
</th:block>
|
</th:block>
|
||||||
</th:block>
|
</th:block>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
<br>
|
||||||
|
<label>
|
||||||
|
<select name="idDivision" required="required" th:field="*{idDivision}">
|
||||||
|
<th:block th:each="division : ${departmentFormList}">
|
||||||
|
<th:block
|
||||||
|
th:if="${insertEmployeeForm.idDivision != null && division.idDivision == insertEmployeeForm.idDivision}">
|
||||||
|
<option
|
||||||
|
th:utext="
|
||||||
|
${division.nmDivision}"
|
||||||
|
th:value="${division.idDivision}">
|
||||||
|
</option>
|
||||||
|
</th:block>
|
||||||
|
</th:block>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -114,6 +114,19 @@
|
|||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">入社年月日</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
placeholder="入社年月日"
|
||||||
|
required="required"
|
||||||
|
th:field="*{hireDate}"
|
||||||
|
type="date"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">管理者権限</th>
|
<th class="header">管理者権限</th>
|
||||||
<td>
|
<td>
|
||||||
@@ -133,19 +146,47 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">所属部署</th>
|
|
||||||
|
<th class="header" >所属本部</th>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<select required="required" th:field="*{idDepartment}">
|
<select id="headquartersSelect" required="required" th:field="*{idHeadquarters}">
|
||||||
<option th:each="department : ${departmentFormList}"
|
<option value="">本部を選択</option>
|
||||||
th:selected="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}"
|
<option th:each="headquarters : ${departmentFormList}"
|
||||||
th:text="${department.nmDepartment}"
|
th:utext="
|
||||||
th:value="${department.idDepartment}">
|
${headquarters.nmHeadquarters}"
|
||||||
|
th:value="${headquarters.idHeadquarters}">
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header" >所属部</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<select id="departmentSelect" required="required" th:field="*{idDepartment}">
|
||||||
|
<option value="">先に本部を選択してください</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header" >所属課</th>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<select id="divisionSelect" required="required" th:field="*{idDivision}">
|
||||||
|
<option value="">先に部を選択してください</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="btnArea" colspan="2">
|
<td class="btnArea" colspan="2">
|
||||||
<input type="submit" value="登録確認"/>
|
<input type="submit" value="登録確認"/>
|
||||||
@@ -155,4 +196,73 @@
|
|||||||
</form>
|
</form>
|
||||||
<a href="showMenu">メニューに戻る</a>
|
<a href="showMenu">メニューに戻る</a>
|
||||||
</body>
|
</body>
|
||||||
|
<!--プルダウン絞り込み実装用-->
|
||||||
|
<script>
|
||||||
|
const headquartersSelect = document.getElementById('headquartersSelect');
|
||||||
|
const departmentSelect = document.getElementById('departmentSelect');
|
||||||
|
const divisionSelect = document.getElementById('divisionSelect');
|
||||||
|
|
||||||
|
headquartersSelect.addEventListener('change', function() {
|
||||||
|
const id_headquarters = this.value;
|
||||||
|
|
||||||
|
departmentSelect.disabled = true;
|
||||||
|
divisionSelect.disabled = true;
|
||||||
|
departmentSelect.innerHTML = '<option value="">-- 部を選択 --</option>';
|
||||||
|
divisionSelect.innerHTML = '<option value="">-- 先に部を選択してください --</option>';
|
||||||
|
|
||||||
|
if (!id_headquarters) return;
|
||||||
|
fetch(`insertEmployeeInput/searchDepartment?id_headquarters=${id_headquarters}`,{
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(res => {
|
||||||
|
return res.json();
|
||||||
|
})
|
||||||
|
.then(list => {
|
||||||
|
departmentSelect.disabled = false;
|
||||||
|
list.forEach(form => {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = form.idDepartment;
|
||||||
|
opt.textContent = form.nmDepartment;
|
||||||
|
departmentSelect.appendChild(opt);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
departmentSelect.addEventListener('change', function() {
|
||||||
|
const id_department = this.value;
|
||||||
|
|
||||||
|
divisionSelect.disabled = true;
|
||||||
|
divisionSelect.innerHTML = '<option value="">-- 課を選択 --</option>';
|
||||||
|
if (!id_department) return;
|
||||||
|
fetch(`/insertEmployeeInput/searchDepartment/searchDivision?id_department=${id_department}`,{
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(res => {
|
||||||
|
return res.json();
|
||||||
|
})
|
||||||
|
.then(list => {
|
||||||
|
divisionSelect.disabled = false;
|
||||||
|
list.forEach(form => {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = form.idDivision;
|
||||||
|
opt.textContent = form.nmDivision;
|
||||||
|
divisionSelect.appendChild(opt);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
</html>
|
</html>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<th class="header">部署ID</th>
|
<th class="header">部署ID</th>
|
||||||
<td>
|
<td>
|
||||||
<input placeholder="部署ID"
|
<input placeholder="部署ID"
|
||||||
th:field="*{idDepartment}"
|
th:field="*{idDivision}"
|
||||||
type="number"/>
|
type="number"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -40,10 +40,11 @@
|
|||||||
<th class="header">部署名</th>
|
<th class="header">部署名</th>
|
||||||
<td>
|
<td>
|
||||||
<input placeholder="部署名"
|
<input placeholder="部署名"
|
||||||
th:field="*{nmDepartment}"
|
th:field="*{nmDivision}"
|
||||||
type="text"/>
|
type="text"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<!-- 現状は課のみで検索ができる仕様-->
|
||||||
<tr>
|
<tr>
|
||||||
<td class="btnArea" colspan="2">
|
<td class="btnArea" colspan="2">
|
||||||
<input type="submit" value="検索"/>
|
<input type="submit" value="検索"/>
|
||||||
@@ -70,25 +71,33 @@
|
|||||||
<table class="half-table-grid table-striped table-hover">
|
<table class="half-table-grid table-striped table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 60px;">部署ID</th>
|
<th style="width: 60px;">本部ID</th>
|
||||||
<th style="width: 100px;">部署名</th>
|
<th style="width: 100px;">本部名</th>
|
||||||
|
<th style="width: 60px;">部ID</th>
|
||||||
|
<th style="width: 100px;">部名</th>
|
||||||
|
<th style="width: 60px;">課ID</th>
|
||||||
|
<th style="width: 100px;">課名</th>
|
||||||
<th style="width: 150px;">操作</th>
|
<th style="width: 150px;">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr th:each="departmentForm : ${departmentFormList}">
|
<tr th:each="departmentForm : ${departmentFormList}">
|
||||||
|
<td th:text="${departmentForm.idHeadquarters}"></td>
|
||||||
|
<td th:text="${departmentForm.nmHeadquarters}"></td>
|
||||||
<td th:text="${departmentForm.idDepartment}"></td>
|
<td th:text="${departmentForm.idDepartment}"></td>
|
||||||
<td th:text="${departmentForm.nmDepartment}"></td>
|
<td th:text="${departmentForm.nmDepartment}"></td>
|
||||||
|
<td th:text="${departmentForm.idDivision}"></td>
|
||||||
|
<td th:text="${departmentForm.nmDivision}"></td>
|
||||||
<td>
|
<td>
|
||||||
<!-- 更新フォーム -->
|
<!-- 更新フォーム -->
|
||||||
<form action="showUpdateDepartment" method="post" style="display: inline;">
|
<form action="showUpdateDepartment" method="post" style="display: inline;">
|
||||||
<input name="idDepartment" th:value="${departmentForm.idDepartment}" type="hidden">
|
<input name="idDivision" th:value="${departmentForm.idDivision}" type="hidden">
|
||||||
<input type="submit" value="更新">
|
<input type="submit" value="更新">
|
||||||
</form>
|
</form>
|
||||||
<!-- 削除フォーム -->
|
<!-- 削除フォーム -->
|
||||||
<form action="deleteDepartment" method="post" onsubmit="return confirm('本当に削除しますか?');"
|
<form action="deleteDepartment" method="post" onsubmit="return confirm('本当に削除しますか?');"
|
||||||
style="display: inline;">
|
style="display: inline;">
|
||||||
<input name="idDepartment" th:value="${departmentForm.idDepartment}" type="hidden">
|
<input name="idDivision" th:value="${departmentForm.idDivision}" type="hidden">
|
||||||
<input type="submit" value="削除">
|
<input type="submit" value="削除">
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
@@ -105,8 +114,8 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function clearInput() {
|
function clearInput() {
|
||||||
document.getElementById('idDepartment').value = '';
|
document.getElementById('idDivision').value = '';
|
||||||
document.getElementById('nmDepartment').value = '';
|
document.getElementById('nmDivision').value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -64,13 +64,14 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th class="header">所属部署</th>
|
<th class="header">所属部署</th>
|
||||||
<td>
|
<td>
|
||||||
<select th:field="*{idDepartment}">
|
<select th:field="*{idDivision}">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<option th:each="department : ${departmentFormList}"
|
<option th:each="division : ${departmentFormList}"
|
||||||
th:selected="${searchConditionEmployeeForm.idDepartment != null && department.idDepartment == searchConditionEmployeeForm.idDepartment}"
|
th:selected="${searchConditionEmployeeForm.idDivision != null && division.idDivision == searchConditionEmployeeForm.idDivision}"
|
||||||
th:text="${department.nmDepartment}"
|
th:text="${division.nmDivision}"
|
||||||
th:value="${department.idDepartment}">
|
th:value="${division.idDivision}">
|
||||||
</option>
|
</option>
|
||||||
|
<!-- 現状課だけでの検索の実装-->
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -105,6 +106,8 @@
|
|||||||
<th style="width: 150px;">フリガナ</th>
|
<th style="width: 150px;">フリガナ</th>
|
||||||
<th style="width: 150px;">メールアドレス</th>
|
<th style="width: 150px;">メールアドレス</th>
|
||||||
<th style="width: 100px;">パスワード</th>
|
<th style="width: 100px;">パスワード</th>
|
||||||
|
<th style="width: 60px;">入社年月日</th>
|
||||||
|
<th style="width: 60px;">勤続年数</th>
|
||||||
<th style="width: 70px;">管理者フラグ</th>
|
<th style="width: 70px;">管理者フラグ</th>
|
||||||
<th style="width: 150px;">所属部署</th>
|
<th style="width: 150px;">所属部署</th>
|
||||||
<th style="width: 150px;">操作</th>
|
<th style="width: 150px;">操作</th>
|
||||||
@@ -117,8 +120,14 @@
|
|||||||
<td th:text="${employeeInfoForm.knEmployee}"></td>
|
<td th:text="${employeeInfoForm.knEmployee}"></td>
|
||||||
<td th:text="${employeeInfoForm.mailAddress}"></td>
|
<td th:text="${employeeInfoForm.mailAddress}"></td>
|
||||||
<td th:text="${employeeInfoForm.password}"></td>
|
<td th:text="${employeeInfoForm.password}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.hireDate}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.tenure}"></td>
|
||||||
<td th:text="${employeeInfoForm.adminAuth}"></td>
|
<td th:text="${employeeInfoForm.adminAuth}"></td>
|
||||||
<td th:text="${employeeInfoForm.nmDepartment}"></td>
|
<td th:utext="${employeeInfoForm.nmHeadquarters}+'<br/>・'+
|
||||||
|
${employeeInfoForm.nmDepartment}+'<br/>・'+
|
||||||
|
${employeeInfoForm.nmDivision}"
|
||||||
|
></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<!-- 更新フォーム -->
|
<!-- 更新フォーム -->
|
||||||
<form action="showUpdateEmployee" method="post" style="display: inline;">
|
<form action="showUpdateEmployee" method="post" style="display: inline;">
|
||||||
@@ -149,7 +158,7 @@
|
|||||||
document.getElementById('nmEmployee').value = '';
|
document.getElementById('nmEmployee').value = '';
|
||||||
document.getElementById('knEmployee').value = '';
|
document.getElementById('knEmployee').value = '';
|
||||||
document.getElementById('mailAddress').value = '';
|
document.getElementById('mailAddress').value = '';
|
||||||
document.getElementById('idDepartment').selectedIndex = 0;
|
document.getElementById('idDivision').selectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,32 @@
|
|||||||
</div>
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">部署ID</th>
|
<th class="header">本部ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
readonly="readonly"
|
||||||
|
th:field="*{idHeadquarters}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">本部名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="10"
|
||||||
|
placeholder="本部名"
|
||||||
|
required="required"
|
||||||
|
th:field="*{nmHeadquarters}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部ID</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="readOnly"
|
<input class="readOnly"
|
||||||
@@ -42,11 +67,11 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">部署名</th>
|
<th class="header">部名</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input maxlength="10"
|
<input maxlength="10"
|
||||||
placeholder="部署名"
|
placeholder="部名"
|
||||||
required="required"
|
required="required"
|
||||||
th:field="*{nmDepartment}"
|
th:field="*{nmDepartment}"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -54,6 +79,31 @@
|
|||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">課ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
readonly="readonly"
|
||||||
|
th:field="*{idDivision}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">課名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="10"
|
||||||
|
placeholder="課名"
|
||||||
|
required="required"
|
||||||
|
th:field="*{nmDivision}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="btnArea" colspan="2">
|
<td class="btnArea" colspan="2">
|
||||||
<input type="submit" value="更新"/>
|
<input type="submit" value="更新"/>
|
||||||
|
|||||||
@@ -20,11 +20,8 @@
|
|||||||
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
<form action="/updateEmployeeResult"
|
<form action="/updateEmployeeResult" method="post" onsubmit="return confirm('本当によろしいですか?');"
|
||||||
method="post"
|
th:object="${updateEmployeeInfoForm}">
|
||||||
onsubmit="return confirm('本当によろしいですか?');"
|
|
||||||
th:object="${updateEmployeeInfoForm}"
|
|
||||||
>
|
|
||||||
<div class="msgBox error" th:if="${messageError != null}">
|
<div class="msgBox error" th:if="${messageError != null}">
|
||||||
<span class="error" th:each="message : ${messageError.message}" th:text="${message}"></span>
|
<span class="error" th:each="message : ${messageError.message}" th:text="${message}"></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -33,11 +30,7 @@
|
|||||||
<th class="header">社員ID</th>
|
<th class="header">社員ID</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="readOnly"
|
<input class="readOnly" readonly="readonly" th:field="*{idEmployee}" type="text" />
|
||||||
readonly="readonly"
|
|
||||||
th:field="*{idEmployee}"
|
|
||||||
type="text"
|
|
||||||
/>
|
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -45,12 +38,8 @@
|
|||||||
<th class="header">社員名</th>
|
<th class="header">社員名</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input maxlength="50"
|
<input maxlength="50" placeholder="社員名" required="required" th:field="*{nmEmployee}"
|
||||||
placeholder="社員名"
|
type="text" />
|
||||||
required="required"
|
|
||||||
th:field="*{nmEmployee}"
|
|
||||||
type="text"
|
|
||||||
/>
|
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -58,13 +47,8 @@
|
|||||||
<th class="header">社員名フリガナ</th>
|
<th class="header">社員名フリガナ</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input maxlength="50"
|
<input maxlength="50" oninput="convertToKatakana(this)" placeholder="フリガナ" required="required"
|
||||||
oninput="convertToKatakana(this)"
|
th:field="*{knEmployee}" type="text" />
|
||||||
placeholder="フリガナ"
|
|
||||||
required="required"
|
|
||||||
th:field="*{knEmployee}"
|
|
||||||
type="text"
|
|
||||||
/>
|
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -72,12 +56,8 @@
|
|||||||
<th class="header">メールアドレス</th>
|
<th class="header">メールアドレス</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input maxlength="100"
|
<input maxlength="100" placeholder="メールアドレス" required="required" th:field="*{mailAddress}"
|
||||||
placeholder="メールアドレス"
|
type="email" />
|
||||||
required="required"
|
|
||||||
th:field="*{mailAddress}"
|
|
||||||
type="email"
|
|
||||||
/>
|
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -85,11 +65,8 @@
|
|||||||
<th class="header">パスワード</th>
|
<th class="header">パスワード</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$" placeholder="パスワード"
|
||||||
placeholder="パスワード"
|
th:field="*{password}" type="password" />
|
||||||
th:field="*{password}"
|
|
||||||
type="password"
|
|
||||||
/>
|
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -108,11 +85,8 @@
|
|||||||
<th class="header">パスワード確認用</th>
|
<th class="header">パスワード確認用</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$" placeholder="パスワード確認用"
|
||||||
placeholder="パスワード確認用"
|
th:field="*{passwordConfirm}" type="password" />
|
||||||
th:field="*{passwordConfirm}"
|
|
||||||
type="password"
|
|
||||||
/>
|
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -121,32 +95,56 @@
|
|||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input id="adminAuth1" name="adminAuth" th:checked="${updateEmployeeInfoForm.adminAuth == 1}"
|
<input id="adminAuth1" name="adminAuth" th:checked="${updateEmployeeInfoForm.adminAuth == 1}"
|
||||||
type="radio"
|
type="radio" value="1"> 管理者権限
|
||||||
value="1"> 管理者権限
|
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input id="adminAuth0" name="adminAuth"
|
<input id="adminAuth0" name="adminAuth"
|
||||||
th:checked="${updateEmployeeInfoForm.adminAuth == null or updateEmployeeInfoForm.adminAuth == 0}"
|
th:checked="${updateEmployeeInfoForm.adminAuth == null or updateEmployeeInfoForm.adminAuth == 0}"
|
||||||
type="radio"
|
type="radio" value="0">
|
||||||
value="0">
|
|
||||||
一般権限
|
一般権限
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">所属部署</th>
|
|
||||||
|
<th class="header">所属本部</th>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<select required="required" th:field="*{idDepartment}">
|
<select id="headquartersSelect" th:field="*{idHeadquarters}">
|
||||||
<option th:each="department : ${departmentFormList}"
|
<option value="">本部を選択</option>
|
||||||
th:selected="${updateEmployeeInfoForm.idDepartment != null && department.idDepartment == updateEmployeeInfoForm.idDepartment}"
|
<option th:each="headquarters : ${departmentFormList}" th:utext="
|
||||||
th:text="${department.nmDepartment}"
|
${headquarters.nmHeadquarters}" th:value="${headquarters.idHeadquarters}">
|
||||||
th:value="${department.idDepartment}">
|
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">所属部</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<select id="departmentSelect" >
|
||||||
|
<option value="">先に本部を選択してください</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">所属課</th>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<select id="divisionSelect" th:field="*{idDivision}">
|
||||||
|
<option value="">先に部を選択してください</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="btnArea" colspan="2">
|
<td class="btnArea" colspan="2">
|
||||||
<input type="submit" value="更新" />
|
<input type="submit" value="更新" />
|
||||||
@@ -177,5 +175,73 @@
|
|||||||
form.submit();
|
form.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const headquartersSelect = document.getElementById('headquartersSelect');
|
||||||
|
const departmentSelect = document.getElementById('departmentSelect');
|
||||||
|
const divisionSelect = document.getElementById('divisionSelect');
|
||||||
|
|
||||||
|
headquartersSelect.addEventListener('change', function () {
|
||||||
|
const id_headquarters = this.value;
|
||||||
|
|
||||||
|
departmentSelect.disabled = true;
|
||||||
|
divisionSelect.disabled = true;
|
||||||
|
departmentSelect.innerHTML = '<option value="">-- 部を選択 --</option>';
|
||||||
|
divisionSelect.innerHTML = '<option value="">-- 先に部を選択してください --</option>';
|
||||||
|
|
||||||
|
if (!id_headquarters) return;
|
||||||
|
fetch(`updateEmployeeInput/searchDepartment?id_headquarters=${id_headquarters}`, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(res => {
|
||||||
|
return res.json();
|
||||||
|
})
|
||||||
|
.then(list => {
|
||||||
|
departmentSelect.disabled = false;
|
||||||
|
list.forEach(form => {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = form.idDepartment;
|
||||||
|
opt.textContent = form.nmDepartment;
|
||||||
|
departmentSelect.appendChild(opt);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
departmentSelect.addEventListener('change', function () {
|
||||||
|
const id_department = this.value;
|
||||||
|
|
||||||
|
divisionSelect.disabled = true;
|
||||||
|
divisionSelect.innerHTML = '<option value="">-- 課を選択 --</option>';
|
||||||
|
if (!id_department) return;
|
||||||
|
fetch(`/updateEmployeeInput/searchDepartment/searchDivision?id_department=${id_department}`, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(res => {
|
||||||
|
return res.json();
|
||||||
|
})
|
||||||
|
.then(list => {
|
||||||
|
divisionSelect.disabled = false;
|
||||||
|
list.forEach(form => {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = form.idDivision;
|
||||||
|
opt.textContent = form.nmDivision;
|
||||||
|
divisionSelect.appendChild(opt);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user