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 @@ -
@@ -45,15 +45,26 @@ - 一覧に戻る + 一覧に戻る - 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 @@ + + + + + + + + + + + + 部署情報更新 + + + +

+ 部署情報更新    +
+ ログイン者名: + +
+

+
+ +
+ +
+ + + + + + + + + + + + +
部署ID + +
部署名 + +
+
+ 一覧に戻る + + + + \ No newline at end of file