改修の実装【社員検索機能の項目追加:「入社年月日」、「勤続年数」を追加】
This commit is contained in:
@@ -29,6 +29,10 @@ public class Employee {
|
|||||||
* パスワード
|
* パスワード
|
||||||
*/
|
*/
|
||||||
private final String password;
|
private final String password;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private final String hireDate;
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
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 の更新系の機能を集約させるサービスクラスです。
|
||||||
@@ -51,6 +52,7 @@ 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()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,16 +1,27 @@
|
|||||||
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
|
||||||
@@ -60,6 +71,12 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
@@ -71,6 +88,7 @@ public class EmployeeDepartmentEntity {
|
|||||||
@Fetch(FetchMode.JOIN)
|
@Fetch(FetchMode.JOIN)
|
||||||
private DepartmentEntity department;
|
private DepartmentEntity department;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。
|
* EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。
|
||||||
*
|
*
|
||||||
@@ -89,9 +107,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()
|
||||||
|
|||||||
@@ -7,16 +7,23 @@
|
|||||||
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
|
||||||
*
|
*
|
||||||
@@ -61,6 +68,11 @@ 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;
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
@@ -74,6 +86,7 @@ public class EmployeeEntity {
|
|||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Employee(BusinessLogic 依存)を EmployeeEntity(DataAccess層依存)に変換します。
|
* Employee(BusinessLogic 依存)を EmployeeEntity(DataAccess層依存)に変換します。
|
||||||
*
|
*
|
||||||
@@ -88,6 +101,7 @@ 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()
|
||||||
);
|
);
|
||||||
@@ -128,6 +142,7 @@ 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()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
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;
|
||||||
@@ -11,20 +27,6 @@ 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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新規登録用のコントローラ
|
* 新規登録用のコントローラ
|
||||||
@@ -81,6 +83,7 @@ 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()
|
||||||
);
|
);
|
||||||
@@ -125,6 +128,7 @@ 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
|
||||||
) {
|
) {
|
||||||
@@ -133,6 +137,7 @@ 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 = "所属部署";
|
||||||
|
|
||||||
@@ -161,6 +166,11 @@ 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) {
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import java.util.List;
|
||||||
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.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import javax.servlet.http.HttpSession;
|
||||||
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;
|
||||||
@@ -16,9 +13,16 @@ 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 javax.servlet.http.HttpSession;
|
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 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 社員検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
|
* 社員検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
|
||||||
@@ -34,12 +38,13 @@ 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) {
|
public SelectEmployeeController(HttpSession httpSession, SearchDepartment searchDepartment, SearchEmployeeInfo searchEmployeeInfo ,TenureCalc tenureCalc) {
|
||||||
this.httpSession = httpSession;
|
this.httpSession = httpSession;
|
||||||
this.searchDepartment = searchDepartment;
|
this.searchDepartment = searchDepartment;
|
||||||
this.searchEmployeeInfo = searchEmployeeInfo;
|
this.searchEmployeeInfo = searchEmployeeInfo;
|
||||||
|
this.tenureCalc = tenureCalc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModelAttribute
|
@ModelAttribute
|
||||||
@@ -70,7 +75,14 @@ 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;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
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 した構造を扱うクラス
|
||||||
*/
|
*/
|
||||||
@@ -37,7 +38,15 @@ public class EmployeeInfoForm {
|
|||||||
*/
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
/**
|
/**
|
||||||
* パスワード
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private String hireDate;
|
||||||
|
/**
|
||||||
|
* 勤続年数
|
||||||
|
*/
|
||||||
|
private String tenure;
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
private Integer adminAuth;
|
private Integer adminAuth;
|
||||||
/**
|
/**
|
||||||
@@ -63,6 +72,8 @@ 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()
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面から渡ってきた登録内容をまとめ、再度画面に表示する為のクラス
|
* 画面から渡ってきた登録内容をまとめ、再度画面に表示する為のクラス
|
||||||
*/
|
*/
|
||||||
@@ -40,6 +41,10 @@ public class InsertEmployeeForm {
|
|||||||
* 確認用パスワード
|
* 確認用パスワード
|
||||||
*/
|
*/
|
||||||
private String passwordConfirm;
|
private String passwordConfirm;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private String hireDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
@@ -51,6 +56,7 @@ public class InsertEmployeeForm {
|
|||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* パスワードのValidation
|
* パスワードのValidation
|
||||||
* チェック対象にエラーが有った場合エラーリストに文言を追加する
|
* チェック対象にエラーが有った場合エラーリストに文言を追加する
|
||||||
@@ -105,6 +111,7 @@ 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()
|
||||||
);
|
);
|
||||||
@@ -121,6 +128,7 @@ 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<>();
|
||||||
|
|
||||||
@@ -144,6 +152,9 @@ 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;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面から渡ってきた更新内容をまとめ、再度画面に表示する為のクラス
|
* 画面から渡ってきた更新内容をまとめ、再度画面に表示する為のクラス
|
||||||
*/
|
*/
|
||||||
@@ -94,6 +95,7 @@ public class UpdateEmployeeInfoForm {
|
|||||||
updateEmployeeInfoForm.getKnEmployee(),
|
updateEmployeeInfoForm.getKnEmployee(),
|
||||||
updateEmployeeInfoForm.getMailAddress(),
|
updateEmployeeInfoForm.getMailAddress(),
|
||||||
updateEmployeeInfoForm.getPassword(),
|
updateEmployeeInfoForm.getPassword(),
|
||||||
|
null,
|
||||||
updateEmployeeInfoForm.getAdminAuth(),
|
updateEmployeeInfoForm.getAdminAuth(),
|
||||||
updateEmployeeInfoForm.getIdDepartment()
|
updateEmployeeInfoForm.getIdDepartment()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -89,6 +89,18 @@
|
|||||||
</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>
|
||||||
|
|||||||
@@ -114,6 +114,19 @@
|
|||||||
</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>
|
||||||
|
|||||||
@@ -105,6 +105,8 @@
|
|||||||
<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>
|
||||||
@@ -117,6 +119,8 @@
|
|||||||
<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>
|
||||||
|
|||||||
Reference in New Issue
Block a user