Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14c1f9521c | ||
|
|
5ba4106d45 | ||
|
|
53c704d2a7 | ||
|
|
de546cea2f | ||
|
|
d939ad8f0b | ||
|
|
15c21735ee |
+3
-5
@@ -57,11 +57,9 @@
|
|||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.30</version>
|
</dependency>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.example.rhizome.app.domain.model;
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -31,6 +29,10 @@ public class Employee {
|
|||||||
* パスワード
|
* パスワード
|
||||||
*/
|
*/
|
||||||
private final String password;
|
private final String password;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private final String hireDate;
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
@@ -39,9 +41,5 @@ public class Employee {
|
|||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private final Integer idDepartment;
|
private final Integer idDepartment;
|
||||||
/**
|
|
||||||
* 入社年月日
|
|
||||||
*/
|
|
||||||
private final LocalDate dateHired;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.example.rhizome.app.domain.model;
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
import java.time.Period;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -27,9 +25,4 @@ public class EmployeeInfo {
|
|||||||
*/
|
*/
|
||||||
private final Department department;
|
private final Department department;
|
||||||
|
|
||||||
/**
|
|
||||||
* 勤続年数
|
|
||||||
*/
|
|
||||||
private final Period lengthOfService;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.example.rhizome.app.domain.model;
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -42,11 +40,6 @@ public class LoginUser {
|
|||||||
*/
|
*/
|
||||||
private final Integer idDepartment;
|
private final Integer idDepartment;
|
||||||
|
|
||||||
/**
|
|
||||||
* 入社年月日
|
|
||||||
*/
|
|
||||||
private final LocalDate dateHired;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ログインユーザが管理者か
|
* ログインユーザが管理者か
|
||||||
*
|
*
|
||||||
|
|||||||
+43
-58
@@ -1,20 +1,16 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.Period;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
||||||
import com.example.rhizome.app.infra.entity.EmployeeDepartmentEntity;
|
import com.example.rhizome.app.infra.entity.EmployeeDepartmentEntity;
|
||||||
import com.example.rhizome.app.infra.repository.EmployeeInfoRepository;
|
import com.example.rhizome.app.infra.repository.EmployeeInfoRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SearchEmployeeInfoImpl (employee join department) 検索系の機能を集約させるサービスクラスです
|
* SearchEmployeeInfoImpl (employee join department) 検索系の機能を集約させるサービスクラスです
|
||||||
@@ -23,55 +19,44 @@ import com.example.rhizome.app.infra.repository.EmployeeInfoRepository;
|
|||||||
@Transactional
|
@Transactional
|
||||||
public class SearchEmployeeInfoImpl implements SearchEmployeeInfo {
|
public class SearchEmployeeInfoImpl implements SearchEmployeeInfo {
|
||||||
|
|
||||||
EmployeeInfoRepository employeeInfoRepository;
|
EmployeeInfoRepository employeeInfoRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SearchEmployeeInfoImpl(EmployeeInfoRepository employeeInfoRepository) {
|
public SearchEmployeeInfoImpl(EmployeeInfoRepository employeeInfoRepository) {
|
||||||
this.employeeInfoRepository = employeeInfoRepository;
|
this.employeeInfoRepository = employeeInfoRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* EmployeeInfo (employee join department) のレコードを全件取得
|
|
||||||
*
|
|
||||||
* @return 取得したレコード全件
|
|
||||||
*/
|
|
||||||
public List<EmployeeInfo> selectAll() {
|
|
||||||
|
|
||||||
List<EmployeeDepartmentEntity> entityList = employeeInfoRepository.findAll();
|
|
||||||
List<Period> lengthOfServiceList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (EmployeeDepartmentEntity entity : entityList) {
|
|
||||||
lengthOfServiceList.add(Period.between(entity.getDateHired(), LocalDate.now()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return EmployeeDepartmentEntity.createEmployeeInfoList(entityList, lengthOfServiceList);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SearchConditionEmployee の情報を元に EmployeeInfo (employee join department) のレコードを取得
|
|
||||||
*
|
|
||||||
* @param searchConditionEmployee 検索条件
|
|
||||||
* @return 検索結果のレコードリスト
|
|
||||||
*/
|
|
||||||
public List<EmployeeInfo> searchBy(SearchConditionEmployee searchConditionEmployee) {
|
|
||||||
// 動的に検索条件を絞り込む
|
|
||||||
// Specification は Criteria API の Predicate をラップしたもの
|
|
||||||
List<EmployeeDepartmentEntity> entityList = employeeInfoRepository.findAll(Specification
|
|
||||||
.where(EmployeeInfoRepository.idEmployeeEqual(searchConditionEmployee.getIdEmployee()))
|
|
||||||
.and(EmployeeInfoRepository.nmEmployeeEqual(searchConditionEmployee.getNmEmployee()))
|
|
||||||
.and(EmployeeInfoRepository.knEmployeeEqual(searchConditionEmployee.getKnEmployee()))
|
|
||||||
.and(EmployeeInfoRepository.mailAddressEqual(searchConditionEmployee.getMailAddress()))
|
|
||||||
.and(EmployeeInfoRepository.idDepartmentEqual(searchConditionEmployee.getIdDepartment())));
|
|
||||||
|
|
||||||
List<Period> lengthOfServiceList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (EmployeeDepartmentEntity entity : entityList) {
|
|
||||||
lengthOfServiceList.add(Period.between(entity.getDateHired(), LocalDate.now()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return EmployeeDepartmentEntity.createEmployeeInfoList(entityList, lengthOfServiceList);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* EmployeeInfo (employee join department) のレコードを全件取得
|
||||||
|
*
|
||||||
|
* @return 取得したレコード全件
|
||||||
|
*/
|
||||||
|
public List<EmployeeInfo> selectAll() {
|
||||||
|
|
||||||
|
return EmployeeDepartmentEntity.createEmployeeInfoList(employeeInfoRepository.findAll());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SearchConditionEmployee の情報を元に EmployeeInfo (employee join department) のレコードを取得
|
||||||
|
*
|
||||||
|
* @param searchConditionEmployee 検索条件
|
||||||
|
* @return 検索結果のレコードリスト
|
||||||
|
*/
|
||||||
|
public List<EmployeeInfo> searchBy(SearchConditionEmployee searchConditionEmployee) {
|
||||||
|
// 動的に検索条件を絞り込む
|
||||||
|
// Specification は Criteria API の Predicate をラップしたもの
|
||||||
|
return EmployeeDepartmentEntity
|
||||||
|
.createEmployeeInfoList(
|
||||||
|
employeeInfoRepository.findAll(Specification
|
||||||
|
.where(EmployeeInfoRepository.idEmployeeEqual(searchConditionEmployee.getIdEmployee()))
|
||||||
|
.and(EmployeeInfoRepository.nmEmployeeEqual(searchConditionEmployee.getNmEmployee()))
|
||||||
|
.and(EmployeeInfoRepository.knEmployeeEqual(searchConditionEmployee.getKnEmployee()))
|
||||||
|
.and(EmployeeInfoRepository.mailAddressEqual(searchConditionEmployee.getMailAddress()))
|
||||||
|
.and(EmployeeInfoRepository.idDepartmentEqual(searchConditionEmployee.getIdDepartment()))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -52,9 +52,9 @@ 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()
|
||||||
beforeEmployee.getDateHired()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-29
@@ -1,9 +1,6 @@
|
|||||||
package com.example.rhizome.app.infra.entity;
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.Period;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
@@ -74,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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
@@ -85,20 +88,14 @@ public class EmployeeDepartmentEntity {
|
|||||||
@Fetch(FetchMode.JOIN)
|
@Fetch(FetchMode.JOIN)
|
||||||
private DepartmentEntity department;
|
private DepartmentEntity department;
|
||||||
|
|
||||||
/*
|
|
||||||
* 入社年月日
|
|
||||||
*/
|
|
||||||
@Column(name = "date_hired", nullable = false)
|
|
||||||
private LocalDate dateHired;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。
|
* EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。
|
||||||
*
|
*
|
||||||
* @param employeeDepartmentEntity EmployeeDepartmentEntity のインスタンス
|
* @param employeeDepartmentEntity EmployeeDepartmentEntity のインスタンス
|
||||||
* @param lengthOfService 勤続年数
|
|
||||||
* @return EmployeeInfo のインスタンス
|
* @return EmployeeInfo のインスタンス
|
||||||
*/
|
*/
|
||||||
public static EmployeeInfo createEmployeeInfo(EmployeeDepartmentEntity employeeDepartmentEntity, Period lengthOfService) {
|
public static EmployeeInfo createEmployeeInfo(EmployeeDepartmentEntity employeeDepartmentEntity) {
|
||||||
|
|
||||||
// コンストラクタを使って書くとSetterを使用するより簡略化出来ます。
|
// コンストラクタを使って書くとSetterを使用するより簡略化出来ます。
|
||||||
// 混乱してしまう人は落ち着いて EmployeeInfo のフィールドを見に行って、
|
// 混乱してしまう人は落ち着いて EmployeeInfo のフィールドを見に行って、
|
||||||
@@ -110,15 +107,13 @@ 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() ),
|
||||||
employeeDepartmentEntity.getDateHired()
|
|
||||||
),
|
|
||||||
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()
|
||||||
),
|
)
|
||||||
lengthOfService
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -128,25 +123,14 @@ public class EmployeeDepartmentEntity {
|
|||||||
* (リスト版)
|
* (リスト版)
|
||||||
*
|
*
|
||||||
* @param employeeDepartmentEntityList EmployeeDepartmentEntity インスタンスのリスト
|
* @param employeeDepartmentEntityList EmployeeDepartmentEntity インスタンスのリスト
|
||||||
* @param 勤続年数のリスト
|
|
||||||
* @return EmployeeInfo インスタンスのリスト
|
* @return EmployeeInfo インスタンスのリスト
|
||||||
*/
|
*/
|
||||||
public static List<EmployeeInfo> createEmployeeInfoList(
|
public static List<EmployeeInfo> createEmployeeInfoList(List<EmployeeDepartmentEntity> employeeDepartmentEntityList) {
|
||||||
List<EmployeeDepartmentEntity> employeeDepartmentEntityList,
|
|
||||||
List<Period> lengthOfServiceList) {
|
|
||||||
|
|
||||||
if (employeeDepartmentEntityList.size() != lengthOfServiceList.size()) {
|
// StreamAPI を使うとこうなります。
|
||||||
throw new IllegalArgumentException(
|
return employeeDepartmentEntityList.stream().map(EmployeeDepartmentEntity::createEmployeeInfo).toList();
|
||||||
"社員情報と勤続年数の件数が一致しません。");
|
|
||||||
}
|
|
||||||
|
|
||||||
return IntStream.range(0, employeeDepartmentEntityList.size())
|
|
||||||
.mapToObj(index -> EmployeeDepartmentEntity
|
|
||||||
.createEmployeeInfo(employeeDepartmentEntityList.get(index), lengthOfServiceList.get(index)))
|
|
||||||
.toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
package com.example.rhizome.app.infra.entity;
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
@@ -69,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;
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
@@ -81,11 +85,6 @@ public class EmployeeEntity {
|
|||||||
@Column(name = "id_department", nullable = false)
|
@Column(name = "id_department", nullable = false)
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
|
|
||||||
/**
|
|
||||||
* 入社年月日
|
|
||||||
*/
|
|
||||||
@Column(name = "date_hired", nullable = false)
|
|
||||||
private LocalDate dateHired;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,9 +101,9 @@ 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()
|
||||||
employee.getDateHired()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,9 +142,9 @@ 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()
|
||||||
employeeEntity.getDateHired()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,8 +182,7 @@ public class EmployeeEntity {
|
|||||||
getMailAddress(),
|
getMailAddress(),
|
||||||
getPassword(),
|
getPassword(),
|
||||||
getAdminAuth(),
|
getAdminAuth(),
|
||||||
getIdDepartment(),
|
getIdDepartment()
|
||||||
getDateHired()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-12
@@ -2,7 +2,6 @@ package com.example.rhizome.app.presentation.controller;
|
|||||||
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -84,9 +83,9 @@ 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()
|
||||||
insertEmployeeForm.getDateHired()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// エラーが1件以上有る場合
|
// エラーが1件以上有る場合
|
||||||
@@ -129,18 +128,18 @@ 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
|
||||||
LocalDate hireDate
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
final String EMPLOYEE_NAME_NULL_BLANK = "社員名";
|
final String EMPLOYEE_NAME_NULL_BLANK = "社員名";
|
||||||
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 = "所属部署";
|
||||||
final String HIRE_DATE_NULL_BLANK = "入社年月日";
|
|
||||||
|
|
||||||
List<String> error = new ArrayList<>();
|
List<String> error = new ArrayList<>();
|
||||||
|
|
||||||
@@ -167,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) {
|
||||||
@@ -180,12 +184,6 @@ public class InsertEmployeeController {
|
|||||||
error.add(DEPARTMENT_ID_NULL_BLANK);
|
error.add(DEPARTMENT_ID_NULL_BLANK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// null判定
|
|
||||||
if (hireDate == null) {
|
|
||||||
//エラー内容を追加
|
|
||||||
error.add(HIRE_DATE_NULL_BLANK);
|
|
||||||
}
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-20
@@ -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;
|
||||||
|
|
||||||
@@ -109,11 +121,16 @@ public class SelectEmployeeController {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 検索条件を元に検索を実施
|
// 検索条件を元に検索を実施
|
||||||
model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST,
|
List<EmployeeInfoForm>employeeInfoForm =EmployeeInfoForm.convertFrom(
|
||||||
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;
|
||||||
|
|||||||
+17
-12
@@ -1,6 +1,20 @@
|
|||||||
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;
|
||||||
@@ -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.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 を更新して結果を返す為のコントローラ
|
||||||
@@ -148,7 +150,10 @@ 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後の情報を再取得
|
||||||
|
|||||||
+21
-15
@@ -1,6 +1,20 @@
|
|||||||
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;
|
||||||
@@ -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.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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 個人情報更新用コントローラ
|
* 個人情報更新用コントローラ
|
||||||
@@ -134,11 +136,15 @@ public class UpdatePersonalEmployeeResultController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//更新前のEmployeeの情報を取得
|
//更新前のEmployeeの情報を取得
|
||||||
|
Employee beforeEmployee =searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee());
|
||||||
|
|
||||||
|
updatePersonalUserForm.setHireDate(beforeEmployee.getHireDate());
|
||||||
|
|
||||||
// 画面用のインスタンスから更新用のインスタンスに変換し、Update実施
|
// 画面用のインスタンスから更新用のインスタンスに変換し、Update実施
|
||||||
updateEmployee.updateEmployee(
|
updateEmployee.updateEmployee(
|
||||||
searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee()),
|
beforeEmployee,
|
||||||
UpdatePersonalUserForm.convertTo(updatePersonalUserForm)
|
UpdatePersonalUserForm.convertTo(updatePersonalUserForm))
|
||||||
);
|
;
|
||||||
|
|
||||||
// ログイン者の情報をセッション情報に格納
|
// ログイン者の情報をセッション情報に格納
|
||||||
httpSession.setAttribute(
|
httpSession.setAttribute(
|
||||||
|
|||||||
+12
-21
@@ -1,8 +1,6 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.Period;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
@@ -40,7 +38,15 @@ public class EmployeeInfoForm {
|
|||||||
*/
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
/**
|
/**
|
||||||
* パスワード
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private String hireDate;
|
||||||
|
/**
|
||||||
|
* 勤続年数
|
||||||
|
*/
|
||||||
|
private String tenure;
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
private Integer adminAuth;
|
private Integer adminAuth;
|
||||||
/**
|
/**
|
||||||
@@ -52,16 +58,6 @@ public class EmployeeInfoForm {
|
|||||||
*/
|
*/
|
||||||
private String nmDepartment;
|
private String nmDepartment;
|
||||||
|
|
||||||
/**
|
|
||||||
* 入社年月日
|
|
||||||
*/
|
|
||||||
private LocalDate dateHired;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 勤続年数
|
|
||||||
*/
|
|
||||||
private String lengthOfService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の EmployeeInfo クラスから画面用(presentation 層)の EmployeeInfoForm に
|
* business 層の EmployeeInfo クラスから画面用(presentation 層)の EmployeeInfoForm に
|
||||||
* 変換します。
|
* 変換します。
|
||||||
@@ -70,22 +66,17 @@ public class EmployeeInfoForm {
|
|||||||
* @return クラスから画面用(presentation 層)の EmployeeInfoForm インスタンス
|
* @return クラスから画面用(presentation 層)の EmployeeInfoForm インスタンス
|
||||||
*/
|
*/
|
||||||
public static EmployeeInfoForm convertFrom(EmployeeInfo employeeInfo) {
|
public static EmployeeInfoForm convertFrom(EmployeeInfo employeeInfo) {
|
||||||
Period period = employeeInfo.getLengthOfService();
|
|
||||||
|
|
||||||
String lengthOfService =
|
|
||||||
period.getYears() + "年" + period.getMonths() + "ヵ月";
|
|
||||||
|
|
||||||
return new EmployeeInfoForm(
|
return new EmployeeInfoForm(
|
||||||
employeeInfo.getEmployee().getIdEmployee(),
|
employeeInfo.getEmployee().getIdEmployee(),
|
||||||
employeeInfo.getEmployee().getNmEmployee(),
|
employeeInfo.getEmployee().getNmEmployee(),
|
||||||
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()
|
||||||
employeeInfo.getEmployee().getDateHired(),
|
|
||||||
lengthOfService
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-15
@@ -1,11 +1,8 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -44,6 +41,10 @@ public class InsertEmployeeForm {
|
|||||||
* 確認用パスワード
|
* 確認用パスワード
|
||||||
*/
|
*/
|
||||||
private String passwordConfirm;
|
private String passwordConfirm;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private String hireDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
@@ -55,12 +56,6 @@ public class InsertEmployeeForm {
|
|||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
|
|
||||||
/**
|
|
||||||
* 入社年月日
|
|
||||||
*/
|
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private LocalDate dateHired;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* パスワードのValidation
|
* パスワードのValidation
|
||||||
@@ -116,9 +111,9 @@ 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()
|
||||||
insertEmployeeForm.getDateHired()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +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 HIRE_DATE_NULL = "入社年月日";
|
final String HIREDATE_NULL_BLANK ="入社年月日";
|
||||||
|
|
||||||
List<String> error = new ArrayList<>();
|
List<String> error = new ArrayList<>();
|
||||||
|
|
||||||
@@ -146,9 +141,6 @@ public class InsertEmployeeForm {
|
|||||||
if (isNullOrBlank(mailAddress)) {
|
if (isNullOrBlank(mailAddress)) {
|
||||||
error.add(MAIL_ADDRESS_NULL_BLANK);
|
error.add(MAIL_ADDRESS_NULL_BLANK);
|
||||||
}
|
}
|
||||||
if(dateHired == null) {
|
|
||||||
error.add(HIRE_DATE_NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// パスワードが仕様を満たしているか確認
|
// パスワードが仕様を満たしているか確認
|
||||||
checkPassword(password, passwordConfirm, error);
|
checkPassword(password, passwordConfirm, error);
|
||||||
@@ -160,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;
|
||||||
|
|
||||||
|
|||||||
+2
-12
@@ -1,10 +1,7 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -44,11 +41,6 @@ public class LoginUserForm {
|
|||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
|
|
||||||
/**
|
|
||||||
* 入社年月日
|
|
||||||
*/
|
|
||||||
private LocalDate dateHired;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の LoginUser クラスから画面用(presentation 層)の LoginUserForm に
|
* business 層の LoginUser クラスから画面用(presentation 層)の LoginUserForm に
|
||||||
* 変換します。
|
* 変換します。
|
||||||
@@ -64,8 +56,7 @@ public class LoginUserForm {
|
|||||||
loginUser.getMailAddress(),
|
loginUser.getMailAddress(),
|
||||||
loginUser.getPassword(),
|
loginUser.getPassword(),
|
||||||
loginUser.getAdminAuth(),
|
loginUser.getAdminAuth(),
|
||||||
loginUser.getIdDepartment(),
|
loginUser.getIdDepartment()
|
||||||
loginUser.getDateHired()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,8 +75,7 @@ public class LoginUserForm {
|
|||||||
loginUserForm.getMailAddress(),
|
loginUserForm.getMailAddress(),
|
||||||
loginUserForm.getPassword(),
|
loginUserForm.getPassword(),
|
||||||
loginUserForm.getAdminAuth(),
|
loginUserForm.getAdminAuth(),
|
||||||
loginUserForm.getIdDepartment(),
|
loginUserForm.getIdDepartment()
|
||||||
loginUserForm.getDateHired()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-9
@@ -1,6 +1,5 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
@@ -42,6 +41,10 @@ public class UpdateEmployeeInfoForm {
|
|||||||
* パスワード確認用
|
* パスワード確認用
|
||||||
*/
|
*/
|
||||||
private String passwordConfirm;
|
private String passwordConfirm;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private String hireDate;
|
||||||
/**
|
/**
|
||||||
* 管理者権限
|
* 管理者権限
|
||||||
*/
|
*/
|
||||||
@@ -50,10 +53,6 @@ public class UpdateEmployeeInfoForm {
|
|||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
/**
|
|
||||||
* 入社年月日
|
|
||||||
*/
|
|
||||||
private LocalDate dateHired;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の EmployeeInfo クラスから画面用(presentation 層)の UpdateEmployeeInfoForm に
|
* business 層の EmployeeInfo クラスから画面用(presentation 層)の UpdateEmployeeInfoForm に
|
||||||
@@ -70,9 +69,9 @@ 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()
|
||||||
employeeInfo.getEmployee().getDateHired()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,9 +100,9 @@ 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()
|
||||||
updateEmployeeInfoForm.getDateHired()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -38,7 +38,10 @@ public class UpdatePersonalUserForm {
|
|||||||
* パスワード確認用
|
* パスワード確認用
|
||||||
*/
|
*/
|
||||||
private String passwordConfirm;
|
private String passwordConfirm;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private String hireDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面用(presentation 層)の UpdatePersonalUserForm クラスから business 層の Employee クラスに
|
* 画面用(presentation 層)の UpdatePersonalUserForm クラスから business 層の Employee クラスに
|
||||||
@@ -54,7 +57,7 @@ public class UpdatePersonalUserForm {
|
|||||||
updatePersonalUserForm.getKnEmployee(),
|
updatePersonalUserForm.getKnEmployee(),
|
||||||
updatePersonalUserForm.getMailAddress(),
|
updatePersonalUserForm.getMailAddress(),
|
||||||
updatePersonalUserForm.getPassword(),
|
updatePersonalUserForm.getPassword(),
|
||||||
null,
|
updatePersonalUserForm.getHireDate(),
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
@@ -74,7 +77,9 @@ public class UpdatePersonalUserForm {
|
|||||||
employee.getKnEmployee(),
|
employee.getKnEmployee(),
|
||||||
employee.getMailAddress(),
|
employee.getMailAddress(),
|
||||||
employee.getPassword(),
|
employee.getPassword(),
|
||||||
null
|
null,
|
||||||
|
employee.getHireDate()
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +97,7 @@ public class UpdatePersonalUserForm {
|
|||||||
loginUser.getKnEmployee(),
|
loginUser.getKnEmployee(),
|
||||||
loginUser.getMailAddress(),
|
loginUser.getMailAddress(),
|
||||||
loginUser.getPassword(),
|
loginUser.getPassword(),
|
||||||
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,143 +3,167 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
<!-- 外部のスクリプトファイルを読み込む -->
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
<script th:src="@{/js/common.js}"></script>
|
<script th:src="@{/js/common.js}"></script>
|
||||||
<!-- CSSの読み込み -->
|
<!-- CSSの読み込み -->
|
||||||
<link rel="stylesheet" th:href="@{/css/all.css}">
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
<title>登録内容確認</title>
|
<title>登録内容確認</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>登録内容確認
|
<h1>登録内容確認
|
||||||
<div class="rightSection">
|
<div class="rightSection">
|
||||||
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||||
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<form action="insertEmployee" id="insertForm" method="post" th:object="${insertEmployeeForm}">
|
<form action="insertEmployee"
|
||||||
|
id="insertForm"
|
||||||
|
method="post"
|
||||||
|
th:object="${insertEmployeeForm}">
|
||||||
|
|
||||||
<div class="msgBox error" th:if="${messageError != null}">
|
<div class="msgBox error" th:if="${messageError != null}">
|
||||||
<span class="error" th:each="message : ${messageError.message}" th:text="${message}"></span>
|
<span class="error" th:each="message : ${messageError.message}" th:text="${message}"></span>
|
||||||
</div>
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">社員ID</th>
|
<th class="header">社員ID</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="readOnly" name="empId" readonly="readonly" type="text" value="自動で設定されます" />
|
<input class="readOnly"
|
||||||
</label>
|
name="empId"
|
||||||
</td>
|
readonly="readonly"
|
||||||
</tr>
|
type="text"
|
||||||
<tr>
|
value="自動で設定されます"/>
|
||||||
<th class="header">社員名</th>
|
</label>
|
||||||
<td>
|
</td>
|
||||||
<label>
|
</tr>
|
||||||
<input class="readOnly" name="nmEmployee" readonly="readonly" th:value="*{nmEmployee}"
|
<tr>
|
||||||
type="text" />
|
<th class="header">社員名</th>
|
||||||
</label>
|
<td>
|
||||||
</td>
|
<label>
|
||||||
</tr>
|
<input class="readOnly"
|
||||||
<tr>
|
name="nmEmployee"
|
||||||
<th class="header">社員名フリガナ</th>
|
readonly="readonly"
|
||||||
<td>
|
th:value="*{nmEmployee}"
|
||||||
<label>
|
type="text"/>
|
||||||
<input class="readOnly" name="knEmployee" readonly="readonly" th:value="*{knEmployee}"
|
</label>
|
||||||
type="text" />
|
</td>
|
||||||
</label>
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
</tr>
|
<th class="header">社員名フリガナ</th>
|
||||||
<tr>
|
<td>
|
||||||
<th class="header">メールアドレス</th>
|
<label>
|
||||||
<td>
|
<input class="readOnly"
|
||||||
<label>
|
name="knEmployee"
|
||||||
<input class="readOnly" name="mailAddress" readonly="readonly" th:value="*{mailAddress}"
|
readonly="readonly"
|
||||||
type="text" />
|
th:value="*{knEmployee}"
|
||||||
</label>
|
type="text"/>
|
||||||
</td>
|
</label>
|
||||||
</tr>
|
</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th class="header">パスワード</th>
|
<tr>
|
||||||
<td>
|
<th class="header">メールアドレス</th>
|
||||||
<label>
|
<td>
|
||||||
<input class="readOnly" name="password" readonly="readonly" th:value="*{password}"
|
<label>
|
||||||
type="password" />
|
<input class="readOnly"
|
||||||
</label>
|
name="mailAddress"
|
||||||
</td>
|
readonly="readonly"
|
||||||
</tr>
|
th:value="*{mailAddress}"
|
||||||
<tr>
|
type="text"/>
|
||||||
<th class="header">管理者権限</th>
|
</label>
|
||||||
<td>
|
</td>
|
||||||
<label>
|
</tr>
|
||||||
<input id="adminAuth1" name="adminAuth" onclick="return false;"
|
<tr>
|
||||||
th:checked="${insertEmployeeForm .adminAuth == 1}" type="radio" value="1"> 管理者権限
|
<th class="header">パスワード</th>
|
||||||
</label>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input id="adminAuth0" name="adminAuth" onclick="return false;"
|
<input class="readOnly"
|
||||||
th:checked="${insertEmployeeForm.adminAuth == null or insertEmployeeForm.adminAuth == 0}"
|
name="password"
|
||||||
type="radio" value="0">
|
readonly="readonly"
|
||||||
一般権限
|
th:value="*{password}"
|
||||||
</label>
|
type="password"/>
|
||||||
</td>
|
</label>
|
||||||
</tr>
|
</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th class="header">所属部署</th>
|
<tr>
|
||||||
<td>
|
<th class="header">入社年月日</th>
|
||||||
<label>
|
<td>
|
||||||
<select name="idDepartment" required="required" th:field="*{idDepartment}">
|
<label>
|
||||||
<th:block th:each="department : ${departmentFormList}">
|
<input class="readOnly"
|
||||||
<th:block
|
name="hireDate"
|
||||||
th:if="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}">
|
readonly="readonly"
|
||||||
<option th:text="${department.nmDepartment}" th:value="${department.idDepartment}">
|
th:value="*{hireDate}"
|
||||||
</option>
|
type="date"/>
|
||||||
</th:block>
|
</label>
|
||||||
</th:block>
|
</td>
|
||||||
</select>
|
</tr>
|
||||||
</label>
|
<tr>
|
||||||
</td>
|
<th class="header">管理者権限</th>
|
||||||
</tr>
|
<td>
|
||||||
<tr>
|
<label>
|
||||||
<th class="header">入社年月日</th>
|
<input id="adminAuth1" name="adminAuth" onclick="return false;"
|
||||||
<td>
|
th:checked="${insertEmployeeForm .adminAuth == 1}" type="radio"
|
||||||
<label>
|
value="1"> 管理者権限
|
||||||
<input class="readOnly" name="dateHired" readonly="readonly" th:value="*{dateHired}"
|
</label>
|
||||||
type="text" />
|
<label>
|
||||||
</label>
|
<input id="adminAuth0" name="adminAuth" onclick="return false;"
|
||||||
</td>
|
th:checked="${insertEmployeeForm.adminAuth == null or insertEmployeeForm.adminAuth == 0}"
|
||||||
</tr>
|
type="radio"
|
||||||
<tr>
|
value="0">
|
||||||
<td class="btnArea" colspan="2">
|
一般権限
|
||||||
<input type="submit" value="登録" />
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
<tr>
|
||||||
<a href="javascript:onClickEdit()">登録内容の編集</a> | <a href="showMenu">メニューに戻る</a>
|
<th class="header">所属部署</th>
|
||||||
</form>
|
<td>
|
||||||
|
<label>
|
||||||
|
<select name="idDepartment" required="required" th:field="*{idDepartment}">
|
||||||
|
<th:block th:each="department : ${departmentFormList}">
|
||||||
|
<th:block
|
||||||
|
th:if="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}">
|
||||||
|
<option th:text="${department.nmDepartment}"
|
||||||
|
th:value="${department.idDepartment}">
|
||||||
|
</option>
|
||||||
|
</th:block>
|
||||||
|
</th:block>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="登録"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a href="javascript:onClickEdit()">登録内容の編集</a> | <a href="showMenu">メニューに戻る</a>
|
||||||
|
</form>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function onClickEdit() {
|
function onClickEdit() {
|
||||||
const form = document.getElementById('insertForm');
|
const form = document.getElementById('insertForm');
|
||||||
form.setAttribute('method', 'post');
|
form.setAttribute('method', 'post');
|
||||||
form.setAttribute('action', 'insertEmployeeInput');
|
form.setAttribute('action', 'insertEmployeeInput');
|
||||||
|
|
||||||
// 確認画面から編集画面に戻ってきたときのフラグ(未使用)
|
// 確認画面から編集画面に戻ってきたときのフラグ(未使用)
|
||||||
const inputField = document.createElement("input");
|
const inputField = document.createElement("input");
|
||||||
inputField.setAttribute("type", "hidden");
|
inputField.setAttribute("type", "hidden");
|
||||||
inputField.setAttribute("name", "backFlg");
|
inputField.setAttribute("name", "backFlg");
|
||||||
inputField.setAttribute("value", "edit");
|
inputField.setAttribute("value", "edit");
|
||||||
|
|
||||||
form.appendChild(inputField);
|
form.appendChild(inputField);
|
||||||
|
|
||||||
// フォームをDOMに追加
|
// フォームをDOMに追加
|
||||||
document.body.appendChild(form);
|
document.body.appendChild(form);
|
||||||
|
|
||||||
form.submit();
|
form.submit();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -3,135 +3,169 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
<!-- 外部のスクリプトファイルを読み込む -->
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
<script th:src="@{/js/common.js}"></script>
|
<script th:src="@{/js/common.js}"></script>
|
||||||
<!-- CSSの読み込み -->
|
<!-- CSSの読み込み -->
|
||||||
<link rel="stylesheet" th:href="@{/css/all.css}">
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
<title>社員登録</title>
|
<title>社員登録</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>
|
<h1>
|
||||||
社員登録
|
社員登録
|
||||||
<div class="rightSection">
|
<div class="rightSection">
|
||||||
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||||
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
<form action="insertEmployeeConfirm" method="post" th:object="${insertEmployeeForm}">
|
<form action="insertEmployeeConfirm"
|
||||||
|
method="post"
|
||||||
|
th:object="${insertEmployeeForm}">
|
||||||
|
|
||||||
<div class="msgBox error" th:if="${messageError} != null">
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
<span class="error" th:text="${messageError.message}"></span>
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">社員ID</th>
|
<th class="header">社員ID</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="readOnly" readonly="readonly" type="text" value="自動で設定されます" />
|
<input class="readOnly"
|
||||||
</label>
|
readonly="readonly"
|
||||||
</td>
|
type="text"
|
||||||
</tr>
|
value="自動で設定されます"
|
||||||
<tr>
|
/>
|
||||||
<th class="header">社員名</th>
|
</label>
|
||||||
<td>
|
</td>
|
||||||
<label>
|
</tr>
|
||||||
<input maxlength="50" placeholder="社員名" required="required" th:field="*{nmEmployee}"
|
<tr>
|
||||||
type="text" />
|
<th class="header">社員名</th>
|
||||||
</label>
|
<td>
|
||||||
</td>
|
<label>
|
||||||
</tr>
|
<input maxlength="50"
|
||||||
<tr>
|
placeholder="社員名"
|
||||||
<th class="header">社員名フリガナ</th>
|
required="required"
|
||||||
<td>
|
th:field="*{nmEmployee}"
|
||||||
<label>
|
type="text"
|
||||||
<input maxlength="50" oninput="convertToKatakana(this)" placeholder="フリガナ" required="required"
|
/>
|
||||||
th:field="*{knEmployee}" type="text" />
|
</label>
|
||||||
</label>
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<th class="header">社員名フリガナ</th>
|
||||||
<th class="header">メールアドレス</th>
|
<td>
|
||||||
<td>
|
<label>
|
||||||
<label>
|
<input maxlength="50"
|
||||||
<input maxlength="100" placeholder="メールアドレス" required="required" th:field="*{mailAddress}"
|
oninput="convertToKatakana(this)"
|
||||||
type="email" />
|
placeholder="フリガナ"
|
||||||
</label>
|
required="required"
|
||||||
</td>
|
th:field="*{knEmployee}"
|
||||||
</tr>
|
type="text"
|
||||||
<tr>
|
/>
|
||||||
<th class="header">パスワード</th>
|
</label>
|
||||||
<td>
|
</td>
|
||||||
<label>
|
</tr>
|
||||||
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$" placeholder="パスワード"
|
<tr>
|
||||||
required="required" th:field="*{password}" type="password" />
|
<th class="header">メールアドレス</th>
|
||||||
</label>
|
<td>
|
||||||
</td>
|
<label>
|
||||||
</tr>
|
<input maxlength="100"
|
||||||
<!-- *** Chrome等のブラウザの場合自動でセットされる可能性があるので注意書きを外にも *** -->
|
placeholder="メールアドレス"
|
||||||
<tr>
|
required="required"
|
||||||
<th></th>
|
th:field="*{mailAddress}"
|
||||||
<td><span style="font-size:8pt; font-weight:bold; color:red;">※半角英数字をそれぞれ1種類以上含む3-10文字</span>
|
type="email"
|
||||||
</td>
|
/>
|
||||||
</tr>
|
</label>
|
||||||
<tr>
|
</td>
|
||||||
<th class="header">パスワード確認用</th>
|
</tr>
|
||||||
<td>
|
<tr>
|
||||||
<label>
|
<th class="header">パスワード</th>
|
||||||
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$" placeholder="パスワード確認用"
|
<td>
|
||||||
required="required" th:field="*{passwordConfirm}" type="password" />
|
<label>
|
||||||
</label>
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
</td>
|
placeholder="パスワード"
|
||||||
</tr>
|
required="required"
|
||||||
<tr>
|
th:field="*{password}"
|
||||||
<th class="header">管理者権限</th>
|
type="password"
|
||||||
<td>
|
/>
|
||||||
<label>
|
</label>
|
||||||
<input id="adminAuth1" name="adminAuth" th:checked="${insertEmployeeForm .adminAuth == 1}"
|
</td>
|
||||||
type="radio" value="1"> 管理者権限
|
</tr>
|
||||||
</label>
|
<!-- *** Chrome等のブラウザの場合自動でセットされる可能性があるので注意書きを外にも *** -->
|
||||||
<label>
|
<tr>
|
||||||
<input id="adminAuth0" name="adminAuth"
|
<th></th>
|
||||||
th:checked="${insertEmployeeForm.adminAuth == null or insertEmployeeForm.adminAuth == 0}"
|
<td><span
|
||||||
type="radio" value="0">
|
style="font-size:8pt; font-weight:bold; color:red;">※半角英数字をそれぞれ1種類以上含む3-10文字</span>
|
||||||
一般権限
|
</td>
|
||||||
</label>
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
</tr>
|
<th class="header">パスワード確認用</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="パスワード確認用"
|
||||||
|
required="required"
|
||||||
|
th:field="*{passwordConfirm}"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</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>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth1" name="adminAuth" th:checked="${insertEmployeeForm .adminAuth == 1}"
|
||||||
|
type="radio"
|
||||||
|
value="1"> 管理者権限
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth0" name="adminAuth"
|
||||||
|
th:checked="${insertEmployeeForm.adminAuth == null or insertEmployeeForm.adminAuth == 0}"
|
||||||
|
type="radio"
|
||||||
|
value="0">
|
||||||
|
一般権限
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">所属部署</th>
|
<th class="header">所属部署</th>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<select required="required" th:field="*{idDepartment}">
|
<select required="required" th:field="*{idDepartment}">
|
||||||
<option th:each="department : ${departmentFormList}"
|
<option th:each="department : ${departmentFormList}"
|
||||||
th:selected="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}"
|
th:selected="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}"
|
||||||
th:text="${department.nmDepartment}" th:value="${department.idDepartment}">
|
th:text="${department.nmDepartment}"
|
||||||
</option>
|
th:value="${department.idDepartment}">
|
||||||
</select>
|
</option>
|
||||||
</label>
|
</select>
|
||||||
</td>
|
</label>
|
||||||
</tr>
|
</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th class="header">入社年月日</th>
|
<tr>
|
||||||
<td>
|
<td class="btnArea" colspan="2">
|
||||||
<label>
|
<input type="submit" value="登録確認"/>
|
||||||
<input required="required" th:field="*{dateHired}"
|
</td>
|
||||||
type="date" />
|
</tr>
|
||||||
</label>
|
</table>
|
||||||
</td>
|
</form>
|
||||||
</tr>
|
<a href="showMenu">メニューに戻る</a>
|
||||||
<tr>
|
|
||||||
<td class="btnArea" colspan="2">
|
|
||||||
<input type="submit" value="登録確認" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
<a href="showMenu">メニューに戻る</a>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -105,11 +105,11 @@
|
|||||||
<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: 80px;">入社年月日</th>
|
<th style="width: 150px;">操作</th>
|
||||||
<th style="width: 80px;">勤続年数</th>
|
|
||||||
<th style="width: 100px;">操作</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -119,10 +119,10 @@
|
|||||||
<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 th:text="${employeeInfoForm.dateHired}"></td>
|
|
||||||
<td th:text="${employeeInfoForm.lengthOfService}"></td>
|
|
||||||
<td>
|
<td>
|
||||||
<!-- 更新フォーム -->
|
<!-- 更新フォーム -->
|
||||||
<form action="showUpdateEmployee" method="post" style="display: inline;">
|
<form action="showUpdateEmployee" method="post" style="display: inline;">
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
-- 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テーブルの作成
|
-- employeeテーブルの作成
|
||||||
DROP TABLE IF EXISTS employee;
|
DROP TABLE IF EXISTS employee;
|
||||||
CREATE TABLE employee (
|
CREATE TABLE employee (
|
||||||
@@ -14,6 +15,7 @@ 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;
|
||||||
|
|
||||||
@@ -26,16 +28,16 @@ CREATE TABLE department (
|
|||||||
AUTO_INCREMENT = 10;
|
AUTO_INCREMENT = 10;
|
||||||
|
|
||||||
-- 社員テーブルのデータ
|
-- 社員テーブルのデータ
|
||||||
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('山田龍也','ヤマダタツヤ','yamada@hoge.jp','aaa',1,10);
|
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('山田龍也','ヤマダタツヤ','yamada@hoge.jp','aaa',1,10,'1990-01-01');
|
||||||
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('高橋準','タカハシジュン','jtaka@hoge.jp','bbb',0,10);
|
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('高橋準','タカハシジュン','jtaka@hoge.jp','bbb',0,10,'2000-02-02');
|
||||||
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('麻枝史明','マエダフミアキ','fmak@hoge.jp','ccc',0,11);
|
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('麻枝史明','マエダフミアキ','fmak@hoge.jp','ccc',0,11,'1990-02-02');
|
||||||
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('丸戸章介','マルトショウスケ','marusyo@hoge.jp','ddd',0,12);
|
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('丸戸章介','マルトショウスケ','marusyo@hoge.jp','ddd',0,12,'1990-03-03');
|
||||||
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('三宅武','ミヤケタケシ','miya@hoge.jp','eee',0,13);
|
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('三宅武','ミヤケタケシ','miya@hoge.jp','eee',0,13,'1999-04-04');
|
||||||
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('丸井悠','マルイハルカ','haru@hoge.jp','fff',0,13);
|
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('丸井悠','マルイハルカ','haru@hoge.jp','fff',0,13,'2000-03-03');
|
||||||
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('涼元香織','スズモトカオリ','suzumoto@hoge.jp','ggg',0,13);
|
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('涼元香織','スズモトカオリ','suzumoto@hoge.jp','ggg',0,13,'2001-05-05');
|
||||||
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('葉山稔','ハヤマミノル','mhayama@hoge.jp','hhh',0,14);
|
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('葉山稔','ハヤマミノル','mhayama@hoge.jp','hhh',0,14,'2016-08-08');
|
||||||
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('川上朱里','カワカミアカリ','kawakami@hoge.jp','iii',0,14);
|
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('川上朱里','カワカミアカリ','kawakami@hoge.jp','iii',0,14,'2025-10-10');
|
||||||
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department) VALUES ('杉井肇','スギイハジメ','sugi@hoge.jp','jjj',0,15);
|
INSERT INTO employee (nm_employee, kn_employee, mail_address, password, admin_auth, id_department, hire_date) VALUES ('杉井肇','スギイハジメ','sugi@hoge.jp','jjj',0,15,'2026-04-04');
|
||||||
|
|
||||||
-- 部署テーブルのデータ
|
-- 部署テーブルのデータ
|
||||||
INSERT INTO department (nm_department) VALUES ('役員');
|
INSERT INTO department (nm_department) VALUES ('役員');
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user