Compare commits
6 Commits
master
...
14c1f9521c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14c1f9521c | ||
|
|
5ba4106d45 | ||
|
|
53c704d2a7 | ||
|
|
de546cea2f | ||
|
|
d939ad8f0b | ||
|
|
15c21735ee |
@@ -29,6 +29,10 @@ public class Employee {
|
||||
* パスワード
|
||||
*/
|
||||
private final String password;
|
||||
/**
|
||||
* 入社年月日
|
||||
*/
|
||||
private final String hireDate;
|
||||
/**
|
||||
* 管理者権限
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
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.service.UpdateEmployee;
|
||||
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
||||
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 の更新系の機能を集約させるサービスクラスです。
|
||||
@@ -51,6 +52,7 @@ public class UpdateEmployeeImpl implements UpdateEmployee {
|
||||
updateEmployee.getKnEmployee(),
|
||||
updateEmployee.getMailAddress(),
|
||||
updateEmployee.getPassword().isBlank() ? beforeEmployee.getPassword() : updateEmployee.getPassword(),
|
||||
updateEmployee.getHireDate(),
|
||||
updateEmployee.getAdminAuth() == null ? beforeEmployee.getAdminAuth() : updateEmployee.getAdminAuth(),
|
||||
updateEmployee.getIdDepartment() == null ? beforeEmployee.getIdDepartment() : updateEmployee.getIdDepartment()
|
||||
);
|
||||
|
||||
@@ -1,16 +1,27 @@
|
||||
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.Employee;
|
||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Fetch;
|
||||
import org.hibernate.annotations.FetchMode;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Employee + Department の Join 情報を保持するEntity
|
||||
@@ -60,6 +71,12 @@ public class EmployeeDepartmentEntity {
|
||||
@Column(name = "password", nullable = false)
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 入社年月日
|
||||
*/
|
||||
@Column(name = "hire_date", nullable = false)
|
||||
private String hireDate;
|
||||
|
||||
/**
|
||||
* 管理者権限
|
||||
*/
|
||||
@@ -70,6 +87,7 @@ public class EmployeeDepartmentEntity {
|
||||
@JoinColumn(name = "id_department", referencedColumnName = "id_department", insertable = false, updatable = false)
|
||||
@Fetch(FetchMode.JOIN)
|
||||
private DepartmentEntity department;
|
||||
|
||||
|
||||
/**
|
||||
* EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。
|
||||
@@ -89,9 +107,9 @@ public class EmployeeDepartmentEntity {
|
||||
employeeDepartmentEntity.getKnEmployee(),
|
||||
employeeDepartmentEntity.getMailAddress(),
|
||||
employeeDepartmentEntity.getPassword(),
|
||||
employeeDepartmentEntity.getHireDate(),
|
||||
employeeDepartmentEntity.getAdminAuth(),
|
||||
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment()
|
||||
),
|
||||
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment() ),
|
||||
new Department(
|
||||
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment(),
|
||||
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getNmDepartment()
|
||||
|
||||
@@ -7,16 +7,23 @@
|
||||
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.LoginUser;
|
||||
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* EmployeeテーブルのEntity
|
||||
*
|
||||
@@ -61,6 +68,11 @@ public class EmployeeEntity {
|
||||
@Column(name = "password", nullable = false)
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 入社年月日
|
||||
*/
|
||||
@Column(name = "hire_Date", nullable = false)
|
||||
private String hireDate;
|
||||
/**
|
||||
* 管理者権限
|
||||
*/
|
||||
@@ -72,6 +84,7 @@ public class EmployeeEntity {
|
||||
*/
|
||||
@Column(name = "id_department", nullable = false)
|
||||
private Integer idDepartment;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -88,6 +101,7 @@ public class EmployeeEntity {
|
||||
employee.getKnEmployee(),
|
||||
employee.getMailAddress(),
|
||||
employee.getPassword(),
|
||||
employee.getHireDate(),
|
||||
employee.getAdminAuth(),
|
||||
employee.getIdDepartment()
|
||||
);
|
||||
@@ -128,6 +142,7 @@ public class EmployeeEntity {
|
||||
employeeEntity.getKnEmployee(),
|
||||
employeeEntity.getMailAddress(),
|
||||
employeeEntity.getPassword(),
|
||||
employeeEntity.getHireDate(),
|
||||
employeeEntity.getAdminAuth(),
|
||||
employeeEntity.getIdDepartment()
|
||||
);
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
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.SessionCheck;
|
||||
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.InsertEmployeeForm;
|
||||
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.getMailAddress(),
|
||||
insertEmployeeForm.getPassword(),
|
||||
insertEmployeeForm.getHireDate(),
|
||||
insertEmployeeForm.getAdminAuth(),
|
||||
insertEmployeeForm.getIdDepartment()
|
||||
);
|
||||
@@ -125,6 +128,7 @@ public class InsertEmployeeController {
|
||||
String employeeKana,
|
||||
String mailAddress,
|
||||
String password,
|
||||
String hireDate,
|
||||
Integer management,
|
||||
Integer departmentId
|
||||
) {
|
||||
@@ -133,6 +137,7 @@ public class InsertEmployeeController {
|
||||
final String EMPLOYEE_KANA_NULL_BLANK = "社員名フリガナ";
|
||||
final String MAIL_ADDRESS_NULL_BLANK = "メールアドレス";
|
||||
final String PASSWORD_NULL_BLANK = "パスワード";
|
||||
final String HIREDATE_NULL_BLANK = "入社年月日";
|
||||
final String MANAGEMENT_ERROR = "管理者権限指定";
|
||||
final String DEPARTMENT_ID_NULL_BLANK = "所属部署";
|
||||
|
||||
@@ -161,6 +166,11 @@ public class InsertEmployeeController {
|
||||
// エラー内容を追加
|
||||
error.add(PASSWORD_NULL_BLANK);
|
||||
}
|
||||
// null or 空文字判定
|
||||
if (isNullOrBlank(hireDate)) {
|
||||
// エラー内容を追加
|
||||
error.add(HIREDATE_NULL_BLANK);
|
||||
}
|
||||
|
||||
// 管理者権限の値が不正か
|
||||
if (management == null) {
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
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.SessionCheck;
|
||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||
@@ -7,16 +19,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAt
|
||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 部署検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
|
||||
@@ -60,7 +62,7 @@ public class SelectDepartmentController {
|
||||
// 作成した部署一覧をセット
|
||||
model.addAttribute(
|
||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||
DepartmentForm.convertFrom(searchDepartment.searchByWithLike(SearchConditionDepartmentForm.convertTo(searchConditionDepartmentForm)))
|
||||
DepartmentForm.convertFrom(searchDepartment.searchBy(SearchConditionDepartmentForm.convertTo(searchConditionDepartmentForm)))
|
||||
);
|
||||
|
||||
// 検索ページに遷移
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.example.rhizome.app.presentation.controller;
|
||||
|
||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
||||
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 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;
|
||||
@@ -16,9 +13,16 @@ 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;
|
||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||
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;
|
||||
SearchDepartment searchDepartment;
|
||||
SearchEmployeeInfo searchEmployeeInfo;
|
||||
|
||||
TenureCalc tenureCalc;
|
||||
@Autowired
|
||||
public SelectEmployeeController(HttpSession httpSession, SearchDepartment searchDepartment, SearchEmployeeInfo searchEmployeeInfo) {
|
||||
public SelectEmployeeController(HttpSession httpSession, SearchDepartment searchDepartment, SearchEmployeeInfo searchEmployeeInfo ,TenureCalc tenureCalc) {
|
||||
this.httpSession = httpSession;
|
||||
this.searchDepartment = searchDepartment;
|
||||
this.searchEmployeeInfo = searchEmployeeInfo;
|
||||
this.tenureCalc = tenureCalc;
|
||||
}
|
||||
|
||||
@ModelAttribute
|
||||
@@ -70,7 +75,14 @@ public class SelectEmployeeController {
|
||||
|
||||
// 検索条件を元に検索を実施
|
||||
// 取得した 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;
|
||||
|
||||
@@ -109,11 +121,16 @@ public class SelectEmployeeController {
|
||||
);
|
||||
|
||||
// 検索条件を元に検索を実施
|
||||
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;
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
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.SessionCheck;
|
||||
import com.example.rhizome.app.domain.model.Employee;
|
||||
@@ -15,18 +29,6 @@ import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||
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 を更新して結果を返す為のコントローラ
|
||||
@@ -147,8 +149,11 @@ public class UpdateEmployeeResultController {
|
||||
|
||||
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
||||
}
|
||||
|
||||
updateEmployeeInfoForm.setHireDate(beforeEmployee.getHireDate());
|
||||
|
||||
// 画面用の型からビジネスロジック用のモデルに変換し、Updateを実行
|
||||
|
||||
updateEmployee.updateEmployee(beforeEmployee, UpdateEmployeeInfoForm.convertTo(updateEmployeeInfoForm));
|
||||
|
||||
// Update後の情報を再取得
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
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.SessionCheck;
|
||||
import com.example.rhizome.app.domain.model.Employee;
|
||||
@@ -12,18 +26,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTa
|
||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 個人情報更新用コントローラ
|
||||
@@ -134,11 +136,15 @@ public class UpdatePersonalEmployeeResultController {
|
||||
}
|
||||
|
||||
//更新前のEmployeeの情報を取得
|
||||
Employee beforeEmployee =searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee());
|
||||
|
||||
updatePersonalUserForm.setHireDate(beforeEmployee.getHireDate());
|
||||
|
||||
// 画面用のインスタンスから更新用のインスタンスに変換し、Update実施
|
||||
updateEmployee.updateEmployee(
|
||||
searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee()),
|
||||
UpdatePersonalUserForm.convertTo(updatePersonalUserForm)
|
||||
);
|
||||
beforeEmployee,
|
||||
UpdatePersonalUserForm.convertTo(updatePersonalUserForm))
|
||||
;
|
||||
|
||||
// ログイン者の情報をセッション情報に格納
|
||||
httpSession.setAttribute(
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.example.rhizome.app.presentation.form;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 画面に表示するために employee と department を Join した構造を扱うクラス
|
||||
*/
|
||||
@@ -37,7 +38,15 @@ public class EmployeeInfoForm {
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* パスワード
|
||||
* 入社年月日
|
||||
*/
|
||||
private String hireDate;
|
||||
/**
|
||||
* 勤続年数
|
||||
*/
|
||||
private String tenure;
|
||||
/**
|
||||
* 管理者権限
|
||||
*/
|
||||
private Integer adminAuth;
|
||||
/**
|
||||
@@ -63,6 +72,8 @@ public class EmployeeInfoForm {
|
||||
employeeInfo.getEmployee().getKnEmployee(),
|
||||
employeeInfo.getEmployee().getMailAddress(),
|
||||
employeeInfo.getEmployee().getPassword(),
|
||||
employeeInfo.getEmployee().getHireDate(),
|
||||
null,
|
||||
employeeInfo.getEmployee().getAdminAuth(),
|
||||
employeeInfo.getDepartment().getIdDepartment(),
|
||||
employeeInfo.getDepartment().getNmDepartment()
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
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.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 hireDate;
|
||||
|
||||
/**
|
||||
* 管理者権限
|
||||
@@ -50,6 +55,7 @@ public class InsertEmployeeForm {
|
||||
* 部署ID
|
||||
*/
|
||||
private Integer idDepartment;
|
||||
|
||||
|
||||
/**
|
||||
* パスワードのValidation
|
||||
@@ -105,6 +111,7 @@ public class InsertEmployeeForm {
|
||||
insertEmployeeForm.getKnEmployee(),
|
||||
insertEmployeeForm.getMailAddress(),
|
||||
insertEmployeeForm.getPassword(),
|
||||
insertEmployeeForm.getHireDate(),
|
||||
insertEmployeeForm.getAdminAuth(),
|
||||
insertEmployeeForm.getIdDepartment()
|
||||
);
|
||||
@@ -121,6 +128,7 @@ public class InsertEmployeeForm {
|
||||
final String MAIL_ADDRESS_NULL_BLANK = "メールアドレス";
|
||||
final String MANAGEMENT_ERROR = "管理者権限指定";
|
||||
final String DEPARTMENT_ID_NULL_BLANK = "所属部署";
|
||||
final String HIREDATE_NULL_BLANK ="入社年月日";
|
||||
|
||||
List<String> error = new ArrayList<>();
|
||||
|
||||
@@ -144,6 +152,9 @@ public class InsertEmployeeForm {
|
||||
if (idDepartment == null) {
|
||||
error.add(DEPARTMENT_ID_NULL_BLANK);
|
||||
}
|
||||
if(isNullOrBlank(hireDate)) {
|
||||
error.add(HIREDATE_NULL_BLANK);
|
||||
}
|
||||
|
||||
return error;
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
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.EmployeeInfo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 画面から渡ってきた更新内容をまとめ、再度画面に表示する為のクラス
|
||||
*/
|
||||
@@ -40,6 +41,10 @@ public class UpdateEmployeeInfoForm {
|
||||
* パスワード確認用
|
||||
*/
|
||||
private String passwordConfirm;
|
||||
/**
|
||||
* 入社年月日
|
||||
*/
|
||||
private String hireDate;
|
||||
/**
|
||||
* 管理者権限
|
||||
*/
|
||||
@@ -64,6 +69,7 @@ public class UpdateEmployeeInfoForm {
|
||||
employeeInfo.getEmployee().getMailAddress(),
|
||||
employeeInfo.getEmployee().getPassword(),
|
||||
null,
|
||||
employeeInfo.getEmployee().getHireDate(),
|
||||
employeeInfo.getEmployee().getAdminAuth(),
|
||||
employeeInfo.getDepartment().getIdDepartment()
|
||||
);
|
||||
@@ -94,6 +100,7 @@ public class UpdateEmployeeInfoForm {
|
||||
updateEmployeeInfoForm.getKnEmployee(),
|
||||
updateEmployeeInfoForm.getMailAddress(),
|
||||
updateEmployeeInfoForm.getPassword(),
|
||||
updateEmployeeInfoForm.getHireDate(),
|
||||
updateEmployeeInfoForm.getAdminAuth(),
|
||||
updateEmployeeInfoForm.getIdDepartment()
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.example.rhizome.app.presentation.form;
|
||||
|
||||
import com.example.rhizome.app.domain.model.Employee;
|
||||
import com.example.rhizome.app.domain.model.LoginUser;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -37,7 +38,10 @@ public class UpdatePersonalUserForm {
|
||||
* パスワード確認用
|
||||
*/
|
||||
private String passwordConfirm;
|
||||
|
||||
/**
|
||||
* 入社年月日
|
||||
*/
|
||||
private String hireDate;
|
||||
|
||||
/**
|
||||
* 画面用(presentation 層)の UpdatePersonalUserForm クラスから business 層の Employee クラスに
|
||||
@@ -53,6 +57,7 @@ public class UpdatePersonalUserForm {
|
||||
updatePersonalUserForm.getKnEmployee(),
|
||||
updatePersonalUserForm.getMailAddress(),
|
||||
updatePersonalUserForm.getPassword(),
|
||||
updatePersonalUserForm.getHireDate(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
@@ -72,7 +77,9 @@ public class UpdatePersonalUserForm {
|
||||
employee.getKnEmployee(),
|
||||
employee.getMailAddress(),
|
||||
employee.getPassword(),
|
||||
null
|
||||
null,
|
||||
employee.getHireDate()
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,6 +97,7 @@ public class UpdatePersonalUserForm {
|
||||
loginUser.getKnEmployee(),
|
||||
loginUser.getMailAddress(),
|
||||
loginUser.getPassword(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,6 +89,18 @@
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">入社年月日</th>
|
||||
<td>
|
||||
<label>
|
||||
<input class="readOnly"
|
||||
name="hireDate"
|
||||
readonly="readonly"
|
||||
th:value="*{hireDate}"
|
||||
type="date"/>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">管理者権限</th>
|
||||
<td>
|
||||
|
||||
@@ -114,6 +114,19 @@
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">入社年月日</th>
|
||||
<td>
|
||||
<label>
|
||||
<input
|
||||
placeholder="入社年月日"
|
||||
required="required"
|
||||
th:field="*{hireDate}"
|
||||
type="date"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">管理者権限</th>
|
||||
<td>
|
||||
|
||||
@@ -105,6 +105,8 @@
|
||||
<th style="width: 150px;">フリガナ</th>
|
||||
<th style="width: 150px;">メールアドレス</th>
|
||||
<th style="width: 100px;">パスワード</th>
|
||||
<th style="width: 60px;">入社年月日</th>
|
||||
<th style="width: 60px;">勤続年数</th>
|
||||
<th style="width: 70px;">管理者フラグ</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.mailAddress}"></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.nmDepartment}"></td>
|
||||
<td>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
-- CREATE USER 'rezouser'@'localhost' IDENTIFIED BY 'Rezo_0000';
|
||||
-- GRANT ALL ON rezodb.* TO 'rezouser'@'localhost';
|
||||
|
||||
|
||||
-- employee<65>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̍쐬
|
||||
DROP TABLE IF EXISTS employee;
|
||||
CREATE TABLE employee (
|
||||
@@ -14,6 +15,7 @@ CREATE TABLE employee (
|
||||
, password VARCHAR(10) NOT NULL
|
||||
, admin_auth INT NOT NULL
|
||||
, id_department INT NOT NULL
|
||||
, hire_date DATE NOT NULL
|
||||
)
|
||||
AUTO_INCREMENT = 10000;
|
||||
|
||||
@@ -26,16 +28,16 @@ CREATE TABLE department (
|
||||
AUTO_INCREMENT = 10;
|
||||
|
||||
-- <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) 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) 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) 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) 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) 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) 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) 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) 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) 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) VALUES ('<EFBFBD><EFBFBD><EFBFBD>䔣','<EFBFBD>X<EFBFBD>M<EFBFBD>C<EFBFBD>n<EFBFBD>W<EFBFBD><EFBFBD>','sugi@hoge.jp','jjj',0,15);
|
||||
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, 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, 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, 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, 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, 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, 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, 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, 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, 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');
|
||||
|
||||
-- <20><><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̃f<CC83>[<5B>^
|
||||
INSERT INTO department (nm_department) VALUES ('<EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
設計書/テーブル定義書.xlsm
BIN
設計書/テーブル定義書.xlsm
Binary file not shown.
Reference in New Issue
Block a user