Compare commits
20 Commits
6f56164c13
...
103acf1106
| Author | SHA1 | Date | |
|---|---|---|---|
| 103acf1106 | |||
|
|
7d5d038a9e | ||
|
|
7362f58c4f | ||
|
|
9ef18e73ed | ||
|
|
45eff1634e | ||
|
|
136b18bfc7 | ||
|
|
9bba174df3 | ||
|
|
0bf7852ef9 | ||
|
|
cbb6495741 | ||
|
|
c612e9dac3 | ||
|
|
0d582fee5c | ||
|
|
4a01b85ae9 | ||
|
|
013bb72439 | ||
|
|
f647eb6ef2 | ||
|
|
48477829fd | ||
|
|
44ed4b3120 | ||
| dc5f6494cf | |||
| 67f88c89a1 | |||
| e238c6b223 | |||
| 63b7aba82a |
@@ -43,17 +43,19 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- webmvcから通常のwebスターターに変更 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId> <!-- ここを修正 -->
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>com.mysql</groupId>
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
@@ -69,28 +71,13 @@
|
|||||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-thymeleaf-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-validation-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -137,3 +124,4 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|||||||
@@ -70,4 +70,3 @@ public class LoginController {
|
|||||||
return "redirect:/login";
|
return "redirect:/login";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
package com.example.demo.form;
|
package com.example.demo.form;
|
||||||
|
|
||||||
/** 社員登録・編集フォーム */
|
/** 社員登録・編集フォーム */
|
||||||
public class EmployeeForm {
|
public class EmployeeForm {
|
||||||
private Integer idEmployee;
|
private Integer idEmployee;
|
||||||
@@ -10,24 +11,72 @@ public class EmployeeForm {
|
|||||||
private String flgRetirement = "0";
|
private String flgRetirement = "0";
|
||||||
|
|
||||||
public void trim() {
|
public void trim() {
|
||||||
nmEmployee = t(nmEmployee); knEmployee = t(knEmployee); mailAddress = t(mailAddress);
|
nmEmployee = t(nmEmployee);
|
||||||
flgAdmin = t(flgAdmin); flgRetirement = t(flgRetirement);
|
knEmployee = t(knEmployee);
|
||||||
if (password == null) password = "";
|
mailAddress = t(mailAddress);
|
||||||
|
flgAdmin = t(flgAdmin);
|
||||||
|
flgRetirement = t(flgRetirement);
|
||||||
|
if (password == null)
|
||||||
|
password = "";
|
||||||
}
|
}
|
||||||
private static String t(String s) { return s == null ? "" : s.trim(); }
|
|
||||||
|
|
||||||
public Integer getIdEmployee() { return idEmployee; }
|
private static String t(String s) {
|
||||||
public void setIdEmployee(Integer v) { this.idEmployee = v; }
|
return s == null ? "" : s.trim();
|
||||||
public String getNmEmployee() { return nmEmployee; }
|
}
|
||||||
public void setNmEmployee(String v) { this.nmEmployee = v; }
|
|
||||||
public String getKnEmployee() { return knEmployee; }
|
public Integer getIdEmployee() {
|
||||||
public void setKnEmployee(String v) { this.knEmployee = v; }
|
return idEmployee;
|
||||||
public String getMailAddress() { return mailAddress; }
|
}
|
||||||
public void setMailAddress(String v) { this.mailAddress = v; }
|
|
||||||
public String getPassword() { return password; }
|
public void setIdEmployee(Integer v) {
|
||||||
public void setPassword(String v) { this.password = v; }
|
this.idEmployee = v;
|
||||||
public String getFlgAdmin() { return flgAdmin; }
|
}
|
||||||
public void setFlgAdmin(String v) { this.flgAdmin = v; }
|
|
||||||
public String getFlgRetirement() { return flgRetirement; }
|
public String getNmEmployee() {
|
||||||
public void setFlgRetirement(String v) { this.flgRetirement = v; }
|
return nmEmployee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNmEmployee(String v) {
|
||||||
|
this.nmEmployee = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKnEmployee() {
|
||||||
|
return knEmployee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKnEmployee(String v) {
|
||||||
|
this.knEmployee = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMailAddress() {
|
||||||
|
return mailAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMailAddress(String v) {
|
||||||
|
this.mailAddress = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String v) {
|
||||||
|
this.password = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlgAdmin() {
|
||||||
|
return flgAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlgAdmin(String v) {
|
||||||
|
this.flgAdmin = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlgRetirement() {
|
||||||
|
return flgRetirement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlgRetirement(String v) {
|
||||||
|
this.flgRetirement = v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>社員登録完了画面</title>
|
||||||
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- 共通ヘッダー -->
|
||||||
|
<div th:replace="~{fragments/header :: header}"></div>
|
||||||
|
<main class="complete-container">
|
||||||
|
<h2>社員登録完了</h2>
|
||||||
|
<p th:text="${message != null ? message : '社員登録が完了しました。'}">
|
||||||
|
社員登録が完了しました。
|
||||||
|
</p>
|
||||||
|
<a th:href="@{/menu}">メニューへ戻る</a>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>社員登録確認画面</title>
|
||||||
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- 共通ヘッダー -->
|
||||||
|
<div th:replace="~{fragments/header :: header}"></div>
|
||||||
|
<main>
|
||||||
|
<h1>社員登録確認</h1>
|
||||||
|
<!-- エラーメッセージ -->
|
||||||
|
<div class="error"
|
||||||
|
th:if="${errors != null and !errors.isEmpty()}">
|
||||||
|
<p th:each="error : ${errors}"
|
||||||
|
th:text="${error}">
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<p>以下の内容で登録します。内容を確認してください。</p>
|
||||||
|
<!-- 登録ボタン -->
|
||||||
|
<form th:action="@{/admin/employees/new/execute}"
|
||||||
|
th:object="${form}"
|
||||||
|
method="post">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>社員名</th>
|
||||||
|
<td th:text="*{nmEmployee}"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>社員名よみ</th>
|
||||||
|
<td th:text="*{knEmployee}"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>メールアドレス</th>
|
||||||
|
<td th:text="*{mailAddress}"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>パスワード</th>
|
||||||
|
<td>********</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>権限</th>
|
||||||
|
<td th:text="*{flgAdmin == '1' ? '管理者' : '一般'}"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<!-- 登録処理に必要な値を引き継ぐ -->
|
||||||
|
<input type="hidden" th:field="*{nmEmployee}">
|
||||||
|
<input type="hidden" th:field="*{knEmployee}">
|
||||||
|
<input type="hidden" th:field="*{mailAddress}">
|
||||||
|
<input type="hidden" th:field="*{password}">
|
||||||
|
<input type="hidden" th:field="*{flgAdmin}">
|
||||||
|
<div class="actions">
|
||||||
|
<button type="submit" class="btn">
|
||||||
|
登録
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<!-- 入力画面へ戻る -->
|
||||||
|
<form th:action="@{/admin/employees/new/input}"
|
||||||
|
th:object="${form}"
|
||||||
|
method="post">
|
||||||
|
<input type="hidden" th:field="*{nmEmployee}">
|
||||||
|
<input type="hidden" th:field="*{knEmployee}">
|
||||||
|
<input type="hidden" th:field="*{mailAddress}">
|
||||||
|
<input type="hidden" th:field="*{password}">
|
||||||
|
<input type="hidden" th:field="*{flgAdmin}">
|
||||||
|
<div class="back-link">
|
||||||
|
<button type="submit" class="sub">
|
||||||
|
社員情報入力に戻る
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>社員登録画面</title>
|
||||||
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- 共通ヘッダー -->
|
||||||
|
<div th:replace="~{fragments/header :: header}"></div>
|
||||||
|
<!-- 社員登録入力画面 -->
|
||||||
|
<main>
|
||||||
|
<h2>社員登録</h2>
|
||||||
|
<!-- 入力エラー表示 -->
|
||||||
|
<div th:if="${errors != null and !errors.isEmpty()}">
|
||||||
|
<p th:each="error : ${errors}"
|
||||||
|
th:text="${error}"
|
||||||
|
class="error">
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<form th:action="@{/admin/employees/new/confirm}"
|
||||||
|
th:object="${form}"
|
||||||
|
method="post">
|
||||||
|
<div>
|
||||||
|
<label for="nmEmployee">社員名</label>
|
||||||
|
<input type="text"
|
||||||
|
id="nmEmployee"
|
||||||
|
th:field="*{nmEmployee}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="knEmployee">社員名よみ</label>
|
||||||
|
<input type="text"
|
||||||
|
id="knEmployee"
|
||||||
|
th:field="*{knEmployee}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="mailAddress">メールアドレス</label>
|
||||||
|
<input type="email"
|
||||||
|
id="mailAddress"
|
||||||
|
th:field="*{mailAddress}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="password">パスワード</label>
|
||||||
|
<input type="password"
|
||||||
|
id="password"
|
||||||
|
th:field="*{password}">
|
||||||
|
</div>
|
||||||
|
<fieldset>
|
||||||
|
<legend>権限</legend>
|
||||||
|
<label>
|
||||||
|
<input type="radio"
|
||||||
|
th:field="*{flgAdmin}"
|
||||||
|
value="0">
|
||||||
|
一般
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="radio"
|
||||||
|
th:field="*{flgAdmin}"
|
||||||
|
value="1">
|
||||||
|
管理者
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
<button type="submit">登録確認</button>
|
||||||
|
</form>
|
||||||
|
<a th:href="@{/menu}">メニューへ戻る</a>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -23,3 +23,6 @@
|
|||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user