1 Commits

Author SHA1 Message Date
t-yuasa
b4ae39c587 機能改修 組織階層構造
・要件定義書
・基本設計書
2026-09-11 09:31:16 +09:00
23 changed files with 105 additions and 252 deletions

View File

@@ -29,10 +29,6 @@ public class Employee {
* パスワード * パスワード
*/ */
private final String password; private final String password;
/**
* 入社年月日
*/
private final String hireDate;
/** /**
* 管理者権限 * 管理者権限
*/ */

View File

@@ -1,13 +1,12 @@
package com.example.rhizome.app.domain.service.impl; package com.example.rhizome.app.domain.service.impl;
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.service.UpdateEmployee; import com.example.rhizome.app.domain.service.UpdateEmployee;
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;
/** /**
* employee の更新系の機能を集約させるサービスクラスです。 * employee の更新系の機能を集約させるサービスクラスです。
@@ -52,7 +51,6 @@ 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.getIdDepartment() == null ? beforeEmployee.getIdDepartment() : updateEmployee.getIdDepartment()
); );

View File

@@ -1,27 +1,16 @@
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.NamedEntityGraph;
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.Employee; import com.example.rhizome.app.domain.model.Employee;
import com.example.rhizome.app.domain.model.EmployeeInfo; 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 org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import javax.persistence.*;
import java.util.List;
/** /**
* Employee + Department の Join 情報を保持するEntity * Employee + Department の Join 情報を保持するEntity
@@ -71,12 +60,6 @@ public class EmployeeDepartmentEntity {
@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;
/** /**
* 管理者権限 * 管理者権限
*/ */
@@ -88,7 +71,6 @@ public class EmployeeDepartmentEntity {
@Fetch(FetchMode.JOIN) @Fetch(FetchMode.JOIN)
private DepartmentEntity department; private DepartmentEntity department;
/** /**
* EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。 * EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。
* *
@@ -107,9 +89,9 @@ public class EmployeeDepartmentEntity {
employeeDepartmentEntity.getKnEmployee(), employeeDepartmentEntity.getKnEmployee(),
employeeDepartmentEntity.getMailAddress(), employeeDepartmentEntity.getMailAddress(),
employeeDepartmentEntity.getPassword(), employeeDepartmentEntity.getPassword(),
employeeDepartmentEntity.getHireDate(),
employeeDepartmentEntity.getAdminAuth(), employeeDepartmentEntity.getAdminAuth(),
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment() ), employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment()
),
new Department( new Department(
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment(), employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment(),
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getNmDepartment() employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getNmDepartment()

View File

@@ -7,23 +7,16 @@
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.Table;
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.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
* *
@@ -68,11 +61,6 @@ 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;
/** /**
* 管理者権限 * 管理者権限
*/ */
@@ -86,7 +74,6 @@ public class EmployeeEntity {
private Integer idDepartment; private Integer idDepartment;
/** /**
* Employee(BusinessLogic 依存)を EmployeeEntity(DataAccess層依存)に変換します。 * Employee(BusinessLogic 依存)を EmployeeEntity(DataAccess層依存)に変換します。
* *
@@ -101,7 +88,6 @@ public class EmployeeEntity {
employee.getKnEmployee(), employee.getKnEmployee(),
employee.getMailAddress(), employee.getMailAddress(),
employee.getPassword(), employee.getPassword(),
employee.getHireDate(),
employee.getAdminAuth(), employee.getAdminAuth(),
employee.getIdDepartment() employee.getIdDepartment()
); );
@@ -142,7 +128,6 @@ public class EmployeeEntity {
employeeEntity.getKnEmployee(), employeeEntity.getKnEmployee(),
employeeEntity.getMailAddress(), employeeEntity.getMailAddress(),
employeeEntity.getPassword(), employeeEntity.getPassword(),
employeeEntity.getHireDate(),
employeeEntity.getAdminAuth(), employeeEntity.getAdminAuth(),
employeeEntity.getIdDepartment() employeeEntity.getIdDepartment()
); );

View File

@@ -1,21 +1,5 @@
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;
@@ -27,6 +11,20 @@ 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;
/** /**
* 新規登録用のコントローラ * 新規登録用のコントローラ
@@ -83,7 +81,6 @@ public class InsertEmployeeController {
insertEmployeeForm.getKnEmployee(), insertEmployeeForm.getKnEmployee(),
insertEmployeeForm.getMailAddress(), insertEmployeeForm.getMailAddress(),
insertEmployeeForm.getPassword(), insertEmployeeForm.getPassword(),
insertEmployeeForm.getHireDate(),
insertEmployeeForm.getAdminAuth(), insertEmployeeForm.getAdminAuth(),
insertEmployeeForm.getIdDepartment() insertEmployeeForm.getIdDepartment()
); );
@@ -128,7 +125,6 @@ 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
) { ) {
@@ -137,7 +133,6 @@ public class InsertEmployeeController {
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 = "所属部署";
@@ -166,11 +161,6 @@ 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) {

View File

@@ -1,17 +1,5 @@
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;
@@ -19,6 +7,16 @@ 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;
/** /**
* 部署検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能 * 部署検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
@@ -62,7 +60,7 @@ public class SelectDepartmentController {
// 作成した部署一覧をセット // 作成した部署一覧をセット
model.addAttribute( model.addAttribute(
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
DepartmentForm.convertFrom(searchDepartment.searchBy(SearchConditionDepartmentForm.convertTo(searchConditionDepartmentForm))) DepartmentForm.convertFrom(searchDepartment.searchByWithLike(SearchConditionDepartmentForm.convertTo(searchConditionDepartmentForm)))
); );
// 検索ページに遷移 // 検索ページに遷移

View File

@@ -1,11 +1,14 @@
package com.example.rhizome.app.presentation.controller; package com.example.rhizome.app.presentation.controller;
import java.util.List; 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 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.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;
@@ -13,16 +16,9 @@ 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 com.example.rhizome.aop.aspect.PermissionCheck; import javax.servlet.http.HttpSession;
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.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;
/** /**
* 社員検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能 * 社員検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
@@ -38,13 +34,12 @@ 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 ,TenureCalc tenureCalc) { public SelectEmployeeController(HttpSession httpSession, SearchDepartment searchDepartment, SearchEmployeeInfo searchEmployeeInfo) {
this.httpSession = httpSession; this.httpSession = httpSession;
this.searchDepartment = searchDepartment; this.searchDepartment = searchDepartment;
this.searchEmployeeInfo = searchEmployeeInfo; this.searchEmployeeInfo = searchEmployeeInfo;
this.tenureCalc = tenureCalc;
} }
@ModelAttribute @ModelAttribute
@@ -75,14 +70,7 @@ public class SelectEmployeeController {
// 検索条件を元に検索を実施 // 検索条件を元に検索を実施
// 取得した EmployeeInfo( employee + department )の情報を画面に返す用の型に詰め替えてセット // 取得した EmployeeInfo( employee + department )の情報を画面に返す用の型に詰め替えてセット
model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST, EmployeeInfoForm.convertFrom(searchEmployeeInfo.searchBy(SearchConditionEmployeeForm.convertTo(searchConditionEmployeeForm))));
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;
@@ -121,16 +109,11 @@ public class SelectEmployeeController {
); );
// 検索条件を元に検索を実施 // 検索条件を元に検索を実施
List<EmployeeInfoForm>employeeInfoForm =EmployeeInfoForm.convertFrom( model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST,
EmployeeInfoForm.convertFrom(
searchEmployeeInfo.searchBy( searchEmployeeInfo.searchBy(
SearchConditionEmployeeForm.convertTo(searchConditionEmployeeForm()) 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;

View File

@@ -1,20 +1,6 @@
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;
@@ -29,6 +15,18 @@ 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 を更新して結果を返す為のコントローラ
@@ -150,10 +148,7 @@ 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後の情報を再取得

View File

@@ -1,20 +1,6 @@
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;
@@ -26,6 +12,18 @@ 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;
/** /**
* 個人情報更新用コントローラ * 個人情報更新用コントローラ
@@ -136,15 +134,11 @@ public class UpdatePersonalEmployeeResultController {
} }
//更新前のEmployeeの情報を取得 //更新前のEmployeeの情報を取得
Employee beforeEmployee =searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee());
updatePersonalUserForm.setHireDate(beforeEmployee.getHireDate());
// 画面用のインスタンスから更新用のインスタンスに変換し、Update実施 // 画面用のインスタンスから更新用のインスタンスに変換し、Update実施
updateEmployee.updateEmployee( updateEmployee.updateEmployee(
beforeEmployee, searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee()),
UpdatePersonalUserForm.convertTo(updatePersonalUserForm)) UpdatePersonalUserForm.convertTo(updatePersonalUserForm)
; );
// ログイン者の情報をセッション情報に格納 // ログイン者の情報をセッション情報に格納
httpSession.setAttribute( httpSession.setAttribute(

View File

@@ -1,14 +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.EmployeeInfo; 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 した構造を扱うクラス
*/ */
@@ -38,15 +37,7 @@ public class EmployeeInfoForm {
*/ */
private String password; private String password;
/** /**
* 入社年月日 * パスワード
*/
private String hireDate;
/**
* 勤続年数
*/
private String tenure;
/**
* 管理者権限
*/ */
private Integer adminAuth; private Integer adminAuth;
/** /**
@@ -72,8 +63,6 @@ public class EmployeeInfoForm {
employeeInfo.getEmployee().getKnEmployee(), employeeInfo.getEmployee().getKnEmployee(),
employeeInfo.getEmployee().getMailAddress(), employeeInfo.getEmployee().getMailAddress(),
employeeInfo.getEmployee().getPassword(), employeeInfo.getEmployee().getPassword(),
employeeInfo.getEmployee().getHireDate(),
null,
employeeInfo.getEmployee().getAdminAuth(), employeeInfo.getEmployee().getAdminAuth(),
employeeInfo.getDepartment().getIdDepartment(), employeeInfo.getDepartment().getIdDepartment(),
employeeInfo.getDepartment().getNmDepartment() employeeInfo.getDepartment().getNmDepartment()

View File

@@ -1,14 +1,13 @@
package com.example.rhizome.app.presentation.form; package com.example.rhizome.app.presentation.form;
import java.util.ArrayList;
import java.util.List;
import com.example.rhizome.app.domain.model.Employee; import com.example.rhizome.app.domain.model.Employee;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
/** /**
* 画面から渡ってきた登録内容をまとめ、再度画面に表示する為のクラス * 画面から渡ってきた登録内容をまとめ、再度画面に表示する為のクラス
*/ */
@@ -41,10 +40,6 @@ public class InsertEmployeeForm {
* 確認用パスワード * 確認用パスワード
*/ */
private String passwordConfirm; private String passwordConfirm;
/**
* 入社年月日
*/
private String hireDate;
/** /**
* 管理者権限 * 管理者権限
@@ -56,7 +51,6 @@ public class InsertEmployeeForm {
*/ */
private Integer idDepartment; private Integer idDepartment;
/** /**
* パスワードのValidation * パスワードのValidation
* チェック対象にエラーが有った場合エラーリストに文言を追加する * チェック対象にエラーが有った場合エラーリストに文言を追加する
@@ -111,7 +105,6 @@ public class InsertEmployeeForm {
insertEmployeeForm.getKnEmployee(), insertEmployeeForm.getKnEmployee(),
insertEmployeeForm.getMailAddress(), insertEmployeeForm.getMailAddress(),
insertEmployeeForm.getPassword(), insertEmployeeForm.getPassword(),
insertEmployeeForm.getHireDate(),
insertEmployeeForm.getAdminAuth(), insertEmployeeForm.getAdminAuth(),
insertEmployeeForm.getIdDepartment() insertEmployeeForm.getIdDepartment()
); );
@@ -128,7 +121,6 @@ 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<>();
@@ -152,9 +144,6 @@ public class InsertEmployeeForm {
if (idDepartment == null) { if (idDepartment == 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;

View File

@@ -1,14 +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.Employee; import com.example.rhizome.app.domain.model.Employee;
import com.example.rhizome.app.domain.model.EmployeeInfo; 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;
/** /**
* 画面から渡ってきた更新内容をまとめ、再度画面に表示する為のクラス * 画面から渡ってきた更新内容をまとめ、再度画面に表示する為のクラス
*/ */
@@ -41,10 +40,6 @@ public class UpdateEmployeeInfoForm {
* パスワード確認用 * パスワード確認用
*/ */
private String passwordConfirm; private String passwordConfirm;
/**
* 入社年月日
*/
private String hireDate;
/** /**
* 管理者権限 * 管理者権限
*/ */
@@ -69,7 +64,6 @@ public class UpdateEmployeeInfoForm {
employeeInfo.getEmployee().getMailAddress(), employeeInfo.getEmployee().getMailAddress(),
employeeInfo.getEmployee().getPassword(), employeeInfo.getEmployee().getPassword(),
null, null,
employeeInfo.getEmployee().getHireDate(),
employeeInfo.getEmployee().getAdminAuth(), employeeInfo.getEmployee().getAdminAuth(),
employeeInfo.getDepartment().getIdDepartment() employeeInfo.getDepartment().getIdDepartment()
); );
@@ -100,7 +94,6 @@ public class UpdateEmployeeInfoForm {
updateEmployeeInfoForm.getKnEmployee(), updateEmployeeInfoForm.getKnEmployee(),
updateEmployeeInfoForm.getMailAddress(), updateEmployeeInfoForm.getMailAddress(),
updateEmployeeInfoForm.getPassword(), updateEmployeeInfoForm.getPassword(),
updateEmployeeInfoForm.getHireDate(),
updateEmployeeInfoForm.getAdminAuth(), updateEmployeeInfoForm.getAdminAuth(),
updateEmployeeInfoForm.getIdDepartment() updateEmployeeInfoForm.getIdDepartment()
); );

View File

@@ -2,7 +2,6 @@ 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;
@@ -38,10 +37,7 @@ public class UpdatePersonalUserForm {
* パスワード確認用 * パスワード確認用
*/ */
private String passwordConfirm; private String passwordConfirm;
/**
* 入社年月日
*/
private String hireDate;
/** /**
* 画面用(presentation 層)の UpdatePersonalUserForm クラスから business 層の Employee クラスに * 画面用(presentation 層)の UpdatePersonalUserForm クラスから business 層の Employee クラスに
@@ -57,7 +53,6 @@ public class UpdatePersonalUserForm {
updatePersonalUserForm.getKnEmployee(), updatePersonalUserForm.getKnEmployee(),
updatePersonalUserForm.getMailAddress(), updatePersonalUserForm.getMailAddress(),
updatePersonalUserForm.getPassword(), updatePersonalUserForm.getPassword(),
updatePersonalUserForm.getHireDate(),
null, null,
null null
); );
@@ -77,9 +72,7 @@ public class UpdatePersonalUserForm {
employee.getKnEmployee(), employee.getKnEmployee(),
employee.getMailAddress(), employee.getMailAddress(),
employee.getPassword(), employee.getPassword(),
null, null
employee.getHireDate()
); );
} }
@@ -97,7 +90,6 @@ public class UpdatePersonalUserForm {
loginUser.getKnEmployee(), loginUser.getKnEmployee(),
loginUser.getMailAddress(), loginUser.getMailAddress(),
loginUser.getPassword(), loginUser.getPassword(),
null,
null null
); );
} }

View File

@@ -89,18 +89,6 @@
</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>

View File

@@ -114,19 +114,6 @@
</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>

View File

@@ -105,8 +105,6 @@
<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>
@@ -119,8 +117,6 @@
<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:text="${employeeInfoForm.nmDepartment}"></td>
<td> <td>

View File

@@ -4,7 +4,6 @@
-- CREATE USER 'rezouser'@'localhost' IDENTIFIED BY 'Rezo_0000'; -- CREATE USER 'rezouser'@'localhost' IDENTIFIED BY 'Rezo_0000';
-- GRANT ALL ON rezodb.* TO 'rezouser'@'localhost'; -- GRANT ALL ON rezodb.* TO 'rezouser'@'localhost';
-- employee<65>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̍쐬 -- employee<65>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̍쐬
DROP TABLE IF EXISTS employee; DROP TABLE IF EXISTS employee;
CREATE TABLE employee ( CREATE TABLE employee (
@@ -15,7 +14,6 @@ CREATE TABLE employee (
, password VARCHAR(10) NOT NULL , password VARCHAR(10) NOT NULL
, admin_auth INT NOT NULL , admin_auth INT NOT NULL
, id_department INT NOT NULL , id_department INT NOT NULL
, hire_date DATE NOT NULL
) )
AUTO_INCREMENT = 10000; AUTO_INCREMENT = 10000;
@@ -28,16 +26,16 @@ CREATE TABLE department (
AUTO_INCREMENT = 10; AUTO_INCREMENT = 10;
-- <20>Ј<EFBFBD><D088>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̃f<CC83>[<5B>^ -- <20>Ј<EFBFBD><D088>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̃f<CC83>[<5B>^
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('<EFBFBD>R<EFBFBD>c<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD><EFBFBD>}<7D>_<EFBFBD>^<5E>c<EFBFBD><63>','yamada@hoge.jp','aaa',1,10,'1990-01-01'); INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('<EFBFBD>R<EFBFBD>c<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD><EFBFBD>}<7D>_<EFBFBD>^<5E>c<EFBFBD><63>','yamada@hoge.jp','aaa',1,10);
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD>^<5E>J<EFBFBD>n<EFBFBD>V<EFBFBD>W<EFBFBD><57><EFBFBD><EFBFBD>','jtaka@hoge.jp','bbb',0,10,'2000-02-02'); INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD>^<5E>J<EFBFBD>n<EFBFBD>V<EFBFBD>W<EFBFBD><57><EFBFBD><EFBFBD>','jtaka@hoge.jp','bbb',0,10);
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('<EFBFBD><EFBFBD><EFBFBD>}<7D>j<EFBFBD><6A>','<EFBFBD>}<7D>G<EFBFBD>_<EFBFBD>t<EFBFBD>~<7E>A<EFBFBD>L','fmak@hoge.jp','ccc',0,11,'1990-02-02'); INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('<EFBFBD><EFBFBD><EFBFBD>}<7D>j<EFBFBD><6A>','<EFBFBD>}<7D>G<EFBFBD>_<EFBFBD>t<EFBFBD>~<7E>A<EFBFBD>L','fmak@hoge.jp','ccc',0,11);
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('<EFBFBD>یˏ͉<EFBFBD>','<EFBFBD>}<7D><><EFBFBD>g<EFBFBD>V<EFBFBD><56><EFBFBD>E<EFBFBD>X<EFBFBD>P','marusyo@hoge.jp','ddd',0,12,'1990-03-03'); INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('<EFBFBD>یˏ͉<EFBFBD>','<EFBFBD>}<7D><><EFBFBD>g<EFBFBD>V<EFBFBD><56><EFBFBD>E<EFBFBD>X<EFBFBD>P','marusyo@hoge.jp','ddd',0,12);
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('<EFBFBD>O<EFBFBD>','<EFBFBD>~<7E><><EFBFBD>P<EFBFBD>^<5E>P<EFBFBD>V','miya@hoge.jp','eee',0,13,'1999-04-04'); INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('<EFBFBD>O<EFBFBD>','<EFBFBD>~<7E><><EFBFBD>P<EFBFBD>^<5E>P<EFBFBD>V','miya@hoge.jp','eee',0,13);
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('<EFBFBD>ۈ<EFBFBD><EFBFBD>I','<EFBFBD>}<7D><><EFBFBD>C<EFBFBD>n<EFBFBD><6E><EFBFBD>J','haru@hoge.jp','fff',0,13,'2000-03-03'); INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('<EFBFBD>ۈ<EFBFBD><EFBFBD>I','<EFBFBD>}<7D><><EFBFBD>C<EFBFBD>n<EFBFBD><6E><EFBFBD>J','haru@hoge.jp','fff',0,13);
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>D','<EFBFBD>X<EFBFBD>Y<EFBFBD><EFBFBD><EFBFBD>g<EFBFBD>J<EFBFBD>I<EFBFBD><EFBFBD>','suzumoto@hoge.jp','ggg',0,13,'2001-05-05'); INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>D','<EFBFBD>X<EFBFBD>Y<EFBFBD><EFBFBD><EFBFBD>g<EFBFBD>J<EFBFBD>I<EFBFBD><EFBFBD>','suzumoto@hoge.jp','ggg',0,13);
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('<EFBFBD>t<EFBFBD>R<EFBFBD><EFBFBD>','<EFBFBD>n<EFBFBD><EFBFBD><EFBFBD>}<7D>~<7E>m<EFBFBD><6D>','mhayama@hoge.jp','hhh',0,14,'2016-08-08'); INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('<EFBFBD>t<EFBFBD>R<EFBFBD><EFBFBD>','<EFBFBD>n<EFBFBD><EFBFBD><EFBFBD>}<7D>~<7E>m<EFBFBD><6D>','mhayama@hoge.jp','hhh',0,14);
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>闢','<EFBFBD>J<EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>~<7E>A<EFBFBD>J<EFBFBD><4A>','kawakami@hoge.jp','iii',0,14,'2025-10-10'); INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>闢','<EFBFBD>J<EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>~<7E>A<EFBFBD>J<EFBFBD><4A>','kawakami@hoge.jp','iii',0,14);
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('<EFBFBD><EFBFBD><EFBFBD>䔣','<EFBFBD>X<EFBFBD>M<EFBFBD>C<EFBFBD>n<EFBFBD>W<EFBFBD><EFBFBD>','sugi@hoge.jp','jjj',0,15,'2026-04-04'); INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('<EFBFBD><EFBFBD><EFBFBD>䔣','<EFBFBD>X<EFBFBD>M<EFBFBD>C<EFBFBD>n<EFBFBD>W<EFBFBD><EFBFBD>','sugi@hoge.jp','jjj',0,15);
-- <20><><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̃f<CC83>[<5B>^ -- <20><><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̃f<CC83>[<5B>^
INSERT INTO department (nm_department) VALUES ('<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'); INSERT INTO department (nm_department) VALUES ('<EFBFBD><EFBFBD><EFBFBD><EFBFBD>');

Binary file not shown.