Compare commits
7 Commits
o-yamamoto
...
y-okumura
| Author | SHA1 | Date | |
|---|---|---|---|
| 220f35c677 | |||
| 9bd0e21635 | |||
| 15c8303c0d | |||
| 50f7a477e4 | |||
| 97a6138814 | |||
| 9615afffa2 | |||
| cd78bee91f |
@@ -57,9 +57,11 @@
|
|||||||
<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>
|
||||||
</dependency>
|
<version>1.18.30</version>
|
||||||
|
<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,5 +1,7 @@
|
|||||||
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;
|
||||||
|
|
||||||
@@ -37,5 +39,9 @@ public class Employee {
|
|||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private final Integer idDepartment;
|
private final Integer idDepartment;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private final LocalDate dateHired;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
|
|
||||||
@@ -24,5 +26,10 @@ public class EmployeeInfo {
|
|||||||
* 部署名
|
* 部署名
|
||||||
*/
|
*/
|
||||||
private final Department department;
|
private final Department department;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 勤続年数
|
||||||
|
*/
|
||||||
|
private final Period lengthOfService;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
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;
|
||||||
|
|
||||||
@@ -39,6 +41,11 @@ public class LoginUser {
|
|||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private final Integer idDepartment;
|
private final Integer idDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private final LocalDate dateHired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ログインユーザが管理者か
|
* ログインユーザが管理者か
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
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) 検索系の機能を集約させるサービスクラスです
|
||||||
@@ -19,44 +23,55 @@ import java.util.List;
|
|||||||
@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();
|
||||||
* EmployeeInfo (employee join department) のレコードを全件取得
|
List<Period> lengthOfServiceList = new ArrayList<>();
|
||||||
*
|
|
||||||
* @return 取得したレコード全件
|
|
||||||
*/
|
|
||||||
public List<EmployeeInfo> selectAll() {
|
|
||||||
|
|
||||||
return EmployeeDepartmentEntity.createEmployeeInfoList(employeeInfoRepository.findAll());
|
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 をラップしたもの
|
|
||||||
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()))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package com.example.rhizome.app.domain.service.impl;
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
import com.example.rhizome.app.domain.service.UpdateEmployee;
|
import com.example.rhizome.app.domain.service.UpdateEmployee;
|
||||||
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
||||||
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* employee の更新系の機能を集約させるサービスクラスです。
|
* employee の更新系の機能を集約させるサービスクラスです。
|
||||||
@@ -52,7 +53,8 @@ public class UpdateEmployeeImpl implements UpdateEmployee {
|
|||||||
updateEmployee.getMailAddress(),
|
updateEmployee.getMailAddress(),
|
||||||
updateEmployee.getPassword().isBlank() ? beforeEmployee.getPassword() : updateEmployee.getPassword(),
|
updateEmployee.getPassword().isBlank() ? beforeEmployee.getPassword() : updateEmployee.getPassword(),
|
||||||
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()
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,30 @@
|
|||||||
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.stream.IntStream;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.NamedEntityGraph;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Fetch;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.hibernate.annotations.Fetch;
|
|
||||||
import org.hibernate.annotations.FetchMode;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Employee + Department の Join 情報を保持するEntity
|
* Employee + Department の Join 情報を保持するEntity
|
||||||
@@ -70,14 +84,21 @@ public class EmployeeDepartmentEntity {
|
|||||||
@JoinColumn(name = "id_department", referencedColumnName = "id_department", insertable = false, updatable = false)
|
@JoinColumn(name = "id_department", referencedColumnName = "id_department", insertable = false, updatable = false)
|
||||||
@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) {
|
public static EmployeeInfo createEmployeeInfo(EmployeeDepartmentEntity employeeDepartmentEntity, Period lengthOfService) {
|
||||||
|
|
||||||
// コンストラクタを使って書くとSetterを使用するより簡略化出来ます。
|
// コンストラクタを使って書くとSetterを使用するより簡略化出来ます。
|
||||||
// 混乱してしまう人は落ち着いて EmployeeInfo のフィールドを見に行って、
|
// 混乱してしまう人は落ち着いて EmployeeInfo のフィールドを見に行って、
|
||||||
@@ -90,12 +111,14 @@ public class EmployeeDepartmentEntity {
|
|||||||
employeeDepartmentEntity.getMailAddress(),
|
employeeDepartmentEntity.getMailAddress(),
|
||||||
employeeDepartmentEntity.getPassword(),
|
employeeDepartmentEntity.getPassword(),
|
||||||
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
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -105,14 +128,25 @@ public class EmployeeDepartmentEntity {
|
|||||||
* (リスト版)
|
* (リスト版)
|
||||||
*
|
*
|
||||||
* @param employeeDepartmentEntityList EmployeeDepartmentEntity インスタンスのリスト
|
* @param employeeDepartmentEntityList EmployeeDepartmentEntity インスタンスのリスト
|
||||||
|
* @param 勤続年数のリスト
|
||||||
* @return EmployeeInfo インスタンスのリスト
|
* @return EmployeeInfo インスタンスのリスト
|
||||||
*/
|
*/
|
||||||
public static List<EmployeeInfo> createEmployeeInfoList(List<EmployeeDepartmentEntity> employeeDepartmentEntityList) {
|
public static List<EmployeeInfo> createEmployeeInfoList(
|
||||||
|
List<EmployeeDepartmentEntity> employeeDepartmentEntityList,
|
||||||
|
List<Period> lengthOfServiceList) {
|
||||||
|
|
||||||
// StreamAPI を使うとこうなります。
|
if (employeeDepartmentEntityList.size() != lengthOfServiceList.size()) {
|
||||||
return employeeDepartmentEntityList.stream().map(EmployeeDepartmentEntity::createEmployeeInfo).toList();
|
throw new IllegalArgumentException(
|
||||||
|
"社員情報と勤続年数の件数が一致しません。");
|
||||||
|
}
|
||||||
|
|
||||||
|
return IntStream.range(0, employeeDepartmentEntityList.size())
|
||||||
|
.mapToObj(index -> EmployeeDepartmentEntity
|
||||||
|
.createEmployeeInfo(employeeDepartmentEntityList.get(index), lengthOfServiceList.get(index)))
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,16 +7,24 @@
|
|||||||
package com.example.rhizome.app.infra.entity;
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
import com.example.rhizome.app.domain.model.LoginUser;
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EmployeeテーブルのEntity
|
* EmployeeテーブルのEntity
|
||||||
*
|
*
|
||||||
@@ -72,6 +80,12 @@ 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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,7 +103,8 @@ public class EmployeeEntity {
|
|||||||
employee.getMailAddress(),
|
employee.getMailAddress(),
|
||||||
employee.getPassword(),
|
employee.getPassword(),
|
||||||
employee.getAdminAuth(),
|
employee.getAdminAuth(),
|
||||||
employee.getIdDepartment()
|
employee.getIdDepartment(),
|
||||||
|
employee.getDateHired()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +144,8 @@ public class EmployeeEntity {
|
|||||||
employeeEntity.getMailAddress(),
|
employeeEntity.getMailAddress(),
|
||||||
employeeEntity.getPassword(),
|
employeeEntity.getPassword(),
|
||||||
employeeEntity.getAdminAuth(),
|
employeeEntity.getAdminAuth(),
|
||||||
employeeEntity.getIdDepartment()
|
employeeEntity.getIdDepartment(),
|
||||||
|
employeeEntity.getDateHired()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +183,8 @@ public class EmployeeEntity {
|
|||||||
getMailAddress(),
|
getMailAddress(),
|
||||||
getPassword(),
|
getPassword(),
|
||||||
getAdminAuth(),
|
getAdminAuth(),
|
||||||
getIdDepartment()
|
getIdDepartment(),
|
||||||
|
getDateHired()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
||||||
@@ -11,20 +28,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTa
|
|||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
import com.example.rhizome.app.presentation.form.InsertEmployeeForm;
|
import com.example.rhizome.app.presentation.form.InsertEmployeeForm;
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_EMPLOYEE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新規登録用のコントローラ
|
* 新規登録用のコントローラ
|
||||||
@@ -82,7 +85,8 @@ public class InsertEmployeeController {
|
|||||||
insertEmployeeForm.getMailAddress(),
|
insertEmployeeForm.getMailAddress(),
|
||||||
insertEmployeeForm.getPassword(),
|
insertEmployeeForm.getPassword(),
|
||||||
insertEmployeeForm.getAdminAuth(),
|
insertEmployeeForm.getAdminAuth(),
|
||||||
insertEmployeeForm.getIdDepartment()
|
insertEmployeeForm.getIdDepartment(),
|
||||||
|
insertEmployeeForm.getDateHired()
|
||||||
);
|
);
|
||||||
|
|
||||||
// エラーが1件以上有る場合
|
// エラーが1件以上有る場合
|
||||||
@@ -126,7 +130,8 @@ public class InsertEmployeeController {
|
|||||||
String mailAddress,
|
String mailAddress,
|
||||||
String password,
|
String password,
|
||||||
Integer management,
|
Integer management,
|
||||||
Integer departmentId
|
Integer departmentId,
|
||||||
|
LocalDate hireDate
|
||||||
) {
|
) {
|
||||||
|
|
||||||
final String EMPLOYEE_NAME_NULL_BLANK = "社員名";
|
final String EMPLOYEE_NAME_NULL_BLANK = "社員名";
|
||||||
@@ -135,6 +140,7 @@ public class InsertEmployeeController {
|
|||||||
final String PASSWORD_NULL_BLANK = "パスワード";
|
final String PASSWORD_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<>();
|
||||||
|
|
||||||
@@ -173,6 +179,12 @@ 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;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
package com.example.rhizome.app.presentation.controller;
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
@@ -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.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
import com.example.rhizome.app.presentation.form.SearchConditionDepartmentForm;
|
import com.example.rhizome.app.presentation.form.SearchConditionDepartmentForm;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
|
* 部署検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
|
||||||
@@ -60,7 +62,7 @@ public class SelectDepartmentController {
|
|||||||
// 作成した部署一覧をセット
|
// 作成した部署一覧をセット
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
DepartmentForm.convertFrom(searchDepartment.searchByWithLike(SearchConditionDepartmentForm.convertTo(searchConditionDepartmentForm)))
|
DepartmentForm.convertFrom(searchDepartment.searchBy(SearchConditionDepartmentForm.convertTo(searchConditionDepartmentForm)))
|
||||||
);
|
);
|
||||||
|
|
||||||
// 検索ページに遷移
|
// 検索ページに遷移
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
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 com.example.rhizome.app.domain.model.EmployeeInfo;
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面に表示するために employee と department を Join した構造を扱うクラス
|
* 画面に表示するために employee と department を Join した構造を扱うクラス
|
||||||
*/
|
*/
|
||||||
@@ -48,6 +51,16 @@ public class EmployeeInfoForm {
|
|||||||
* 部署名
|
* 部署名
|
||||||
*/
|
*/
|
||||||
private String nmDepartment;
|
private String nmDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private LocalDate dateHired;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 勤続年数
|
||||||
|
*/
|
||||||
|
private String lengthOfService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の EmployeeInfo クラスから画面用(presentation 層)の EmployeeInfoForm に
|
* business 層の EmployeeInfo クラスから画面用(presentation 層)の EmployeeInfoForm に
|
||||||
@@ -57,6 +70,11 @@ 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(),
|
||||||
@@ -65,7 +83,9 @@ public class EmployeeInfoForm {
|
|||||||
employeeInfo.getEmployee().getPassword(),
|
employeeInfo.getEmployee().getPassword(),
|
||||||
employeeInfo.getEmployee().getAdminAuth(),
|
employeeInfo.getEmployee().getAdminAuth(),
|
||||||
employeeInfo.getDepartment().getIdDepartment(),
|
employeeInfo.getDepartment().getIdDepartment(),
|
||||||
employeeInfo.getDepartment().getNmDepartment()
|
employeeInfo.getDepartment().getNmDepartment(),
|
||||||
|
employeeInfo.getEmployee().getDateHired(),
|
||||||
|
lengthOfService
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
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.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;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面から渡ってきた登録内容をまとめ、再度画面に表示する為のクラス
|
* 画面から渡ってきた登録内容をまとめ、再度画面に表示する為のクラス
|
||||||
*/
|
*/
|
||||||
@@ -50,6 +54,13 @@ public class InsertEmployeeForm {
|
|||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate dateHired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* パスワードのValidation
|
* パスワードのValidation
|
||||||
@@ -106,7 +117,8 @@ public class InsertEmployeeForm {
|
|||||||
insertEmployeeForm.getMailAddress(),
|
insertEmployeeForm.getMailAddress(),
|
||||||
insertEmployeeForm.getPassword(),
|
insertEmployeeForm.getPassword(),
|
||||||
insertEmployeeForm.getAdminAuth(),
|
insertEmployeeForm.getAdminAuth(),
|
||||||
insertEmployeeForm.getIdDepartment()
|
insertEmployeeForm.getIdDepartment(),
|
||||||
|
insertEmployeeForm.getDateHired()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,6 +133,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 = "入社年月日";
|
||||||
|
|
||||||
List<String> error = new ArrayList<>();
|
List<String> error = new ArrayList<>();
|
||||||
|
|
||||||
@@ -133,6 +146,9 @@ 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);
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
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;
|
||||||
@@ -40,6 +43,11 @@ public class LoginUserForm {
|
|||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private LocalDate dateHired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の LoginUser クラスから画面用(presentation 層)の LoginUserForm に
|
* business 層の LoginUser クラスから画面用(presentation 層)の LoginUserForm に
|
||||||
@@ -56,7 +64,8 @@ public class LoginUserForm {
|
|||||||
loginUser.getMailAddress(),
|
loginUser.getMailAddress(),
|
||||||
loginUser.getPassword(),
|
loginUser.getPassword(),
|
||||||
loginUser.getAdminAuth(),
|
loginUser.getAdminAuth(),
|
||||||
loginUser.getIdDepartment()
|
loginUser.getIdDepartment(),
|
||||||
|
loginUser.getDateHired()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +84,8 @@ public class LoginUserForm {
|
|||||||
loginUserForm.getMailAddress(),
|
loginUserForm.getMailAddress(),
|
||||||
loginUserForm.getPassword(),
|
loginUserForm.getPassword(),
|
||||||
loginUserForm.getAdminAuth(),
|
loginUserForm.getAdminAuth(),
|
||||||
loginUserForm.getIdDepartment()
|
loginUserForm.getIdDepartment(),
|
||||||
|
loginUserForm.getDateHired()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
package com.example.rhizome.app.presentation.form;
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Employee;
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 画面から渡ってきた更新内容をまとめ、再度画面に表示する為のクラス
|
* 画面から渡ってきた更新内容をまとめ、再度画面に表示する為のクラス
|
||||||
*/
|
*/
|
||||||
@@ -48,6 +50,10 @@ public class UpdateEmployeeInfoForm {
|
|||||||
* 部署ID
|
* 部署ID
|
||||||
*/
|
*/
|
||||||
private Integer idDepartment;
|
private Integer idDepartment;
|
||||||
|
/**
|
||||||
|
* 入社年月日
|
||||||
|
*/
|
||||||
|
private LocalDate dateHired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* business 層の EmployeeInfo クラスから画面用(presentation 層)の UpdateEmployeeInfoForm に
|
* business 層の EmployeeInfo クラスから画面用(presentation 層)の UpdateEmployeeInfoForm に
|
||||||
@@ -65,7 +71,8 @@ public class UpdateEmployeeInfoForm {
|
|||||||
employeeInfo.getEmployee().getPassword(),
|
employeeInfo.getEmployee().getPassword(),
|
||||||
null,
|
null,
|
||||||
employeeInfo.getEmployee().getAdminAuth(),
|
employeeInfo.getEmployee().getAdminAuth(),
|
||||||
employeeInfo.getDepartment().getIdDepartment()
|
employeeInfo.getDepartment().getIdDepartment(),
|
||||||
|
employeeInfo.getEmployee().getDateHired()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +102,8 @@ public class UpdateEmployeeInfoForm {
|
|||||||
updateEmployeeInfoForm.getMailAddress(),
|
updateEmployeeInfoForm.getMailAddress(),
|
||||||
updateEmployeeInfoForm.getPassword(),
|
updateEmployeeInfoForm.getPassword(),
|
||||||
updateEmployeeInfoForm.getAdminAuth(),
|
updateEmployeeInfoForm.getAdminAuth(),
|
||||||
updateEmployeeInfoForm.getIdDepartment()
|
updateEmployeeInfoForm.getIdDepartment(),
|
||||||
|
updateEmployeeInfoForm.getDateHired()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.Employee;
|
||||||
import com.example.rhizome.app.domain.model.LoginUser;
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -54,6 +55,7 @@ public class UpdatePersonalUserForm {
|
|||||||
updatePersonalUserForm.getMailAddress(),
|
updatePersonalUserForm.getMailAddress(),
|
||||||
updatePersonalUserForm.getPassword(),
|
updatePersonalUserForm.getPassword(),
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,155 +3,143 @@
|
|||||||
|
|
||||||
<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"
|
<form action="insertEmployee" id="insertForm" method="post" th:object="${insertEmployeeForm}">
|
||||||
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"
|
<input class="readOnly" name="empId" readonly="readonly" type="text" value="自動で設定されます" />
|
||||||
name="empId"
|
</label>
|
||||||
readonly="readonly"
|
</td>
|
||||||
type="text"
|
</tr>
|
||||||
value="自動で設定されます"/>
|
<tr>
|
||||||
</label>
|
<th class="header">社員名</th>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
<label>
|
||||||
<tr>
|
<input class="readOnly" name="nmEmployee" readonly="readonly" th:value="*{nmEmployee}"
|
||||||
<th class="header">社員名</th>
|
type="text" />
|
||||||
<td>
|
</label>
|
||||||
<label>
|
</td>
|
||||||
<input class="readOnly"
|
</tr>
|
||||||
name="nmEmployee"
|
<tr>
|
||||||
readonly="readonly"
|
<th class="header">社員名フリガナ</th>
|
||||||
th:value="*{nmEmployee}"
|
<td>
|
||||||
type="text"/>
|
<label>
|
||||||
</label>
|
<input class="readOnly" name="knEmployee" readonly="readonly" th:value="*{knEmployee}"
|
||||||
</td>
|
type="text" />
|
||||||
</tr>
|
</label>
|
||||||
<tr>
|
</td>
|
||||||
<th class="header">社員名フリガナ</th>
|
</tr>
|
||||||
<td>
|
<tr>
|
||||||
<label>
|
<th class="header">メールアドレス</th>
|
||||||
<input class="readOnly"
|
<td>
|
||||||
name="knEmployee"
|
<label>
|
||||||
readonly="readonly"
|
<input class="readOnly" name="mailAddress" readonly="readonly" th:value="*{mailAddress}"
|
||||||
th:value="*{knEmployee}"
|
type="text" />
|
||||||
type="text"/>
|
</label>
|
||||||
</label>
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<th class="header">パスワード</th>
|
||||||
<th class="header">メールアドレス</th>
|
<td>
|
||||||
<td>
|
<label>
|
||||||
<label>
|
<input class="readOnly" name="password" readonly="readonly" th:value="*{password}"
|
||||||
<input class="readOnly"
|
type="password" />
|
||||||
name="mailAddress"
|
</label>
|
||||||
readonly="readonly"
|
</td>
|
||||||
th:value="*{mailAddress}"
|
</tr>
|
||||||
type="text"/>
|
<tr>
|
||||||
</label>
|
<th class="header">管理者権限</th>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
<label>
|
||||||
<tr>
|
<input id="adminAuth1" name="adminAuth" onclick="return false;"
|
||||||
<th class="header">パスワード</th>
|
th:checked="${insertEmployeeForm .adminAuth == 1}" type="radio" value="1"> 管理者権限
|
||||||
<td>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input class="readOnly"
|
<input id="adminAuth0" name="adminAuth" onclick="return false;"
|
||||||
name="password"
|
th:checked="${insertEmployeeForm.adminAuth == null or insertEmployeeForm.adminAuth == 0}"
|
||||||
readonly="readonly"
|
type="radio" value="0">
|
||||||
th:value="*{password}"
|
一般権限
|
||||||
type="password"/>
|
</label>
|
||||||
</label>
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<th class="header">所属部署</th>
|
||||||
<th class="header">管理者権限</th>
|
<td>
|
||||||
<td>
|
<label>
|
||||||
<label>
|
<select name="idDepartment" required="required" th:field="*{idDepartment}">
|
||||||
<input id="adminAuth1" name="adminAuth" onclick="return false;"
|
<th:block th:each="department : ${departmentFormList}">
|
||||||
th:checked="${insertEmployeeForm .adminAuth == 1}" type="radio"
|
<th:block
|
||||||
value="1"> 管理者権限
|
th:if="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}">
|
||||||
</label>
|
<option th:text="${department.nmDepartment}" th:value="${department.idDepartment}">
|
||||||
<label>
|
</option>
|
||||||
<input id="adminAuth0" name="adminAuth" onclick="return false;"
|
</th:block>
|
||||||
th:checked="${insertEmployeeForm.adminAuth == null or insertEmployeeForm.adminAuth == 0}"
|
</th:block>
|
||||||
type="radio"
|
</select>
|
||||||
value="0">
|
</label>
|
||||||
一般権限
|
</td>
|
||||||
</label>
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
</tr>
|
<th class="header">入社年月日</th>
|
||||||
<tr>
|
<td>
|
||||||
<th class="header">所属部署</th>
|
<label>
|
||||||
<td>
|
<input class="readOnly" name="dateHired" readonly="readonly" th:value="*{dateHired}"
|
||||||
<label>
|
type="text" />
|
||||||
<select name="idDepartment" required="required" th:field="*{idDepartment}">
|
</label>
|
||||||
<th:block th:each="department : ${departmentFormList}">
|
</td>
|
||||||
<th:block
|
</tr>
|
||||||
th:if="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}">
|
<tr>
|
||||||
<option th:text="${department.nmDepartment}"
|
<td class="btnArea" colspan="2">
|
||||||
th:value="${department.idDepartment}">
|
<input type="submit" value="登録" />
|
||||||
</option>
|
</td>
|
||||||
</th:block>
|
</tr>
|
||||||
</th:block>
|
</table>
|
||||||
</select>
|
<a href="javascript:onClickEdit()">登録内容の編集</a> | <a href="showMenu">メニューに戻る</a>
|
||||||
</label>
|
</form>
|
||||||
</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,156 +3,135 @@
|
|||||||
|
|
||||||
<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"
|
<form action="insertEmployeeConfirm" method="post" th:object="${insertEmployeeForm}">
|
||||||
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"
|
<input class="readOnly" readonly="readonly" type="text" value="自動で設定されます" />
|
||||||
readonly="readonly"
|
</label>
|
||||||
type="text"
|
</td>
|
||||||
value="自動で設定されます"
|
</tr>
|
||||||
/>
|
<tr>
|
||||||
</label>
|
<th class="header">社員名</th>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
<label>
|
||||||
<tr>
|
<input maxlength="50" placeholder="社員名" required="required" th:field="*{nmEmployee}"
|
||||||
<th class="header">社員名</th>
|
type="text" />
|
||||||
<td>
|
</label>
|
||||||
<label>
|
</td>
|
||||||
<input maxlength="50"
|
</tr>
|
||||||
placeholder="社員名"
|
<tr>
|
||||||
required="required"
|
<th class="header">社員名フリガナ</th>
|
||||||
th:field="*{nmEmployee}"
|
<td>
|
||||||
type="text"
|
<label>
|
||||||
/>
|
<input maxlength="50" oninput="convertToKatakana(this)" placeholder="フリガナ" required="required"
|
||||||
</label>
|
th:field="*{knEmployee}" type="text" />
|
||||||
</td>
|
</label>
|
||||||
</tr>
|
</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th class="header">社員名フリガナ</th>
|
<tr>
|
||||||
<td>
|
<th class="header">メールアドレス</th>
|
||||||
<label>
|
<td>
|
||||||
<input maxlength="50"
|
<label>
|
||||||
oninput="convertToKatakana(this)"
|
<input maxlength="100" placeholder="メールアドレス" required="required" th:field="*{mailAddress}"
|
||||||
placeholder="フリガナ"
|
type="email" />
|
||||||
required="required"
|
</label>
|
||||||
th:field="*{knEmployee}"
|
</td>
|
||||||
type="text"
|
</tr>
|
||||||
/>
|
<tr>
|
||||||
</label>
|
<th class="header">パスワード</th>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
<label>
|
||||||
<tr>
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$" placeholder="パスワード"
|
||||||
<th class="header">メールアドレス</th>
|
required="required" th:field="*{password}" type="password" />
|
||||||
<td>
|
</label>
|
||||||
<label>
|
</td>
|
||||||
<input maxlength="100"
|
</tr>
|
||||||
placeholder="メールアドレス"
|
<!-- *** Chrome等のブラウザの場合自動でセットされる可能性があるので注意書きを外にも *** -->
|
||||||
required="required"
|
<tr>
|
||||||
th:field="*{mailAddress}"
|
<th></th>
|
||||||
type="email"
|
<td><span style="font-size:8pt; font-weight:bold; color:red;">※半角英数字をそれぞれ1種類以上含む3-10文字</span>
|
||||||
/>
|
</td>
|
||||||
</label>
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
</tr>
|
<th class="header">パスワード確認用</th>
|
||||||
<tr>
|
<td>
|
||||||
<th class="header">パスワード</th>
|
<label>
|
||||||
<td>
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$" placeholder="パスワード確認用"
|
||||||
<label>
|
required="required" th:field="*{passwordConfirm}" type="password" />
|
||||||
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
</label>
|
||||||
placeholder="パスワード"
|
</td>
|
||||||
required="required"
|
</tr>
|
||||||
th:field="*{password}"
|
<tr>
|
||||||
type="password"
|
<th class="header">管理者権限</th>
|
||||||
/>
|
<td>
|
||||||
</label>
|
<label>
|
||||||
</td>
|
<input id="adminAuth1" name="adminAuth" th:checked="${insertEmployeeForm .adminAuth == 1}"
|
||||||
</tr>
|
type="radio" value="1"> 管理者権限
|
||||||
<!-- *** Chrome等のブラウザの場合自動でセットされる可能性があるので注意書きを外にも *** -->
|
</label>
|
||||||
<tr>
|
<label>
|
||||||
<th></th>
|
<input id="adminAuth0" name="adminAuth"
|
||||||
<td><span
|
th:checked="${insertEmployeeForm.adminAuth == null or insertEmployeeForm.adminAuth == 0}"
|
||||||
style="font-size:8pt; font-weight:bold; color:red;">※半角英数字をそれぞれ1種類以上含む3-10文字</span>
|
type="radio" value="0">
|
||||||
</td>
|
一般権限
|
||||||
</tr>
|
</label>
|
||||||
<tr>
|
</td>
|
||||||
<th class="header">パスワード確認用</th>
|
</tr>
|
||||||
<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 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:text="${department.nmDepartment}" th:value="${department.idDepartment}">
|
||||||
th:value="${department.idDepartment}">
|
</option>
|
||||||
</option>
|
</select>
|
||||||
</select>
|
</label>
|
||||||
</label>
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<th class="header">入社年月日</th>
|
||||||
<td class="btnArea" colspan="2">
|
<td>
|
||||||
<input type="submit" value="登録確認"/>
|
<label>
|
||||||
</td>
|
<input required="required" th:field="*{dateHired}"
|
||||||
</tr>
|
type="date" />
|
||||||
</table>
|
</label>
|
||||||
</form>
|
</td>
|
||||||
<a href="showMenu">メニューに戻る</a>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="登録確認" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<a href="showMenu">メニューに戻る</a>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -107,7 +107,9 @@
|
|||||||
<th style="width: 100px;">パスワード</th>
|
<th style="width: 100px;">パスワード</th>
|
||||||
<th style="width: 70px;">管理者フラグ</th>
|
<th style="width: 70px;">管理者フラグ</th>
|
||||||
<th style="width: 150px;">所属部署</th>
|
<th style="width: 150px;">所属部署</th>
|
||||||
<th style="width: 150px;">操作</th>
|
<th style="width: 80px;">入社年月日</th>
|
||||||
|
<th style="width: 80px;">勤続年数</th>
|
||||||
|
<th style="width: 100px;">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -119,6 +121,8 @@
|
|||||||
<td th:text="${employeeInfoForm.password}"></td>
|
<td th:text="${employeeInfoForm.password}"></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;">
|
||||||
|
|||||||
Binary file not shown.
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