From adf3c9f321a692ca151e2b2b10bf3bf3e7978868 Mon Sep 17 00:00:00 2001
From: o-matsuda <26-o-matsuda-stellatecnica@it-college.co.jp>
Date: Wed, 14 Oct 2026 16:43:20 +0900
Subject: [PATCH] =?UTF-8?q?=E6=AE=B5=E9=9A=8E=EF=BC=93=E5=AE=8C=E4=BA=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../UpdateDepartmentController.java | 10 +--
.../PageReturnAttributeKeyword.java | 2 +-
...artment.html => updateDepartmentForm.html} | 29 +++++---
.../templates/updateDepartmentInput.html | 71 +++++++++++++++++++
4 files changed, 97 insertions(+), 15 deletions(-)
rename src/main/resources/templates/{updateDepartment.html => updateDepartmentForm.html} (64%)
create mode 100644 src/main/resources/templates/updateDepartmentInput.html
diff --git a/src/main/java/com/example/rhizome/app/presentation/controller/UpdateDepartmentController.java b/src/main/java/com/example/rhizome/app/presentation/controller/UpdateDepartmentController.java
index 4cf8892..2848285 100644
--- a/src/main/java/com/example/rhizome/app/presentation/controller/UpdateDepartmentController.java
+++ b/src/main/java/com/example/rhizome/app/presentation/controller/UpdateDepartmentController.java
@@ -67,7 +67,7 @@ public class UpdateDepartmentController {
return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_INFO;
}
// 更新画面に遷移
- model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM,
+ model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_INFO_FORM,
UpdateDepartmentForm.convertFrom(departmentList.get(0)));
// Update画面に遷移
@@ -104,7 +104,7 @@ public class UpdateDepartmentController {
List departmentList = searchDepartment
.searchBy(new com.example.rhizome.app.domain.model.SearchConditionDepartment(null,
updateDepartmentForm.getNmDepartment()));
- if (departmentList == null) {
+ if (departmentList == null && departmentList.isEmpty()){
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR,
new MessageForm(DUPLICATION));
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
@@ -112,17 +112,17 @@ public class UpdateDepartmentController {
List departmentList2 = searchDepartment
.searchBy(new com.example.rhizome.app.domain.model.SearchConditionDepartment(
updateDepartmentForm.getIdDepartment(), null));
- if (departmentList2 == null) {
+ if (departmentList2 == null || departmentList2.isEmpty()) {
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR,
new MessageForm(NO_TARGET));
- return PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM;
+ return PageReturnAttributeKeyword.UPDATE_DEPARTMENT_INFO_FORM;
}
Department department = new Department(updateDepartmentForm.getIdDepartment(),
updateDepartmentForm.getNmDepartment());
updateDepartment.updateDepartment(department);
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_INFO,
new MessageForm(UPDATE_COMPLETE));
- return PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM;
+ return PageReturnAttributeKeyword.UPDATE_DEPARTMENT_INFO_FORM;
} catch (Exception e) {
// ログイン情報の破棄
httpSession.invalidate();
diff --git a/src/main/java/com/example/rhizome/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java b/src/main/java/com/example/rhizome/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java
index 2c6e4ed..6dd3584 100644
--- a/src/main/java/com/example/rhizome/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java
+++ b/src/main/java/com/example/rhizome/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java
@@ -14,6 +14,6 @@ public class PageReturnAttributeKeyword {
public static final String LOGIN_INFO_FORM = "loginInfoForm";
public static final String UPDATE_PERSONAL_EMPLOYEE_USER_FORM = "updatePersonalEmployeeUserForm";
public static final String EMPLOYEE_INFO_FORM_LIST = "employeeInfoFormList";
- public static final String UPDATE_DEPARTMENT_FORM = "updateDepartmentForm";
+ public static final String UPDATE_DEPARTMENT_INFO_FORM = "updateDepartmentForm";
}
diff --git a/src/main/resources/templates/updateDepartment.html b/src/main/resources/templates/updateDepartmentForm.html
similarity index 64%
rename from src/main/resources/templates/updateDepartment.html
rename to src/main/resources/templates/updateDepartmentForm.html
index 4243093..668c4b7 100644
--- a/src/main/resources/templates/updateDepartment.html
+++ b/src/main/resources/templates/updateDepartmentForm.html
@@ -20,7 +20,7 @@
-
+
+ 部署情報更新
+
+ ログイン者名:
+
+
+
+
+ 一覧に戻る
+
-
diff --git a/src/main/resources/templates/updateDepartmentInput.html b/src/main/resources/templates/updateDepartmentInput.html
new file mode 100644
index 0000000..668c4b7
--- /dev/null
+++ b/src/main/resources/templates/updateDepartmentInput.html
@@ -0,0 +1,71 @@
+
+
+
+