From 820d0306025673f6567dffc2014cfe8376622065 Mon Sep 17 00:00:00 2001 From: o-yamamoto <2026_04_00886@it-college.co.jp> Date: Mon, 28 Sep 2026 14:26:46 +0900 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E5=93=A1=E6=83=85=E5=A0=B1=E7=99=BB?= =?UTF-8?q?=E9=8C=B2=E6=99=82=E3=81=AE=E3=83=97=E3=83=AB=E3=83=80=E3=82=A6?= =?UTF-8?q?=E3=83=B3=E3=81=AE=E5=88=86=E5=89=B2=E5=8C=96=E3=81=AE=E7=9B=B8?= =?UTF-8?q?=E8=AB=87=E3=81=AE=E5=8F=82=E7=85=A7=E7=94=A8=E3=81=AE=E4=B8=80?= =?UTF-8?q?=E6=99=82=E3=83=97=E3=83=83=E3=82=B7=E3=83=A5=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InsertEmployeeInputController.java | 162 +++++++++--------- .../templates/insertEmployeeInput.html | 124 +++++++------- 2 files changed, 147 insertions(+), 139 deletions(-) diff --git a/EM-System/src/main/java/com/example/rhizome/app/presentation/controller/InsertEmployeeInputController.java b/EM-System/src/main/java/com/example/rhizome/app/presentation/controller/InsertEmployeeInputController.java index 0601db0..5b053b0 100644 --- a/EM-System/src/main/java/com/example/rhizome/app/presentation/controller/InsertEmployeeInputController.java +++ b/EM-System/src/main/java/com/example/rhizome/app/presentation/controller/InsertEmployeeInputController.java @@ -2,6 +2,7 @@ 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; @@ -10,9 +11,12 @@ 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.SessionCheck; @@ -20,7 +24,9 @@ import com.example.rhizome.app.domain.service.RegisterEmployee; 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.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; /** @@ -51,44 +57,14 @@ public class InsertEmployeeInputController { return new InsertEmployeeForm(); } - - /** - * 登録画面表示処理 - * - * @param insertEmployeeForm 登録画面のフォーム - * @param model ビューにデータを渡すためのコンテナ - * @return 遷移先の画面 - */ - @SessionCheck - @PermissionCheck - @RequestMapping(value = INSERT_EMPLOYEE_INPUT, method = RequestMethod.POST) - public String insertInput(InsertEmployeeForm insertEmployeeForm, Model model) { - - try { - // 部署コードリストを作成し、画面に返す値としてセット - model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST - ,DepartmentForm.convertFrom( - searchDepartment.searchAllDepartmentTable())); - - // パラメータをセット - model.addAttribute(PageReturnAttributeKeyword.INSERT_EMPLOYEE_FORM, insertEmployeeForm); - - // 登録画面に遷移 - return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_INPUT_HTML; - - } catch (Exception e) { - // ログイン情報の破棄 - httpSession.invalidate(); - - e.printStackTrace(); - - // エラーログ出力 - LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e); - // エラー画面遷移 - return TransitionTargetPageNameKeyword.ERROR_HTML; - } - } - //プルダウン絞り込み実装用 + //プルダウン絞り込み無し実装用 +// /** +// * 登録画面表示処理 +// * +// * @param insertEmployeeForm 登録画面のフォーム +// * @param model ビューにデータを渡すためのコンテナ +// * @return 遷移先の画面 +// */ // @SessionCheck // @PermissionCheck // @RequestMapping(value = INSERT_EMPLOYEE_INPUT, method = RequestMethod.POST) @@ -97,7 +73,7 @@ public class InsertEmployeeInputController { // try { // // 部署コードリストを作成し、画面に返す値としてセット // model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST -// ,HeadquartersInfoForm.convertFrom( +// ,DepartmentForm.convertFrom( // searchDepartment.searchAllDepartmentTable())); // // // パラメータをセット @@ -118,45 +94,75 @@ public class InsertEmployeeInputController { // return TransitionTargetPageNameKeyword.ERROR_HTML; // } // } + //プルダウン絞り込み実装用 + @SessionCheck + @PermissionCheck + @RequestMapping(value = INSERT_EMPLOYEE_INPUT, method = RequestMethod.POST) + public String insertInput(InsertEmployeeForm insertEmployeeForm, Model model) { + + try { + // 部署コードリストを作成し、画面に返す値としてセット + model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST + ,HeadquartersInfoForm.convertFrom( + searchDepartment.searchAllDepartmentTable())); + + // パラメータをセット + model.addAttribute(PageReturnAttributeKeyword.INSERT_EMPLOYEE_FORM, insertEmployeeForm); + + // 登録画面に遷移 + return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_INPUT_HTML; + + } catch (Exception e) { + // ログイン情報の破棄 + httpSession.invalidate(); + + e.printStackTrace(); + + // エラーログ出力 + LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e); + // エラー画面遷移 + return TransitionTargetPageNameKeyword.ERROR_HTML; + } + } -// @GetMapping("insertEmployeeInput/searchDepartment" ) -// @ResponseBody -// public ListdepartmentsByHeadquarters( -// @RequestParam("id_headquarters")Integer idHeadquarters){ -// System.out.println("koko"); -// -// List departmentByHeadquarters= -// DepartmentInfoForm.convertFrom( -// searchDepartment.searchByIdHeadquarters(idHeadquarters)); -// System.out.println("2"); -// return departmentByHeadquarters -// .stream() -// .map(DepartmentInfoForm-> new DepartmentInfoForm( -// DepartmentInfoForm.getIdDepartment(), -// DepartmentInfoForm.getNmDepartment())) -// .distinct() -// .toList(); -// -// -// } -// @GetMapping("/insertEmployeeInput/searchDepartment/searchDivision") -// @ResponseBody -// public ListdivisionBydepartment( -// @RequestParam("idDepartment")Integer idDepartment){ -// List divisionBydepartment= -// DivisionInfoForm.convertFrom( -// searchDepartment.searchByIdDepartment(idDepartment)); -// -// return divisionBydepartment -// .stream() -// .map(DivisionInfoForm-> new DivisionInfoForm( -// DivisionInfoForm.getIdDivision(), -// DivisionInfoForm.getNmDivision())) -// .distinct() -// .toList(); -// -// -// } + @GetMapping("insertEmployeeInput/searchDepartment" ) + @ResponseBody + public ListdepartmentsByHeadquarters( + @RequestParam("id_headquarters")Integer idHeadquarters){ + System.out.println("koko"); + + List departmentByHeadquarters= + DepartmentInfoForm.convertFrom( + searchDepartment.searchByIdHeadquarters(idHeadquarters)); + System.out.println("2"); + return departmentByHeadquarters + .stream() + .map(DepartmentInfoForm-> new DepartmentInfoForm( + DepartmentInfoForm.getIdDepartment(), + DepartmentInfoForm.getNmDepartment())) + .distinct() + .toList(); + + + } + @GetMapping("/insertEmployeeInput/searchDepartment/searchDivision") + @ResponseBody + public ListdivisionBydepartment( + @RequestParam("idDepartment")Integer idDepartment){ + List divisionBydepartment= + DivisionInfoForm.convertFrom( + searchDepartment.searchByIdDepartment(idDepartment)); + + return divisionBydepartment + .stream() + .map(DivisionInfoForm-> new DivisionInfoForm( + DivisionInfoForm.getIdDivision(), + DivisionInfoForm.getNmDivision())) + .distinct() + .toList(); + + + } } diff --git a/EM-System/src/main/resources/templates/insertEmployeeInput.html b/EM-System/src/main/resources/templates/insertEmployeeInput.html index e40c173..020b697 100644 --- a/EM-System/src/main/resources/templates/insertEmployeeInput.html +++ b/EM-System/src/main/resources/templates/insertEmployeeInput.html @@ -167,43 +167,45 @@ 所属部 - - - + + + + - + + + + + - - + + 所属課 - + + + + + + + + + + - - - - - + @@ -217,46 +219,46 @@ メニューに戻る - - - - +--> + \ No newline at end of file