first commit
This commit is contained in:
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
2
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
2
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
|
||||||
|
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
|
||||||
24
HELP.md
Normal file
24
HELP.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Getting Started
|
||||||
|
|
||||||
|
### Reference Documentation
|
||||||
|
|
||||||
|
For further reference, please consider the following sections:
|
||||||
|
|
||||||
|
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
|
||||||
|
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.5/maven-plugin/reference/html/)
|
||||||
|
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.5/maven-plugin/reference/html/#build-image)
|
||||||
|
* [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.7.5/reference/htmlsingle/#data.sql.jpa-and-spring-data)
|
||||||
|
* [Thymeleaf](https://docs.spring.io/spring-boot/docs/2.7.5/reference/htmlsingle/#web.servlet.spring-mvc.template-engines)
|
||||||
|
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.7.5/reference/htmlsingle/#web)
|
||||||
|
|
||||||
|
### Guides
|
||||||
|
|
||||||
|
The following guides illustrate how to use some features concretely:
|
||||||
|
|
||||||
|
* [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)
|
||||||
|
* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
|
||||||
|
* [Handling Form Submission](https://spring.io/guides/gs/handling-form-submission/)
|
||||||
|
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
|
||||||
|
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
|
||||||
|
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
|
||||||
|
|
||||||
66
Readme.md
Normal file
66
Readme.md
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
## はじめに(演習の⽬的と取り組み⽅)
|
||||||
|
当演習は、講義で学んだことを⾃⼒で実践できるようになるために実施します。 そのために以下の内容を守って演習に取り組んでください。
|
||||||
|
|
||||||
|
### 納品物、納期を守りましょう
|
||||||
|
この演習は、実際の仕事を想定した内容です。
|
||||||
|
提出物の内容と提出期限は必ず守ってください。
|
||||||
|
作業が間に合わない、提出物に問題が出そうな場合は、**必ずルールにしたがって適切な相⼿に相談してください**。
|
||||||
|
|
||||||
|
### 適切な⼿順で開発しましょう
|
||||||
|
プログラムを書き始める前に、**README.md** や**仕様書**(配布されている場合) を必ず読んでください。
|
||||||
|
「**何を作るのか**」、「**どこまで作ればよいのか**」を理解してから作業を始めてください。
|
||||||
|
|
||||||
|
### 知らないことは⾃分で調べましょう
|
||||||
|
この演習には、**講義で扱っていない内容が⼀部含まれています**。
|
||||||
|
その場合は、インターネットなどで⾃分で調べながら進めてください。
|
||||||
|
調べることも、エンジニアにとって⼤切なスキルの⼀つです。
|
||||||
|
|
||||||
|
# 課題に取りかかる前に…
|
||||||
|
|
||||||
|
設計書フォルダにある「start-db-ddl-dml.sql」をA5m2等で実行し
|
||||||
|
DBの状態をクリアにしてください。
|
||||||
|
|
||||||
|
# プロジェクト読み込み手順
|
||||||
|
|
||||||
|
Eclipse > ファイル > ファイルシステムからプロジェクトを開く >
|
||||||
|
インポート・ソース の右横にある ディレクトリーボタンを押下 > 本ファイル(Readme.md)の上の階層の **01.EM-Spring** フォルダを選択 >
|
||||||
|
画面下部の完了を押下
|
||||||
|
|
||||||
|
## モジュールのインストール
|
||||||
|
|
||||||
|
読み込んだプロジェクト(EM-SpringBoot)を右クリックし 実行 > maven clean > maven install を実施
|
||||||
|
|
||||||
|
## 目的
|
||||||
|
|
||||||
|
部署テーブルのCRUD機能追加をしなさい。
|
||||||
|
※ AOPで実装されているアクセス制御(セッションチェックや管理者権限チェック等)は未実装でかまいません。
|
||||||
|
|
||||||
|
# 第1段階
|
||||||
|
|
||||||
|
部署情報検索更新削除機能設計書と既存の実装を参考に部署検索機能を追加してください。
|
||||||
|
|
||||||
|
検索機能に実装必須な機能
|
||||||
|
・メニュー画面から部署検索、新規登録画面に遷移出来ること
|
||||||
|
・部署IDの完全一致検索
|
||||||
|
・部署名の部分一致検索
|
||||||
|
・検索ボタン
|
||||||
|
・クリアボタン
|
||||||
|
・検索結果表示機能
|
||||||
|
|
||||||
|
# 第2段階
|
||||||
|
|
||||||
|
部署情報検索更新削除機能設計書と既存の実装を参考に各検索結果に削除機能を実装してください。
|
||||||
|
|
||||||
|
# 第3段階(提出可能合格ライン)
|
||||||
|
|
||||||
|
部署情報検索更新削除機能設計書と既存の実装を参考に各検索結果に更新機能を実装してください。
|
||||||
|
|
||||||
|
# 第4段階(チャレンジ問題)
|
||||||
|
|
||||||
|
部署情報検索更新削除機能設計書と既存の実装を参考に部署新規登録機能を実装してください。
|
||||||
|
|
||||||
|
# 第5段階(チャレンジ問題その2)
|
||||||
|
|
||||||
|
既存で実装されているアノテーションの機能を解析し、第1段階目〜4段階目のコントローラに実装してください。
|
||||||
|
|
||||||
|
|
||||||
316
mvnw
vendored
Normal file
316
mvnw
vendored
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Maven Start Up Batch script
|
||||||
|
#
|
||||||
|
# Required ENV vars:
|
||||||
|
# ------------------
|
||||||
|
# JAVA_HOME - location of a JDK home dir
|
||||||
|
#
|
||||||
|
# Optional ENV vars
|
||||||
|
# -----------------
|
||||||
|
# M2_HOME - location of maven2's installed home dir
|
||||||
|
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
# e.g. to debug Maven itself, use
|
||||||
|
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||||
|
|
||||||
|
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||||
|
. /usr/local/etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/mavenrc ] ; then
|
||||||
|
. /etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$HOME/.mavenrc" ] ; then
|
||||||
|
. "$HOME/.mavenrc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OS specific support. $var _must_ be set to either true or false.
|
||||||
|
cygwin=false;
|
||||||
|
darwin=false;
|
||||||
|
mingw=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN*) cygwin=true ;;
|
||||||
|
MINGW*) mingw=true;;
|
||||||
|
Darwin*) darwin=true
|
||||||
|
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||||
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
if [ -x "/usr/libexec/java_home" ]; then
|
||||||
|
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||||
|
else
|
||||||
|
export JAVA_HOME="/Library/Java/Home"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
if [ -r /etc/gentoo-release ] ; then
|
||||||
|
JAVA_HOME=`java-config --jre-home`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$M2_HOME" ] ; then
|
||||||
|
## resolve links - $0 may be a link to maven's home
|
||||||
|
PRG="$0"
|
||||||
|
|
||||||
|
# need this for relative symlinks
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG="`dirname "$PRG"`/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
saveddir=`pwd`
|
||||||
|
|
||||||
|
M2_HOME=`dirname "$PRG"`/..
|
||||||
|
|
||||||
|
# make it fully qualified
|
||||||
|
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||||
|
|
||||||
|
cd "$saveddir"
|
||||||
|
# echo Using m2 at $M2_HOME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $mingw ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
javaExecutable="`which javac`"
|
||||||
|
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||||
|
# readlink(1) is not available as standard on Solaris 10.
|
||||||
|
readLink=`which readlink`
|
||||||
|
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||||
|
if $darwin ; then
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||||
|
else
|
||||||
|
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||||
|
fi
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||||
|
JAVA_HOME="$javaHome"
|
||||||
|
export JAVA_HOME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVACMD" ] ; then
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="`\\unset -f command; \\command -v java`"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||||
|
echo " We cannot execute $JAVACMD" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
echo "Warning: JAVA_HOME environment variable is not set."
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||||
|
|
||||||
|
# traverses directory structure from process work directory to filesystem root
|
||||||
|
# first directory with .mvn subdirectory is considered project base directory
|
||||||
|
find_maven_basedir() {
|
||||||
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "Path not specified to find_maven_basedir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
basedir="$1"
|
||||||
|
wdir="$1"
|
||||||
|
while [ "$wdir" != '/' ] ; do
|
||||||
|
if [ -d "$wdir"/.mvn ] ; then
|
||||||
|
basedir=$wdir
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||||
|
if [ -d "${wdir}" ]; then
|
||||||
|
wdir=`cd "$wdir/.."; pwd`
|
||||||
|
fi
|
||||||
|
# end of workaround
|
||||||
|
done
|
||||||
|
echo "${basedir}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# concatenates all lines of a file
|
||||||
|
concat_lines() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
echo "$(tr -s '\n' ' ' < "$1")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||||
|
if [ -z "$BASE_DIR" ]; then
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
##########################################################################################
|
||||||
|
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||||
|
fi
|
||||||
|
if [ -n "$MVNW_REPOURL" ]; then
|
||||||
|
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
else
|
||||||
|
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
fi
|
||||||
|
while IFS="=" read key value; do
|
||||||
|
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||||
|
esac
|
||||||
|
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Downloading from: $jarUrl"
|
||||||
|
fi
|
||||||
|
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||||
|
if $cygwin; then
|
||||||
|
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v wget > /dev/null; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found wget ... using wget"
|
||||||
|
fi
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
elif command -v curl > /dev/null; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found curl ... using curl"
|
||||||
|
fi
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||||
|
else
|
||||||
|
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Falling back to using Java to download"
|
||||||
|
fi
|
||||||
|
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||||
|
# For Cygwin, switch paths to Windows format before running javac
|
||||||
|
if $cygwin; then
|
||||||
|
javaClass=`cygpath --path --windows "$javaClass"`
|
||||||
|
fi
|
||||||
|
if [ -e "$javaClass" ]; then
|
||||||
|
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||||
|
fi
|
||||||
|
# Compiling the Java class
|
||||||
|
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||||
|
fi
|
||||||
|
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
|
# Running the downloader
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo " - Running MavenWrapperDownloader.java ..."
|
||||||
|
fi
|
||||||
|
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
##########################################################################################
|
||||||
|
# End of extension
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo $MAVEN_PROJECTBASEDIR
|
||||||
|
fi
|
||||||
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||||
|
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||||
|
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
# work with both Windows and non-Windows executions.
|
||||||
|
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||||
|
export MAVEN_CMD_LINE_ARGS
|
||||||
|
|
||||||
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
exec "$JAVACMD" \
|
||||||
|
$MAVEN_OPTS \
|
||||||
|
$MAVEN_DEBUG_OPTS \
|
||||||
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||||
|
"-Dmaven.home=${M2_HOME}" \
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||||
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||||
188
mvnw.cmd
vendored
Normal file
188
mvnw.cmd
vendored
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@REM or more contributor license agreements. See the NOTICE file
|
||||||
|
@REM distributed with this work for additional information
|
||||||
|
@REM regarding copyright ownership. The ASF licenses this file
|
||||||
|
@REM to you under the Apache License, Version 2.0 (the
|
||||||
|
@REM "License"); you may not use this file except in compliance
|
||||||
|
@REM with the License. You may obtain a copy of the License at
|
||||||
|
@REM
|
||||||
|
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@REM
|
||||||
|
@REM Unless required by applicable law or agreed to in writing,
|
||||||
|
@REM software distributed under the License is distributed on an
|
||||||
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
@REM KIND, either express or implied. See the License for the
|
||||||
|
@REM specific language governing permissions and limitations
|
||||||
|
@REM under the License.
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Maven Start Up Batch script
|
||||||
|
@REM
|
||||||
|
@REM Required ENV vars:
|
||||||
|
@REM JAVA_HOME - location of a JDK home dir
|
||||||
|
@REM
|
||||||
|
@REM Optional ENV vars
|
||||||
|
@REM M2_HOME - location of maven2's installed home dir
|
||||||
|
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||||
|
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||||
|
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
@REM e.g. to debug Maven itself, use
|
||||||
|
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||||
|
@echo off
|
||||||
|
@REM set title of command window
|
||||||
|
title %0
|
||||||
|
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||||
|
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||||
|
|
||||||
|
@REM set %HOME% to equivalent of $HOME
|
||||||
|
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||||
|
|
||||||
|
@REM Execute a user defined script before this one
|
||||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||||
|
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||||
|
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||||
|
:skipRcPre
|
||||||
|
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
set ERROR_CODE=0
|
||||||
|
|
||||||
|
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
@REM ==== START VALIDATION ====
|
||||||
|
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME not found in your environment. >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
:OkJHome
|
||||||
|
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||||
|
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
@REM ==== END VALIDATION ====
|
||||||
|
|
||||||
|
:init
|
||||||
|
|
||||||
|
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||||
|
@REM Fallback to current working directory if not found.
|
||||||
|
|
||||||
|
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||||
|
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||||
|
|
||||||
|
set EXEC_DIR=%CD%
|
||||||
|
set WDIR=%EXEC_DIR%
|
||||||
|
:findBaseDir
|
||||||
|
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||||
|
cd ..
|
||||||
|
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||||
|
set WDIR=%CD%
|
||||||
|
goto findBaseDir
|
||||||
|
|
||||||
|
:baseDirFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
goto endDetectBaseDir
|
||||||
|
|
||||||
|
:baseDirNotFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
|
||||||
|
:endDetectBaseDir
|
||||||
|
|
||||||
|
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||||
|
|
||||||
|
@setlocal EnableExtensions EnableDelayedExpansion
|
||||||
|
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||||
|
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||||
|
|
||||||
|
:endReadAdditionalConfig
|
||||||
|
|
||||||
|
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||||
|
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||||
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
|
||||||
|
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||||
|
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
||||||
|
)
|
||||||
|
|
||||||
|
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
if exist %WRAPPER_JAR% (
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Found %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
if not "%MVNW_REPOURL%" == "" (
|
||||||
|
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
)
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||||
|
echo Downloading from: %DOWNLOAD_URL%
|
||||||
|
)
|
||||||
|
|
||||||
|
powershell -Command "&{"^
|
||||||
|
"$webclient = new-object System.Net.WebClient;"^
|
||||||
|
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||||
|
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||||
|
"}"^
|
||||||
|
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||||
|
"}"
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Finished downloading %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@REM End of extension
|
||||||
|
|
||||||
|
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
@REM work with both Windows and non-Windows executions.
|
||||||
|
set MAVEN_CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
%MAVEN_JAVA_EXE% ^
|
||||||
|
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||||
|
%MAVEN_OPTS% ^
|
||||||
|
%MAVEN_DEBUG_OPTS% ^
|
||||||
|
-classpath %WRAPPER_JAR% ^
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||||
|
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:error
|
||||||
|
set ERROR_CODE=1
|
||||||
|
|
||||||
|
:end
|
||||||
|
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||||
|
|
||||||
|
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||||
|
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||||
|
:skipRcPost
|
||||||
|
|
||||||
|
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||||
|
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||||
|
|
||||||
|
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||||
|
|
||||||
|
cmd /C exit /B %ERROR_CODE%
|
||||||
95
pom.xml
Normal file
95
pom.xml
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.7.5</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>com.example.rhizome</groupId>
|
||||||
|
<artifactId>EM-Spring</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>EM-Spring</name>
|
||||||
|
<description>Demo project for Spring Boot</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.12</version>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
15
src/main/java/com/example/rhizome/EmSpringApplication.java
Normal file
15
src/main/java/com/example/rhizome/EmSpringApplication.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package com.example.rhizome;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableAspectJAutoProxy(proxyTargetClass = true)
|
||||||
|
public class EmSpringApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(EmSpringApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
13
src/main/java/com/example/rhizome/ServletInitializer.java
Normal file
13
src/main/java/com/example/rhizome/ServletInitializer.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.example.rhizome;
|
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
|
public class ServletInitializer extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
return application.sources(EmSpringApplication.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
package com.example.rhizome.aop.Handler;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.LoginInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import com.example.rhizome.exception.InsufficientPermissionException;
|
||||||
|
import com.example.rhizome.exception.NoSessionException;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword.LOGIN_INFO_FORM;
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword.MESSAGE_ERROR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 例外処理用のコントローラ
|
||||||
|
*/
|
||||||
|
@ControllerAdvice
|
||||||
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(GlobalExceptionHandler.class.getName());
|
||||||
|
|
||||||
|
private final String SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION = "不正な遷移です。";
|
||||||
|
private final String SEVERE_ERROR_MESSAGE_BAD_REQUEST = "不正なリクエストです。";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* セッションが切れている場合の例外処理
|
||||||
|
*
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(NoSessionException.class)
|
||||||
|
public String handleNoSessionException(Model model, Exception e) {
|
||||||
|
|
||||||
|
model.addAttribute(MESSAGE_ERROR, new MessageForm(SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION));
|
||||||
|
model.addAttribute(LOGIN_INFO_FORM, new LoginInfoForm());
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 権限がない場合の例外処理
|
||||||
|
*
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(InsufficientPermissionException.class)
|
||||||
|
public String handleInsufficientPermissionException(Model model, Exception e) {
|
||||||
|
|
||||||
|
model.addAttribute(MESSAGE_ERROR, new MessageForm(SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION));
|
||||||
|
model.addAttribute(LOGIN_INFO_FORM, new LoginInfoForm());
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* リクエストメソッドが不正な場合の例外処理
|
||||||
|
*
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||||
|
public String handleBadRequestException(Model model, Exception e) {
|
||||||
|
// エラーメッセージやその他の情報をモデルに追加する
|
||||||
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
|
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
|
// カスタムエラーページにリダイレクト
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* その他の例外処理
|
||||||
|
*
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
public String AllException(Model model, Exception e) {
|
||||||
|
// エラーメッセージやその他の情報をモデルに追加する
|
||||||
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
|
// カスタムエラーページにリダイレクト
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.example.rhizome.aop.aspect;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SessionCheckアノテーション
|
||||||
|
* セッションチェックを行うメソッドに付与する
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface PermissionCheck {
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
package com.example.rhizome.aop.aspect;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
|
import com.example.rhizome.exception.InsufficientPermissionException;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Before;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 権限チェック用のAOP
|
||||||
|
*/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class PermissionCheckAspect {
|
||||||
|
|
||||||
|
HttpServletRequest request;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public PermissionCheckAspect(HttpServletRequest request) {
|
||||||
|
this.request = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aspectのフックを定義(今回はPermissionCheckアノテーションが定義されているメソッドが動作するタイミング)
|
||||||
|
@Pointcut("@annotation(com.example.rhizome.aop.aspect.PermissionCheck)")
|
||||||
|
public void permissionCheckMethod() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 権限チェック
|
||||||
|
*/
|
||||||
|
@Before("permissionCheckMethod()")
|
||||||
|
public void checkPermission() {
|
||||||
|
// ログインユーザの取得
|
||||||
|
LoginUserForm loginUserForm = (LoginUserForm) request.getSession().getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
|
// ログインユーザが取得できない場合、または権限がない場合はエラー画面に遷移
|
||||||
|
if (loginUserForm == null || !hasRequiredPermission(request.getRequestURI(), loginUserForm)) {
|
||||||
|
throw new InsufficientPermissionException("不正な遷移です");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 遷移先のURLとログインユーザの権限から、遷移可否を判定する
|
||||||
|
*
|
||||||
|
* @param targetURL 遷移したいURL
|
||||||
|
* @param loginUserForm リクエスト元のユーザ
|
||||||
|
* @return true:遷移可 false:遷移不可
|
||||||
|
*/
|
||||||
|
private boolean hasRequiredPermission(String targetURL, LoginUserForm loginUserForm) {
|
||||||
|
|
||||||
|
// 管理者権限
|
||||||
|
if (isAdminTransition(targetURL, loginUserForm)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 一般権限
|
||||||
|
if (isUserTransition(targetURL, loginUserForm)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// アクセス不許可の場合の処理(不正アクセス画面に遷移)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理者用のアカウントで管理者向けのページアクセスか
|
||||||
|
*
|
||||||
|
* @param targetURL 遷移したいURL
|
||||||
|
* @param loginUserForm リクエスト元のユーザ
|
||||||
|
* @return true:遷移可 false:遷移不可
|
||||||
|
*/
|
||||||
|
private boolean isAdminTransition(String targetURL, LoginUserForm loginUserForm) {
|
||||||
|
|
||||||
|
// 管理者か
|
||||||
|
if (!loginUserForm.isAdminUser()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 管理者向けのページ遷移か
|
||||||
|
if (!TransitionTargetPageNameKeyword.getAdminPageList().contains(targetURL)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一般ユーザ用のアカウントで一般ユーザ向けのページアクセスか
|
||||||
|
*
|
||||||
|
* @param targetURL 遷移したいURL
|
||||||
|
* @param loginUserForm リクエスト元のユーザ
|
||||||
|
* @return true:遷移可 false:遷移不可
|
||||||
|
*/
|
||||||
|
private boolean isUserTransition(String targetURL, LoginUserForm loginUserForm) {
|
||||||
|
|
||||||
|
// 管理者か
|
||||||
|
if (loginUserForm.isAdminUser()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 一般ユーザ向けのページ遷移か
|
||||||
|
return TransitionTargetPageNameKeyword.getUserPageList().contains(targetURL);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.example.rhizome.aop.aspect;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SessionCheckアノテーション
|
||||||
|
* セッションチェックを行うメソッドに付与する
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface SessionCheck {
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.example.rhizome.aop.aspect;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.rhizome.exception.NoSessionException;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Before;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* セッションチェック用のAOP
|
||||||
|
*/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class SessionCheckAspect {
|
||||||
|
|
||||||
|
HttpServletRequest request;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SessionCheckAspect(HttpServletRequest request) {
|
||||||
|
this.request = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Pointcut("@annotation(com.example.rhizome.aop.aspect.SessionCheck)")
|
||||||
|
public void sessionCheckMethod() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* セッションチェック
|
||||||
|
*/
|
||||||
|
@Before("sessionCheckMethod()")
|
||||||
|
public void checkSession() {
|
||||||
|
// セッションの取得
|
||||||
|
HttpSession session = request.getSession(false);
|
||||||
|
|
||||||
|
// セッションが取得できない場合はエラー画面に遷移
|
||||||
|
if (session == null || session.getAttribute(SessionKeyword.LOGIN_USER) == null) {
|
||||||
|
throw new NoSessionException("不正なログインです");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署情報の概念を表現するモデルクラスです。
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Department {
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private final Integer idDepartment;
|
||||||
|
/**
|
||||||
|
* 部署名
|
||||||
|
*/
|
||||||
|
private final String nmDepartment;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員を表現するモデルクラスです
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Employee {
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
private final Integer idEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
private final String nmEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
private final String knEmployee;
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private final String mailAddress;
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
private final String password;
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
|
*/
|
||||||
|
private final Integer adminAuth;
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private final Integer idDepartment;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* EmployeeInfo.java
|
||||||
|
* 作成 IT-College 2016
|
||||||
|
*------------------------------------------------------------
|
||||||
|
* Copyright(c) Rhizome Inc. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員情報の概念を表現するモデルクラスです。
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EmployeeInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員情報
|
||||||
|
*/
|
||||||
|
private final Employee employee;
|
||||||
|
/**
|
||||||
|
* 部署名
|
||||||
|
*/
|
||||||
|
private final Department department;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログインを試みる人を表現するモデルクラスです
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LoginInfo {
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private String mailAddress;
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログイン者を表現するクラスです
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LoginUser {
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
private final Integer idEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
private final String nmEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
private final String knEmployee;
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private final String mailAddress;
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
private final String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
|
*/
|
||||||
|
private final Integer adminAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private final Integer idDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログインユーザが管理者か
|
||||||
|
*
|
||||||
|
* @return true:管理者 false:一般権限
|
||||||
|
*/
|
||||||
|
public boolean isAdminUser() {
|
||||||
|
return getAdminAuth() == 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署情報の検索要件を表現するモデルクラスです。
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SearchConditionDepartment {
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private final Integer idDepartment;
|
||||||
|
/**
|
||||||
|
* 部署名
|
||||||
|
*/
|
||||||
|
private final String nmDepartment;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員情報の検索条件という概念を表現するモデルクラスです
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SearchConditionEmployee {
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
private final Integer idEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
private final String nmEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
private final String knEmployee;
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private final String mailAddress;
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private final Integer idDepartment;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
public interface DeleteEmployee {
|
||||||
|
void deleteEmployee(Integer idEmployee);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.LoginInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
|
||||||
|
public interface Login {
|
||||||
|
LoginUser doLogin(LoginInfo loginInfo);
|
||||||
|
|
||||||
|
boolean canLogin(LoginInfo loginInfo);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
|
||||||
|
public interface RegisterDepartment {
|
||||||
|
void registerDepartment(Department department);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
|
||||||
|
public interface RegisterEmployee {
|
||||||
|
void registerEmployee(Employee employee);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SearchDepartment {
|
||||||
|
List<Department> selectAll();
|
||||||
|
|
||||||
|
List<Department> searchBy(SearchConditionDepartment searchConditionDepartment);
|
||||||
|
|
||||||
|
List<Department> searchByWithLike(SearchConditionDepartment searchConditionDepartment);
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SearchEmployee {
|
||||||
|
List<Employee> searchEmployee(String mailAddress);
|
||||||
|
|
||||||
|
List<Employee> searchEmployeeByIdDepartment(Integer idDepartment);
|
||||||
|
|
||||||
|
LoginUser searchLoginUser(String mailAddress);
|
||||||
|
|
||||||
|
Employee searchEmployeeByIdEmployee(Integer idEmployee);
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SearchEmployeeInfo {
|
||||||
|
List<EmployeeInfo> selectAll();
|
||||||
|
|
||||||
|
List<EmployeeInfo> searchBy(SearchConditionEmployee searchConditionEmployee);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
|
||||||
|
public interface UpdateEmployee {
|
||||||
|
void updateEmployee(Employee beforeEmployee, Employee updateEmployee);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.service.DeleteEmployee;
|
||||||
|
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 レコード削除関連の機能を持つサービス
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class DeleteEmployeeImpl implements DeleteEmployee {
|
||||||
|
|
||||||
|
EmployeeRepository employeeRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DeleteEmployeeImpl(EmployeeRepository employeeRepository) {
|
||||||
|
this.employeeRepository = employeeRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* idEmployee を元に employee データを削除
|
||||||
|
*
|
||||||
|
* @param idEmployee 削除対象のidEmployee
|
||||||
|
*/
|
||||||
|
public void deleteEmployee(Integer idEmployee) {
|
||||||
|
employeeRepository.deleteById(idEmployee);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.LoginInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
import com.example.rhizome.app.domain.service.Login;
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログイン系の機能を集約させるサービスクラスです。
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class LoginImpl implements Login {
|
||||||
|
|
||||||
|
EmployeeRepository employeeRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public LoginImpl(EmployeeRepository employeeRepository) {
|
||||||
|
this.employeeRepository = employeeRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メールアドレス、パスワードでログイン判定を行う
|
||||||
|
*
|
||||||
|
* @param loginInfo ログインを試みるアカウント
|
||||||
|
* @return loginUser のインスタンス
|
||||||
|
*/
|
||||||
|
public LoginUser doLogin(LoginInfo loginInfo) {
|
||||||
|
// ログイン情報を元にログインユーザーを取得
|
||||||
|
return employeeRepository
|
||||||
|
.findByMailAddressAndPassword(loginInfo.getMailAddress(), loginInfo.getPassword())
|
||||||
|
.orElse(new EmployeeEntity())
|
||||||
|
.createLoginUser();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メールアドレス、パスワードでログイン判定を行う
|
||||||
|
*
|
||||||
|
* @param loginInfo ログインを試みるアカウント
|
||||||
|
* @return loginUser のインスタンス
|
||||||
|
*/
|
||||||
|
public boolean canLogin(LoginInfo loginInfo) {
|
||||||
|
// ログイン情報を元にログインユーザーを取得
|
||||||
|
return employeeRepository
|
||||||
|
.findByMailAddressAndPassword(loginInfo.getMailAddress(), loginInfo.getPassword())
|
||||||
|
.isPresent();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Employee テーブルの登録系の機能を集約させるサービスクラスです。
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class RegisterEmployeeImpl implements RegisterEmployee {
|
||||||
|
|
||||||
|
EmployeeRepository employeeRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public RegisterEmployeeImpl(EmployeeRepository employeeRepository) {
|
||||||
|
this.employeeRepository = employeeRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* employee インスタンスの内容を登録する
|
||||||
|
*
|
||||||
|
* @param employee 登録対象のデータ
|
||||||
|
*/
|
||||||
|
public void registerEmployee(Employee employee) {
|
||||||
|
employeeRepository.save(EmployeeEntity.convertFrom(employee));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.DepartmentRepository;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署情報検索系の機能を集約させるサービスクラスです。
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class SearchDepartmentImpl implements SearchDepartment {
|
||||||
|
|
||||||
|
DepartmentRepository departmentRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* コンストラクタ
|
||||||
|
*
|
||||||
|
* @param departmentRepository DI対象
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
public SearchDepartmentImpl(DepartmentRepository departmentRepository) {
|
||||||
|
this.departmentRepository = departmentRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署情報を全件取得する
|
||||||
|
*
|
||||||
|
* @return 取得した部署情報レコード全件
|
||||||
|
*/
|
||||||
|
public List<Department> selectAll() {
|
||||||
|
return DepartmentEntity.createDepartmentList(departmentRepository.findAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* searchConditionDepartment の情報を元に Department のレコードを取得
|
||||||
|
*
|
||||||
|
* @param searchConditionDepartment 検索条件
|
||||||
|
* @return 検索結果のレコード
|
||||||
|
*/
|
||||||
|
public List<Department> searchBy(SearchConditionDepartment searchConditionDepartment) {
|
||||||
|
// 動的に検索条件を絞り込む
|
||||||
|
// Specification は Criteria API の Predicate をラップしたもの
|
||||||
|
return DepartmentEntity
|
||||||
|
.createDepartmentList(
|
||||||
|
departmentRepository.findAll(Specification
|
||||||
|
.where(DepartmentRepository.idDepartmentEqual(searchConditionDepartment.getIdDepartment()))
|
||||||
|
.and(DepartmentRepository.nmDepartmentEqual(searchConditionDepartment.getNmDepartment()))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* searchConditionDepartment の情報を元に Department のレコードを取得
|
||||||
|
* 部分一致検索
|
||||||
|
*
|
||||||
|
* @param searchConditionDepartment 検索条件
|
||||||
|
* @return 検索結果のレコード
|
||||||
|
*/
|
||||||
|
public List<Department> searchByWithLike(SearchConditionDepartment searchConditionDepartment) {
|
||||||
|
// 動的に検索条件を絞り込む
|
||||||
|
// Specification は Criteria API の Predicate をラップしたもの
|
||||||
|
return DepartmentEntity
|
||||||
|
.createDepartmentList(
|
||||||
|
departmentRepository.findAll(Specification
|
||||||
|
.where(DepartmentRepository.idDepartmentEqual(searchConditionDepartment.getIdDepartment()))
|
||||||
|
.and(DepartmentRepository.nmDepartmentLike(searchConditionDepartment.getNmDepartment()))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployee;
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Employee テーブル検索系の機能を集約させるサービスクラスです。
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class SearchEmployeeImpl implements SearchEmployee {
|
||||||
|
|
||||||
|
EmployeeRepository employeeRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SearchEmployeeImpl(EmployeeRepository employeeRepository) {
|
||||||
|
this.employeeRepository = employeeRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mailAddress を元に Employee Table を検索します。
|
||||||
|
*
|
||||||
|
* @param mailAddress 検索対象の mailAddress
|
||||||
|
* @return Table から取得したレコードの情報
|
||||||
|
*/
|
||||||
|
public List<Employee> searchEmployee(String mailAddress) {
|
||||||
|
return EmployeeEntity.createEmployeeList(employeeRepository.findByMailAddress(mailAddress).stream().toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mailAddress を元に ログイン者の情報 を検索します。
|
||||||
|
*
|
||||||
|
* @param mailAddress 検索対象の mailAddress
|
||||||
|
* @return login者の情報
|
||||||
|
*/
|
||||||
|
public LoginUser searchLoginUser(String mailAddress) {
|
||||||
|
return employeeRepository.findByMailAddress(mailAddress).orElse(new EmployeeEntity()).createLoginUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* idEmployee を元に Employee Table を検索します。
|
||||||
|
*
|
||||||
|
* @param idEmployee 検索対象の idEmployee
|
||||||
|
* @return Table から取得したレコードの情報
|
||||||
|
*/
|
||||||
|
public Employee searchEmployeeByIdEmployee(Integer idEmployee) {
|
||||||
|
return EmployeeEntity.createEmployee(employeeRepository.findByIdEmployee(idEmployee).orElse(new EmployeeEntity()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* idDepartment を元に Employee Table を検索します。
|
||||||
|
*
|
||||||
|
* @param idDepartment 部署ID
|
||||||
|
* @return Table から取得したレコードの情報
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Employee> searchEmployeeByIdDepartment(Integer idDepartment) {
|
||||||
|
return EmployeeEntity.createEmployeeList(employeeRepository.findByIdDepartment(idDepartment));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeDepartmentEntity;
|
||||||
|
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) 検索系の機能を集約させるサービスクラスです
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class SearchEmployeeInfoImpl implements SearchEmployeeInfo {
|
||||||
|
|
||||||
|
EmployeeInfoRepository employeeInfoRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SearchEmployeeInfoImpl(EmployeeInfoRepository employeeInfoRepository) {
|
||||||
|
this.employeeInfoRepository = employeeInfoRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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()))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.example.rhizome.app.domain.service.impl;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.service.UpdateEmployee;
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
||||||
|
import com.example.rhizome.app.infra.repository.EmployeeRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* employee の更新系の機能を集約させるサービスクラスです。
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class UpdateEmployeeImpl implements UpdateEmployee {
|
||||||
|
|
||||||
|
EmployeeRepository employeeRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public UpdateEmployeeImpl(EmployeeRepository employeeRepository) {
|
||||||
|
this.employeeRepository = employeeRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* employee の情報を元に employee table のレコードを更新する
|
||||||
|
*
|
||||||
|
* @param beforeEmployee 更新前のデータ
|
||||||
|
* @param updateEmployee 更新後のデータ
|
||||||
|
*/
|
||||||
|
public void updateEmployee(Employee beforeEmployee, Employee updateEmployee) {
|
||||||
|
|
||||||
|
employeeRepository.save(EmployeeEntity.convertFrom(mergeEmployee(beforeEmployee, updateEmployee)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新前のデータと更新対象のデータをマージする
|
||||||
|
*
|
||||||
|
* @param beforeEmployee 更新前のデータ
|
||||||
|
* @param updateEmployee 更新対象のデータ
|
||||||
|
* @return マージしたデータ
|
||||||
|
*/
|
||||||
|
private Employee mergeEmployee(Employee beforeEmployee, Employee updateEmployee) {
|
||||||
|
// 更新対象のデータのパスワードが空文字の場合は、更新前のパスワードを使用する
|
||||||
|
// 更新対象のデータの管理者権限が null の場合は、更新前の管理者権限を使用する
|
||||||
|
// 更新対象のデータの部署IDが null の場合は、更新前の部署IDを使用する
|
||||||
|
return new Employee(
|
||||||
|
updateEmployee.getIdEmployee(),
|
||||||
|
updateEmployee.getNmEmployee(),
|
||||||
|
updateEmployee.getKnEmployee(),
|
||||||
|
updateEmployee.getMailAddress(),
|
||||||
|
updateEmployee.getPassword().isBlank() ? beforeEmployee.getPassword() : updateEmployee.getPassword(),
|
||||||
|
updateEmployee.getAdminAuth() == null ? beforeEmployee.getAdminAuth() : updateEmployee.getAdminAuth(),
|
||||||
|
updateEmployee.getIdDepartment() == null ? beforeEmployee.getIdDepartment() : updateEmployee.getIdDepartment()
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Department.java
|
||||||
|
* 作成 IT-College 2016
|
||||||
|
*------------------------------------------------------------
|
||||||
|
* Copyright(c) Rhizome Inc. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Department テーブルの Entity
|
||||||
|
*
|
||||||
|
* @author IT-College
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "department")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DepartmentEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id_department", nullable = false)
|
||||||
|
private Integer idDepartment;
|
||||||
|
/**
|
||||||
|
* 部署名
|
||||||
|
*/
|
||||||
|
@Column(name = "nm_department", nullable = false)
|
||||||
|
private String nmDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DepartmentEntity(DataAccess層依存)から Department(BusinessLogic層依存型)に変換します。
|
||||||
|
*
|
||||||
|
* @param departmentEntityList department Table のリスト
|
||||||
|
* @return List<Department> リスト
|
||||||
|
*/
|
||||||
|
public static List<Department> createDepartmentList(List<DepartmentEntity> departmentEntityList) {
|
||||||
|
|
||||||
|
// Stream API を利用するとこうなります。
|
||||||
|
return departmentEntityList
|
||||||
|
.stream()
|
||||||
|
.map(departmentEntity -> new Department(
|
||||||
|
departmentEntity.getIdDepartment(),
|
||||||
|
departmentEntity.getNmDepartment()
|
||||||
|
)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Department(BusinessLogic層依存型) から DepartmentEntity(DataAccess層依存)に変換します。
|
||||||
|
*
|
||||||
|
* @param department department モデルの値
|
||||||
|
* @return DepartmentEntity に変換したインスタンス
|
||||||
|
*/
|
||||||
|
public static DepartmentEntity convertFrom(Department department) {
|
||||||
|
return new DepartmentEntity(
|
||||||
|
department.getIdDepartment(),
|
||||||
|
department.getNmDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Fetch;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Employee + Department の Join 情報を保持するEntity
|
||||||
|
*
|
||||||
|
* @author IT-College
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "employee")
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@NamedEntityGraph(
|
||||||
|
name = "employee_with_department",
|
||||||
|
includeAllAttributes = true
|
||||||
|
)
|
||||||
|
public class EmployeeDepartmentEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id_employee", nullable = false)
|
||||||
|
private Integer idEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
@Column(name = "nm_employee", nullable = false)
|
||||||
|
private String nmEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
@Column(name = "kn_employee", nullable = false)
|
||||||
|
private String knEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
@Column(name = "mail_address", nullable = false)
|
||||||
|
private String mailAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
@Column(name = "password", nullable = false)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
|
*/
|
||||||
|
@Column(name = "admin_auth", nullable = false)
|
||||||
|
private Integer adminAuth;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "id_department", referencedColumnName = "id_department", insertable = false, updatable = false)
|
||||||
|
@Fetch(FetchMode.JOIN)
|
||||||
|
private DepartmentEntity department;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。
|
||||||
|
*
|
||||||
|
* @param employeeDepartmentEntity EmployeeDepartmentEntity のインスタンス
|
||||||
|
* @return EmployeeInfo のインスタンス
|
||||||
|
*/
|
||||||
|
public static EmployeeInfo createEmployeeInfo(EmployeeDepartmentEntity employeeDepartmentEntity) {
|
||||||
|
|
||||||
|
// コンストラクタを使って書くとSetterを使用するより簡略化出来ます。
|
||||||
|
// 混乱してしまう人は落ち着いて EmployeeInfo のフィールドを見に行って、
|
||||||
|
// どうしてこの書き方が出来るのかを理解できる様になりましょう。
|
||||||
|
return new EmployeeInfo(
|
||||||
|
new Employee(
|
||||||
|
employeeDepartmentEntity.getIdEmployee(),
|
||||||
|
employeeDepartmentEntity.getNmEmployee(),
|
||||||
|
employeeDepartmentEntity.getKnEmployee(),
|
||||||
|
employeeDepartmentEntity.getMailAddress(),
|
||||||
|
employeeDepartmentEntity.getPassword(),
|
||||||
|
employeeDepartmentEntity.getAdminAuth(),
|
||||||
|
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment()
|
||||||
|
),
|
||||||
|
new Department(
|
||||||
|
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getIdDepartment(),
|
||||||
|
employeeDepartmentEntity.getDepartment() == null ? null : employeeDepartmentEntity.getDepartment().getNmDepartment()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmployeeDepartmentEntity(DataAccess層依存) を EmployeeInfo(BusinessLogic層依存) に変換します。
|
||||||
|
* (リスト版)
|
||||||
|
*
|
||||||
|
* @param employeeDepartmentEntityList EmployeeDepartmentEntity インスタンスのリスト
|
||||||
|
* @return EmployeeInfo インスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static List<EmployeeInfo> createEmployeeInfoList(List<EmployeeDepartmentEntity> employeeDepartmentEntityList) {
|
||||||
|
|
||||||
|
// StreamAPI を使うとこうなります。
|
||||||
|
return employeeDepartmentEntityList.stream().map(EmployeeDepartmentEntity::createEmployeeInfo).toList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
/*
|
||||||
|
* Employee.java
|
||||||
|
* 作成 IT-College 2016
|
||||||
|
*------------------------------------------------------------
|
||||||
|
* Copyright(c) Rhizome Inc. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package com.example.rhizome.app.infra.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmployeeテーブルのEntity
|
||||||
|
*
|
||||||
|
* @author IT-College
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "employee")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EmployeeEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id_employee", nullable = false)
|
||||||
|
private Integer idEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
@Column(name = "nm_employee", nullable = false)
|
||||||
|
private String nmEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
@Column(name = "kn_employee", nullable = false)
|
||||||
|
private String knEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
@Column(name = "mail_address", nullable = false)
|
||||||
|
private String mailAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
@Column(name = "password", nullable = false)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
|
*/
|
||||||
|
@Column(name = "admin_auth", nullable = false)
|
||||||
|
private Integer adminAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
@Column(name = "id_department", nullable = false)
|
||||||
|
private Integer idDepartment;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Employee(BusinessLogic 依存)を EmployeeEntity(DataAccess層依存)に変換します。
|
||||||
|
*
|
||||||
|
* @param employee Employee Table の中身
|
||||||
|
* @return EmployeeEntity のインスタンス(1レコード分)
|
||||||
|
*/
|
||||||
|
public static EmployeeEntity convertFrom(Employee employee) {
|
||||||
|
// 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
|
||||||
|
return new EmployeeEntity(
|
||||||
|
employee.getIdEmployee(),
|
||||||
|
employee.getNmEmployee(),
|
||||||
|
employee.getKnEmployee(),
|
||||||
|
employee.getMailAddress(),
|
||||||
|
employee.getPassword(),
|
||||||
|
employee.getAdminAuth(),
|
||||||
|
employee.getIdDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SearchConditionEmployee(BusinessLogic 依存)を EmployeeEntity(DataAccess層依存)に変換します。
|
||||||
|
* (コンストラクタを使用せず、Setterを利用したパターン)
|
||||||
|
*
|
||||||
|
* @param searchConditionEmployee 検索条件
|
||||||
|
* @return EmployeeEntity のインスタンス(1レコード分)
|
||||||
|
*/
|
||||||
|
public static EmployeeEntity convertFrom(SearchConditionEmployee searchConditionEmployee) {
|
||||||
|
EmployeeEntity employeeEntity = new EmployeeEntity();
|
||||||
|
|
||||||
|
employeeEntity.setIdEmployee(searchConditionEmployee.getIdEmployee());
|
||||||
|
employeeEntity.setNmEmployee(searchConditionEmployee.getNmEmployee());
|
||||||
|
employeeEntity.setKnEmployee(searchConditionEmployee.getKnEmployee());
|
||||||
|
employeeEntity.setMailAddress(searchConditionEmployee.getMailAddress());
|
||||||
|
employeeEntity.setIdDepartment(searchConditionEmployee.getIdDepartment());
|
||||||
|
|
||||||
|
|
||||||
|
return employeeEntity;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmployeeEntity(DataAccess層依存)から Employee (BusinessLogic層依存型)に変換します。
|
||||||
|
*
|
||||||
|
* @param employeeEntity Employee Table のインスタンス
|
||||||
|
* @return employee インスタンス
|
||||||
|
*/
|
||||||
|
public static Employee createEmployee(EmployeeEntity employeeEntity) {
|
||||||
|
// 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
|
||||||
|
return new Employee(
|
||||||
|
employeeEntity.getIdEmployee(),
|
||||||
|
employeeEntity.getNmEmployee(),
|
||||||
|
employeeEntity.getKnEmployee(),
|
||||||
|
employeeEntity.getMailAddress(),
|
||||||
|
employeeEntity.getPassword(),
|
||||||
|
employeeEntity.getAdminAuth(),
|
||||||
|
employeeEntity.getIdDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmployeeEntity(DataAccess層依存) から Employee (BusinessLogic層依存型)に変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param employeeEntityList EmployeeEntity インスタンスのリスト
|
||||||
|
* @return Employee インスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static List<Employee> createEmployeeList(List<EmployeeEntity> employeeEntityList) {
|
||||||
|
/* 従来の書き方
|
||||||
|
List<Employee> employeeList = new ArrayList<>();
|
||||||
|
for(EmployeeEntity employeeEntity:employeeEntityList){
|
||||||
|
Employee employee = EmployeeEntity.createEmployee(employeeEntity);
|
||||||
|
employeeList.add(employee);
|
||||||
|
}
|
||||||
|
return employeeList;
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Stream APIを使用すると1行で書けます。
|
||||||
|
return employeeEntityList.stream().map(EmployeeEntity::createEmployee).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmployeeEntity(DataAccess層依存) から LoginUser (BusinessLogic層依存型)情報を作成します。
|
||||||
|
*
|
||||||
|
* @return loginUser (ログイン者の情報) インスタンス
|
||||||
|
*/
|
||||||
|
public LoginUser createLoginUser() {
|
||||||
|
// 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
|
||||||
|
return new LoginUser(
|
||||||
|
getIdEmployee(),
|
||||||
|
getNmEmployee(),
|
||||||
|
getKnEmployee(),
|
||||||
|
getMailAddress(),
|
||||||
|
getPassword(),
|
||||||
|
getAdminAuth(),
|
||||||
|
getIdDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.example.rhizome.app.infra.repository;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specification:
|
||||||
|
* 関数型インターフェースです。
|
||||||
|
* JPAの一部として提供されていて、エンティティの情報を元に動的にクエリを生成し、DBからデータを取得します。
|
||||||
|
* 使い方:
|
||||||
|
* toPredicate をOverrideして使います。
|
||||||
|
* パラメータ:
|
||||||
|
* Root<T>:ルートエンティティを指します。<T>に指定したエンティティ(今回はDepartmentEntity)を用いてメンバにアクセスします。
|
||||||
|
* CriteriaQuery<\?>:サブクエリを作成する際に使用します。※今回は使用しません
|
||||||
|
* CriteriaBuilder:条件式(Where句以降の条件)の部分のクエリを作るためのビルダーです。
|
||||||
|
* 戻り値はクエリを格納しているPredicateオブジェクトとなります。
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface DepartmentRepository extends JpaRepository<DepartmentEntity, Integer>, JpaSpecificationExecutor<DepartmentEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
static Specification<DepartmentEntity> idDepartmentEqual(Integer idDepartment) {
|
||||||
|
return idDepartment == null ?
|
||||||
|
null :
|
||||||
|
// 戻り値の型 Specification<DepartmentEntity> にキャスト
|
||||||
|
(Specification<DepartmentEntity>)
|
||||||
|
// ラムダ式で記載しているが書いてあることは criteriaBuilder を使って Where句の後の "'idDepartment' = idDepartment(変数)"
|
||||||
|
// を作成している
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.equal(root.get("idDepartment"), idDepartment);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<DepartmentEntity> nmDepartmentEqual(String nmDepartment) {
|
||||||
|
return (nmDepartment == null || nmDepartment.isEmpty()) ?
|
||||||
|
null :
|
||||||
|
(Specification<DepartmentEntity>)
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.like(root.get("nmDepartment"), nmDepartment);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Specification<DepartmentEntity> nmDepartmentLike(String nmDepartment) {
|
||||||
|
return (nmDepartment == null || nmDepartment.isEmpty()) ?
|
||||||
|
null :
|
||||||
|
(Specification<DepartmentEntity>)
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.like(root.get("nmDepartment"), "%" + nmDepartment + "%");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.example.rhizome.app.infra.repository;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeDepartmentEntity;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ワンポイント情報(ここで登場する関数型インターフェース Specification について解説します)
|
||||||
|
* Specification:
|
||||||
|
* 関数型インターフェースです。
|
||||||
|
* JPAの一部として提供されていて、エンティティの情報を元に動的にクエリを生成し、DBからデータを取得します。
|
||||||
|
* 使い方:
|
||||||
|
* toPredicate をOverrideして使います。
|
||||||
|
* パラメータ:
|
||||||
|
* Root<T>:ルートエンティティを指します。<T>に指定したエンティティ(今回はDepartmentEntity)を用いてメンバにアクセスします。
|
||||||
|
* CriteriaQuery<\?>:サブクエリを作成する際に使用します。※今回は使用しません
|
||||||
|
* CriteriaBuilder:条件式(Where句以降の条件)の部分のクエリを作るためのビルダーです。
|
||||||
|
* 戻り値はクエリを格納しているPredicateオブジェクトとなります。
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface EmployeeInfoRepository extends JpaRepository<EmployeeDepartmentEntity, Integer>, JpaSpecificationExecutor<EmployeeDepartmentEntity> {
|
||||||
|
|
||||||
|
static Specification<EmployeeDepartmentEntity> idEmployeeEqual(Integer idEmployee) {
|
||||||
|
return idEmployee == null ?
|
||||||
|
null :
|
||||||
|
// 戻り値の型 Specification<EmployeeDepartmentEntity> にキャスト
|
||||||
|
(Specification<EmployeeDepartmentEntity>)
|
||||||
|
// ラムダ式で記載しているが書いてあることは criteriaBuilder を使って Where句の後の "'idEmployee' = idEmployee(変数)"
|
||||||
|
// を作成している
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.equal(root.get("idEmployee"), idEmployee);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<EmployeeDepartmentEntity> nmEmployeeEqual(String nmEmployee) {
|
||||||
|
return (nmEmployee == null || nmEmployee.isEmpty()) ?
|
||||||
|
null :
|
||||||
|
(Specification<EmployeeDepartmentEntity>)
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.like(root.get("nmEmployee"), "%" + nmEmployee + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<EmployeeDepartmentEntity> knEmployeeEqual(String knEmployee) {
|
||||||
|
return (knEmployee == null || knEmployee.isEmpty()) ?
|
||||||
|
null :
|
||||||
|
(Specification<EmployeeDepartmentEntity>)
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.like(root.get("knEmployee"), "%" + knEmployee + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<EmployeeDepartmentEntity> mailAddressEqual(String mailAddress) {
|
||||||
|
return (mailAddress == null || mailAddress.isEmpty()) ?
|
||||||
|
null :
|
||||||
|
(Specification<EmployeeDepartmentEntity>)
|
||||||
|
(root, criteriaQuery, criteriaBuilder) -> criteriaBuilder.like(root.get("mailAddress"), "%" + mailAddress + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
static Specification<EmployeeDepartmentEntity> idDepartmentEqual(Integer idDepartment) {
|
||||||
|
return (root, query, criteriaBuilder) ->
|
||||||
|
idDepartment == null ? null :
|
||||||
|
criteriaBuilder.equal(root.join("department").get("idDepartment"), idDepartment);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.example.rhizome.app.infra.repository;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.entity.EmployeeEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface EmployeeRepository extends JpaRepository<EmployeeEntity, Integer> {
|
||||||
|
Optional<EmployeeEntity> findByMailAddressAndPassword(String mailAddress, String password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メールアドレスで検索
|
||||||
|
**/
|
||||||
|
Optional<EmployeeEntity> findByMailAddress(String mail);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDで検索
|
||||||
|
**/
|
||||||
|
Optional<EmployeeEntity> findByIdEmployee(Integer idEmployee);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDで検索
|
||||||
|
**/
|
||||||
|
List<EmployeeEntity> findByIdDepartment(Integer idDepartment);
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
import com.example.rhizome.app.domain.service.DeleteEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.DELETE_EMPLOYEE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 削除処理のコントロータ
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class DeleteEmployeeController {
|
||||||
|
|
||||||
|
// ログ出力用インスタンス
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(DeleteEmployeeController.class.getName());
|
||||||
|
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
DeleteEmployee deleteEmployee;
|
||||||
|
SearchDepartment searchDepartment;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DeleteEmployeeController(DeleteEmployee deleteEmployee, SearchDepartment searchDepartment, HttpSession httpSession) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
this.deleteEmployee = deleteEmployee;
|
||||||
|
this.searchDepartment = searchDepartment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 削除処理のコントローラ
|
||||||
|
*
|
||||||
|
* @param idEmployee 削除対象のemployeeId
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@PermissionCheck
|
||||||
|
@SessionCheck
|
||||||
|
@RequestMapping(value = DELETE_EMPLOYEE, method = RequestMethod.POST)
|
||||||
|
public String deleteEmployee(@RequestParam("idEmployee") Integer idEmployee, Model model) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 部署一覧を取得し、画面に返す用のクラスに詰め替える
|
||||||
|
// 作成した部署一覧をセット
|
||||||
|
model.addAttribute(
|
||||||
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
|
DepartmentForm.convertFrom(searchDepartment.selectAll())
|
||||||
|
);
|
||||||
|
|
||||||
|
// 削除処理実施
|
||||||
|
deleteExec(
|
||||||
|
model,
|
||||||
|
idEmployee,
|
||||||
|
LoginUserForm.convertTo((LoginUserForm) httpSession.getAttribute(SessionKeyword.LOGIN_USER)));
|
||||||
|
|
||||||
|
// 検索画面に遷移
|
||||||
|
return "forward:" + TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_INFO_FORM_EMPTY;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ログイン情報の破棄
|
||||||
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// エラー画面遷移
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 削除処理実施
|
||||||
|
*
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @param idEmployee 削除対象のemployeeId
|
||||||
|
* @param loginUser ログインユーザー情報
|
||||||
|
*/
|
||||||
|
private void deleteExec(Model model, Integer idEmployee, LoginUser loginUser) {
|
||||||
|
|
||||||
|
final String DELETE_TARGET_ID_CAN_NOT_DELETE = "ログイン者自身は削除出来ません。";
|
||||||
|
final String DELETE_COMPLETE = "削除しました。";
|
||||||
|
|
||||||
|
// ログインしている人が、削除対象かチェック
|
||||||
|
if (Objects.equals(loginUser.getIdEmployee(), idEmployee)) {
|
||||||
|
// 削除対象だった場合
|
||||||
|
// エラーメッセージをセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DELETE_TARGET_ID_CAN_NOT_DELETE));
|
||||||
|
// 検索画面に遷移
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 削除を実施
|
||||||
|
deleteEmployee.deleteEmployee(idEmployee);
|
||||||
|
|
||||||
|
// 削除完了したメッセージをセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_INFO, new MessageForm(DELETE_COMPLETE));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.service.impl.LoginImpl;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
|
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 javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.*;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class IndexController {
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public IndexController(HttpSession httpSession, LoginImpl loginImpl) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public LoginUserForm loginUserForm() {
|
||||||
|
return new LoginUserForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログイン画面表示処理
|
||||||
|
*
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = {INDEX_BLANK, INDEX_SLASH, INDEX_LOGIN})
|
||||||
|
public String index(Model model) {
|
||||||
|
// セッション情報を破棄
|
||||||
|
if (httpSession != null) {
|
||||||
|
httpSession.invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 空のFormをSessionに用意
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.LOGIN_INFO_FORM, loginUserForm());
|
||||||
|
|
||||||
|
// ログイン画面に遷移
|
||||||
|
return LOGIN_HTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.impl.SearchDepartmentImpl;
|
||||||
|
import com.example.rhizome.app.domain.service.impl.SearchEmployeeImpl;
|
||||||
|
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.InsertEmployeeForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_CONFIRM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新規登録者情報チェック用のコントローラ
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class InsertEmployeeConfirmController {
|
||||||
|
|
||||||
|
// ログ出力用インスタンス
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(InsertEmployeeConfirmController.class.getName());
|
||||||
|
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
SearchDepartment searchDepartment;
|
||||||
|
SearchEmployee searchEmployee;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public InsertEmployeeConfirmController(
|
||||||
|
HttpSession httpSession,
|
||||||
|
SearchDepartmentImpl searchDepartment,
|
||||||
|
SearchEmployeeImpl searchEmployee
|
||||||
|
) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
this.searchDepartment = searchDepartment;
|
||||||
|
this.searchEmployee = searchEmployee;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public InsertEmployeeForm insertEmployeeForm() {
|
||||||
|
return new InsertEmployeeForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登録情報のチェックを行う
|
||||||
|
*
|
||||||
|
* @param insertEmployeeForm 登録情報
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@PermissionCheck
|
||||||
|
@SessionCheck
|
||||||
|
@RequestMapping(value = INSERT_EMPLOYEE_CONFIRM, method = RequestMethod.POST)
|
||||||
|
public String insertEmployeeConfirm(InsertEmployeeForm insertEmployeeForm, Model model) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 部署一覧を取得し、画面に返す用のクラスに詰め替える
|
||||||
|
// 作成した部署一覧をセット
|
||||||
|
model.addAttribute(
|
||||||
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
|
DepartmentForm.convertFrom(
|
||||||
|
searchDepartment.selectAll()
|
||||||
|
));
|
||||||
|
|
||||||
|
// 登録用パラメータチェック
|
||||||
|
List<String> error = insertEmployeeForm.validateParameter();
|
||||||
|
|
||||||
|
// 入力内容に誤りがあるか
|
||||||
|
if (!error.isEmpty()) {
|
||||||
|
// 誤りがあった場合
|
||||||
|
// 誤りがあった箇所のエラーメッセージを表示
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(String.join(", ", error) + "が不正です。"));
|
||||||
|
// 画面に返す為の登録情報をセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.INSERT_EMPLOYEE_FORM, insertEmployeeForm);
|
||||||
|
// 登録画面に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String DUPLICATION = "既に登録済みのメールアドレスです。";
|
||||||
|
|
||||||
|
// 登録対象のメールアドレスを元に検索
|
||||||
|
List<Employee> employeeList = searchEmployee.searchEmployee(insertEmployeeForm.getMailAddress());
|
||||||
|
|
||||||
|
// 検索結果があるか
|
||||||
|
if (!employeeList.isEmpty()) {
|
||||||
|
// 検索した結果0件ではない場合
|
||||||
|
// 重複を許さないため、エラー処理
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
||||||
|
// 画面に返す為の登録情報をセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.INSERT_EMPLOYEE_FORM, insertEmployeeForm);
|
||||||
|
// 登録画面に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 登録確認ページに遷移
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.INSERT_EMPLOYEE_FORM, insertEmployeeForm);
|
||||||
|
// 登録確認画面に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_CONFIRM_HTML;
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ログイン情報の破棄
|
||||||
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// エラー画面遷移
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.impl.RegisterEmployeeImpl;
|
||||||
|
import com.example.rhizome.app.domain.service.impl.SearchDepartmentImpl;
|
||||||
|
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.InsertEmployeeForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_EMPLOYEE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新規登録用のコントローラ
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class InsertEmployeeController {
|
||||||
|
|
||||||
|
// ログ出力用インスタンス
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(InsertEmployeeController.class.getName());
|
||||||
|
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
RegisterEmployee registerEmployee;
|
||||||
|
SearchDepartment searchDepartment;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public InsertEmployeeController(HttpSession httpSession, RegisterEmployeeImpl registerEmployee, SearchDepartmentImpl searchDepartment) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
this.registerEmployee = registerEmployee;
|
||||||
|
this.searchDepartment = searchDepartment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public InsertEmployeeForm insertEmployeeForm() {
|
||||||
|
return new InsertEmployeeForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新規登録画面表示処理
|
||||||
|
*
|
||||||
|
* @param insertEmployeeForm 登録情報
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@PermissionCheck
|
||||||
|
@SessionCheck
|
||||||
|
@RequestMapping(value = INSERT_EMPLOYEE, method = RequestMethod.POST)
|
||||||
|
public String insertEmployee(InsertEmployeeForm insertEmployeeForm, Model model) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 部署一覧を取得し、画面に返す用のクラスに詰め替える
|
||||||
|
// 作成した部署一覧をセット
|
||||||
|
model.addAttribute(
|
||||||
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
|
DepartmentForm.convertFrom(
|
||||||
|
searchDepartment.selectAll()
|
||||||
|
));
|
||||||
|
|
||||||
|
// Confirm画面から渡ってきた値をチェック
|
||||||
|
List<String> error = validateParameter(
|
||||||
|
insertEmployeeForm.getNmEmployee(),
|
||||||
|
insertEmployeeForm.getKnEmployee(),
|
||||||
|
insertEmployeeForm.getMailAddress(),
|
||||||
|
insertEmployeeForm.getPassword(),
|
||||||
|
insertEmployeeForm.getAdminAuth(),
|
||||||
|
insertEmployeeForm.getIdDepartment()
|
||||||
|
);
|
||||||
|
|
||||||
|
// エラーが1件以上有る場合
|
||||||
|
if (!error.isEmpty()) {
|
||||||
|
// エラー内容を画面に表示
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(String.join(", ", error) + "が不正です。"));
|
||||||
|
// 登録画面に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 登録処理
|
||||||
|
registerEmployee.registerEmployee(InsertEmployeeForm.convertTo(insertEmployeeForm));
|
||||||
|
// 登録結果画面に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_RESULT_HTML;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ログイン情報の破棄
|
||||||
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// エラー画面遷移
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param employeeName 登録対象の名前
|
||||||
|
* @param employeeKana 登録対象のカナ
|
||||||
|
* @param mailAddress 登録対象のメールアドレス
|
||||||
|
* @param password 登録対象のパスワード
|
||||||
|
* @param management システム権限
|
||||||
|
* @param departmentId 部署ID
|
||||||
|
* @return エラーが有った場合はエラー文言、無ければ空のリストが返る
|
||||||
|
*/
|
||||||
|
private List<String> validateParameter(
|
||||||
|
String employeeName,
|
||||||
|
String employeeKana,
|
||||||
|
String mailAddress,
|
||||||
|
String password,
|
||||||
|
Integer management,
|
||||||
|
Integer departmentId
|
||||||
|
) {
|
||||||
|
|
||||||
|
final String EMPLOYEE_NAME_NULL_BLANK = "社員名";
|
||||||
|
final String EMPLOYEE_KANA_NULL_BLANK = "社員名フリガナ";
|
||||||
|
final String MAIL_ADDRESS_NULL_BLANK = "メールアドレス";
|
||||||
|
final String PASSWORD_NULL_BLANK = "パスワード";
|
||||||
|
final String MANAGEMENT_ERROR = "管理者権限指定";
|
||||||
|
final String DEPARTMENT_ID_NULL_BLANK = "所属部署";
|
||||||
|
|
||||||
|
List<String> error = new ArrayList<>();
|
||||||
|
|
||||||
|
// null or 空文字判定
|
||||||
|
if (isNullOrBlank(employeeName)) {
|
||||||
|
// エラー内容を追加
|
||||||
|
error.add(EMPLOYEE_NAME_NULL_BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
|
// null or 空文字判定
|
||||||
|
if (isNullOrBlank(employeeKana)) {
|
||||||
|
// エラー内容を追加
|
||||||
|
error.add(EMPLOYEE_KANA_NULL_BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
|
// null or 空文字判定
|
||||||
|
if (isNullOrBlank(mailAddress)) {
|
||||||
|
// エラー内容を追加
|
||||||
|
error.add(MAIL_ADDRESS_NULL_BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
|
// null or 空文字判定
|
||||||
|
if (isNullOrBlank(password)) {
|
||||||
|
// エラー内容を追加
|
||||||
|
error.add(PASSWORD_NULL_BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 管理者権限の値が不正か
|
||||||
|
if (management == null) {
|
||||||
|
// エラー内容を追加
|
||||||
|
error.add(MANAGEMENT_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 所属部署の値が不正か
|
||||||
|
if (departmentId == null) {
|
||||||
|
// エラー内容を追加
|
||||||
|
error.add(DEPARTMENT_ID_NULL_BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仮引数を null or 空 判定する
|
||||||
|
*
|
||||||
|
* @param str 判定対象の文字列
|
||||||
|
* @return true:null or 空 false:null or 空 では無い
|
||||||
|
*/
|
||||||
|
private static boolean isNullOrBlank(String str) {
|
||||||
|
if (null == str) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str.isBlank();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.domain.service.RegisterEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
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.InsertEmployeeForm;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_INPUT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登録画面表示用コントローラ
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class InsertEmployeeInputController {
|
||||||
|
|
||||||
|
// ログ出力用インスタンス
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(InsertEmployeeInputController.class.getName());
|
||||||
|
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
RegisterEmployee registerEmployee;
|
||||||
|
SearchDepartment searchDepartment;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public InsertEmployeeInputController(HttpSession httpSession, RegisterEmployee registerEmployee, SearchDepartment searchDepartment) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
this.registerEmployee = registerEmployee;
|
||||||
|
this.searchDepartment = searchDepartment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public InsertEmployeeForm insertEmployeeForm() {
|
||||||
|
return new InsertEmployeeForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登録画面表示処理
|
||||||
|
*
|
||||||
|
* @param insertEmployeeForm 登録画面のフォーム
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@SessionCheck
|
||||||
|
@PermissionCheck
|
||||||
|
@RequestMapping(value = INSERT_EMPLOYEE_INPUT, method = RequestMethod.POST)
|
||||||
|
public String insertInput(InsertEmployeeForm insertEmployeeForm, Model model) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 部署コードリストを作成し、画面に返す値としてセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(searchDepartment.selectAll()));
|
||||||
|
|
||||||
|
// パラメータをセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.INSERT_EMPLOYEE_FORM, insertEmployeeForm);
|
||||||
|
|
||||||
|
// 登録画面に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.INSERT_EMPLOYEE_INPUT_HTML;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ログイン情報の破棄
|
||||||
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// エラー画面遷移
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.LoginInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
import com.example.rhizome.app.domain.service.Login;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.LoginInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.UpdatePersonalUserForm;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.DO_LOGIN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログイン関連のコントローラ
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class LoginController {
|
||||||
|
|
||||||
|
// ログ出力用インスタンス
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(LoginController.class.getName());
|
||||||
|
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
Login login;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public LoginController(HttpSession httpSession, Login login) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
this.login = login;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public LoginUserForm loginUserForm() {
|
||||||
|
return new LoginUserForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面から渡ってきたパラメータのチェックを行う
|
||||||
|
*
|
||||||
|
* @param loginInfoForm mailAddress, password を保持したインスタンス
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = DO_LOGIN, method = RequestMethod.POST)
|
||||||
|
public String doLogin(LoginInfoForm loginInfoForm, Model model) {
|
||||||
|
|
||||||
|
// ログに出力する
|
||||||
|
final String MAIL_ADDRESS_PASSWORD_ERROR = "メールアドレス、パスワードの入力内容に誤りがあります";
|
||||||
|
// 発生しうるErrorに対するメッセージ
|
||||||
|
final String LOGIN_ERROR = "IDまたはパスワードが間違っています";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// mailAddress, password の入力に誤りがあるかチェック
|
||||||
|
if (!LoginUserForm.checkParameter(loginInfoForm)) {
|
||||||
|
|
||||||
|
// mail,passwordが仕様を満たしていない場合
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(MAIL_ADDRESS_PASSWORD_ERROR));
|
||||||
|
|
||||||
|
// エラーだった場合に login.html に処理を戻す。mailAddress, password を login.htmlに表示するために
|
||||||
|
// ここで addAttribute する
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.LOGIN_INFO_FORM, loginInfoForm);
|
||||||
|
// login.html に遷移する様に設定
|
||||||
|
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Login者情報インスタンスを作成
|
||||||
|
LoginInfo loginInfo = createLoginInfo(httpSession, loginInfoForm);
|
||||||
|
|
||||||
|
// login 可能かチェック
|
||||||
|
if (!login.canLogin(loginInfo)) {
|
||||||
|
// ログイン不可の場合、エラーメッセージをセットして入力された値とともに login.html を再表示
|
||||||
|
// 画面に表示するエラーメッセージをセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(LOGIN_ERROR));
|
||||||
|
// 画面に表示する mailAddress, password をセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.LOGIN_INFO_FORM, loginInfoForm);
|
||||||
|
// login.html に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ログイン(インスタンス作成)
|
||||||
|
LoginUser loginUser = login.doLogin(loginInfo);
|
||||||
|
|
||||||
|
// ログイン者の情報をセッション情報に格納
|
||||||
|
// セッションに loginUser 情報を保持し続ける = ログイン中として扱う
|
||||||
|
httpSession.setAttribute(SessionKeyword.LOGIN_USER, LoginUserForm.convertFrom(loginUser));
|
||||||
|
|
||||||
|
// 管理者かチェック
|
||||||
|
if (!loginUser.isAdminUser()) {
|
||||||
|
// 管理者ではない場合直で自分の情報を更新するページに遷移する
|
||||||
|
// 編集対象のログイン者の情報を画面に渡す値にセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_PERSONAL_EMPLOYEE_USER_FORM, UpdatePersonalUserForm.convertFrom(loginUser));
|
||||||
|
// 個人の情報更新ページに遷移
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_PERSONAL_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// メニュー画面に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.MENU_HTML;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ログイン情報の破棄
|
||||||
|
httpSession.invalidate();
|
||||||
|
e.printStackTrace();
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// エラー画面に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログイン者情報のインスタンスを作成
|
||||||
|
*
|
||||||
|
* @param httpSession セッション情報
|
||||||
|
* @param loginInfoForm mailAddress, password を保持したインスタンス
|
||||||
|
*/
|
||||||
|
private static LoginInfo createLoginInfo(HttpSession httpSession, LoginInfoForm loginInfoForm) {
|
||||||
|
// セッションからログイン者情報を取得
|
||||||
|
LoginUserForm loginUserForm = (LoginUserForm) httpSession.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
|
// セッションにログイン者情報があるか
|
||||||
|
if (loginUserForm != null) {
|
||||||
|
// セッションにログイン者情報がある場合
|
||||||
|
return new LoginInfo(loginUserForm.getMailAddress(), loginUserForm.getPassword());
|
||||||
|
}
|
||||||
|
|
||||||
|
// セッションにない場合は画面からの input 値 を取得
|
||||||
|
return new LoginInfo(
|
||||||
|
loginInfoForm.getMailAddress(),
|
||||||
|
loginInfoForm.getPassword()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import static com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword.LOGOUT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログアウト処理のコントローラ
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class LogoutController {
|
||||||
|
|
||||||
|
// ログ出力用インスタンス
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(LogoutController.class.getName());
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public LogoutController(HttpSession httpSession) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public LoginUserForm loginUserForm() {
|
||||||
|
return new LoginUserForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログアウト処理
|
||||||
|
*
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@PermissionCheck
|
||||||
|
@SessionCheck
|
||||||
|
@RequestMapping(value = LOGOUT, method = RequestMethod.POST)
|
||||||
|
public String doLogout(Model model) {
|
||||||
|
try {
|
||||||
|
// セッション情報の破棄
|
||||||
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
// ログイン画面に遷移するための情報を設定
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.LOGIN_INFO_FORM, loginUserForm());
|
||||||
|
// login.html に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// エラーページに遷移
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メニュー画面表示用コントローラ
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class MenuController {
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public MessageForm messageForm() {
|
||||||
|
return new MessageForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メニュー画面に遷移
|
||||||
|
*/
|
||||||
|
@PermissionCheck
|
||||||
|
@SessionCheck
|
||||||
|
@RequestMapping(value = TransitionTargetPageNameKeyword.SHOW_MENU)
|
||||||
|
public String showMenu() {
|
||||||
|
// メニュー画面遷移
|
||||||
|
return TransitionTargetPageNameKeyword.MENU_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.EmployeeInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.SearchConditionEmployeeForm;
|
||||||
|
import 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員検索画面用コントローラ リスト全件表示、検索表示、更新、削除が可能
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class SelectEmployeeController {
|
||||||
|
|
||||||
|
// ログ出力用インスタンス
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(SelectEmployeeController.class.getName());
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
SearchDepartment searchDepartment;
|
||||||
|
SearchEmployeeInfo searchEmployeeInfo;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SelectEmployeeController(HttpSession httpSession, SearchDepartment searchDepartment, SearchEmployeeInfo searchEmployeeInfo) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
this.searchDepartment = searchDepartment;
|
||||||
|
this.searchEmployeeInfo = searchEmployeeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public SearchConditionEmployeeForm searchConditionEmployeeForm() {
|
||||||
|
return new SearchConditionEmployeeForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員検索画面表示処理コントローラ
|
||||||
|
*
|
||||||
|
* @param searchConditionEmployeeForm 検索画面のフォーム
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@PermissionCheck
|
||||||
|
@SessionCheck
|
||||||
|
@RequestMapping(value = TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_INFO, method = RequestMethod.POST)
|
||||||
|
public String select(SearchConditionEmployeeForm searchConditionEmployeeForm, Model model) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// 部署一覧を取得し、画面に返す用のクラスに詰め替える
|
||||||
|
// 作成した部署一覧をセット
|
||||||
|
model.addAttribute(
|
||||||
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
|
DepartmentForm.convertFrom(searchDepartment.selectAll())
|
||||||
|
);
|
||||||
|
|
||||||
|
// 検索条件を元に検索を実施
|
||||||
|
// 取得した EmployeeInfo( employee + department )の情報を画面に返す用の型に詰め替えてセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST, EmployeeInfoForm.convertFrom(searchEmployeeInfo.searchBy(SearchConditionEmployeeForm.convertTo(searchConditionEmployeeForm))));
|
||||||
|
// 検索ページに遷移
|
||||||
|
return TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_HTML;
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ログイン情報の破棄
|
||||||
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// エラー画面遷移
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員検索画面表示処理コントローラ
|
||||||
|
* 検索条件無しの状態を作るため、空の検索条件で検索した結果を画面に返す
|
||||||
|
*
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@PermissionCheck
|
||||||
|
@SessionCheck
|
||||||
|
@RequestMapping(value = TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_INFO_FORM_EMPTY, method = RequestMethod.POST)
|
||||||
|
public String select(Model model) {
|
||||||
|
|
||||||
|
// 部署一覧を取得し、画面に返す用のクラスに詰め替える
|
||||||
|
// 作成した部署一覧をセット
|
||||||
|
model.addAttribute(
|
||||||
|
PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST,
|
||||||
|
DepartmentForm.convertFrom(searchDepartment.selectAll())
|
||||||
|
);
|
||||||
|
|
||||||
|
// 検索条件を元に検索を実施
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST,
|
||||||
|
EmployeeInfoForm.convertFrom(
|
||||||
|
searchEmployeeInfo.searchBy(
|
||||||
|
SearchConditionEmployeeForm.convertTo(searchConditionEmployeeForm())
|
||||||
|
)));
|
||||||
|
|
||||||
|
// 検索ページに遷移
|
||||||
|
return TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_HTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.SearchConditionEmployeeForm;
|
||||||
|
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 org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新対象の employee が存在するか確認する為のコントローラ
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class UpdateEmployeeController {
|
||||||
|
|
||||||
|
// ログ出力用インスタンス
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(UpdateEmployeeController.class.getName());
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
SearchDepartment searchDepartment;
|
||||||
|
SearchEmployeeInfo searchEmployeeInfo;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public UpdateEmployeeController(HttpSession httpSession, SearchDepartment searchDepartment, SearchEmployeeInfo searchEmployeeInfo) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
this.searchDepartment = searchDepartment;
|
||||||
|
this.searchEmployeeInfo = searchEmployeeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public SearchConditionEmployeeForm searchConditionEmployeeForm() {
|
||||||
|
return new SearchConditionEmployeeForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新対象の employee が存在するか確認する為のコントローラ
|
||||||
|
*
|
||||||
|
* @param idEmployee 更新対象の employee の id
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@PermissionCheck
|
||||||
|
@SessionCheck
|
||||||
|
@RequestMapping(value = TransitionTargetPageNameKeyword.SHOW_UPDATE_EMPLOYEE, method = RequestMethod.POST)
|
||||||
|
public String showUpdateEmployee(@RequestParam("idEmployee") Integer idEmployee, Model model) {
|
||||||
|
final String UPDATE_TARGET_ID_NOT_FOUND = "更新対象のデータが見つかりません。";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 部署一覧を取得し画面に返す値としてセット
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(searchDepartment.selectAll()));
|
||||||
|
|
||||||
|
// id を条件に更新対象のレコードを検索、取得する
|
||||||
|
List<EmployeeInfo> employeeInfoList = searchEmployeeInfo.searchBy(
|
||||||
|
new SearchConditionEmployee(idEmployee,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null));
|
||||||
|
|
||||||
|
// DBに更新対象のデータがあるか
|
||||||
|
if (employeeInfoList.isEmpty()) {
|
||||||
|
// ない場合はエラーメッセージをセットして検索画面に戻る
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(UPDATE_TARGET_ID_NOT_FOUND));
|
||||||
|
return "forward:" + TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_INFO;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新画面に遷移
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_EMPLOYEE_INFO_FORM, UpdateEmployeeInfoForm.convertFrom(employeeInfoList.get(0)));
|
||||||
|
|
||||||
|
// Update画面に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ログイン情報の破棄
|
||||||
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// エラー画面遷移
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.UpdateEmployee;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.UpdateEmployeeInfoForm;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* employee を更新して結果を返す為のコントローラ
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class UpdateEmployeeResultController {
|
||||||
|
|
||||||
|
// ログ出力用インスタンス
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(UpdateEmployeeController.class.getName());
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
SearchDepartment searchDepartment;
|
||||||
|
SearchEmployee searchEmployee;
|
||||||
|
UpdateEmployee updateEmployee;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public UpdateEmployeeResultController(HttpSession httpSession, SearchDepartment searchDepartment, SearchEmployee searchEmployee, UpdateEmployee updateEmployee) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
this.searchDepartment = searchDepartment;
|
||||||
|
this.searchEmployee = searchEmployee;
|
||||||
|
this.updateEmployee = updateEmployee;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メールアドレスの重複チェック
|
||||||
|
*
|
||||||
|
* @param employeeList 元の employeeList
|
||||||
|
* @param updateEmployeeInfoForm 更新対象のデータ
|
||||||
|
* @return true:重複無し false:重複あり
|
||||||
|
*/
|
||||||
|
private static boolean checkDuplicateMailAddress(List<Employee> employeeList, UpdateEmployeeInfoForm updateEmployeeInfoForm) {
|
||||||
|
// メールアドレスが既に使われていた場合
|
||||||
|
if (!employeeList.isEmpty()) {
|
||||||
|
// 重複が有った場合に、同一人物のものであれば上書きOKとする
|
||||||
|
return Objects.equals(employeeList.get(0).getIdEmployee(), updateEmployeeInfoForm.getIdEmployee());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新結果画面表示処理
|
||||||
|
*
|
||||||
|
* @param updateEmployeeInfoForm 更新画面のフォーム
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@PermissionCheck
|
||||||
|
@SessionCheck
|
||||||
|
@RequestMapping(value = TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_RESULT, method = RequestMethod.POST)
|
||||||
|
public String employeeUpdateResult(@ModelAttribute UpdateEmployeeInfoForm updateEmployeeInfoForm, Model model) {
|
||||||
|
|
||||||
|
final String DUPLICATION = "既に登録済みのメールアドレスです。";
|
||||||
|
final String NOTHING = "項目が空欄です。";
|
||||||
|
final String ADMIN_USER = "更新対象者がログイン者のため、管理者権限を変更できません。";
|
||||||
|
final String NO_TARGET = "更新対象のデータが見つかりません。";
|
||||||
|
|
||||||
|
final String UPDATE_COMPLETE = "更新が完了しました。";
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// 部署一覧取得
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(searchDepartment.selectAll()));
|
||||||
|
|
||||||
|
// パスワードが仕様を満たしているか確認
|
||||||
|
String error = UpdateEmployeeInfoForm.validatePassword(
|
||||||
|
updateEmployeeInfoForm.getPassword(),
|
||||||
|
updateEmployeeInfoForm.getPasswordConfirm()
|
||||||
|
);
|
||||||
|
|
||||||
|
// エラーが存在するか
|
||||||
|
if (!error.isBlank()) {
|
||||||
|
// エラーが存在する場合、更新画面に遷移
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(error));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_EMPLOYEE_INFO_FORM, updateEmployeeInfoForm);
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// メールアドレスを元に検索
|
||||||
|
List<Employee> employeeList = searchEmployee.searchEmployee(updateEmployeeInfoForm.getMailAddress());
|
||||||
|
|
||||||
|
// 既に登録済みのメールアドレスが存在するか
|
||||||
|
if (!checkDuplicateMailAddress(employeeList, updateEmployeeInfoForm)) {
|
||||||
|
// 存在する場合はエラーメッセージを設定して更新入力画面に遷移
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_EMPLOYEE_INFO_FORM, updateEmployeeInfoForm);
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// session 情報からログイン者の情報を取得
|
||||||
|
LoginUserForm loginUserForm = (LoginUserForm) httpSession.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
|
// ログイン者が更新対象で、権限を管理者権限から一般権限に変更しようとしているかチェック
|
||||||
|
if (isUpdateTargetLoginUserAdminToNormal(updateEmployeeInfoForm, loginUserForm)) {
|
||||||
|
// 存在する場合はエラーメッセージを設定して更新入力画面に遷移
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(ADMIN_USER));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_EMPLOYEE_INFO_FORM, updateEmployeeInfoForm);
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 画面から渡ってきた値が必須を満たしているか
|
||||||
|
if (!UpdateEmployeeInfoForm.hasErrorParameter(updateEmployeeInfoForm)) {
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(NOTHING));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_EMPLOYEE_INFO_FORM, updateEmployeeInfoForm);
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新前のデータを取得
|
||||||
|
Employee beforeEmployee = searchEmployee.searchEmployeeByIdEmployee(updateEmployeeInfoForm.getIdEmployee());
|
||||||
|
if (beforeEmployee.getIdEmployee() == null) {
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(NO_TARGET));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_EMPLOYEE_INFO_FORM, updateEmployeeInfoForm);
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 画面用の型からビジネスロジック用のモデルに変換し、Updateを実行
|
||||||
|
updateEmployee.updateEmployee(beforeEmployee, UpdateEmployeeInfoForm.convertTo(updateEmployeeInfoForm));
|
||||||
|
|
||||||
|
// Update後の情報を再取得
|
||||||
|
LoginUser updatedTargetEmployee = searchEmployee.searchLoginUser(updateEmployeeInfoForm.getMailAddress());
|
||||||
|
|
||||||
|
// ログイン者と更新した対象が同じアカウントだった場合、session情報を更新
|
||||||
|
if (Objects.equals(updatedTargetEmployee.getIdEmployee(), loginUserForm.getIdEmployee())) {
|
||||||
|
// ログイン者の情報をセッション情報に格納
|
||||||
|
httpSession.setAttribute(SessionKeyword.LOGIN_USER, LoginUserForm.convertFrom(updatedTargetEmployee));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新結果のメッセージを画面にセットし一覧画面に遷移
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_INFO, new MessageForm(UPDATE_COMPLETE));
|
||||||
|
|
||||||
|
// forward 先で不用意な動作をしないために UpdateEmployeeInfoForm をクリア
|
||||||
|
return "forward:" + TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_INFO_FORM_EMPTY;
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ログイン情報の破棄
|
||||||
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// エラー画面遷移
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログイン者がログイン者自身を更新する際
|
||||||
|
* 管理者権限から一般権限に変更する内容も含まれているかチェックする
|
||||||
|
*
|
||||||
|
* @param updateEmployeeInfoForm 更新対象データ
|
||||||
|
* @param loginUserForm ログイン者情報
|
||||||
|
* @return true:ログイン者自身のデータをUpdate管理者→一般に権限変更しようとしている。
|
||||||
|
* false:Update対象者がログイン者自身ではない or 管理者権限 → 一般権限 への更新は含まれていない
|
||||||
|
*/
|
||||||
|
private boolean isUpdateTargetLoginUserAdminToNormal(UpdateEmployeeInfoForm updateEmployeeInfoForm, LoginUserForm loginUserForm) {
|
||||||
|
|
||||||
|
// ログイン者が今回の更新対象か
|
||||||
|
if (!Objects.equals(updateEmployeeInfoForm.getIdEmployee(), loginUserForm.getIdEmployee())) {
|
||||||
|
// 今回の対象者はログイン者ではない
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 管理者から一般権限への変更があるか
|
||||||
|
return updateEmployeeInfoForm.getAdminAuth().equals(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployee;
|
||||||
|
import com.example.rhizome.app.domain.service.UpdateEmployee;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.UpdatePersonalUserForm;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 個人情報更新用コントローラ
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class UpdatePersonalEmployeeResultController {
|
||||||
|
|
||||||
|
// ログ出力用インスタンス
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(UpdatePersonalEmployeeResultController.class.getName());
|
||||||
|
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
SearchEmployee searchEmployee;
|
||||||
|
UpdateEmployee updateEmployee;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public UpdatePersonalEmployeeResultController(HttpSession httpSession, SearchEmployee searchEmployee, UpdateEmployee updateEmployee) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
this.searchEmployee = searchEmployee;
|
||||||
|
this.updateEmployee = updateEmployee;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メールアドレスの重複チェック
|
||||||
|
*
|
||||||
|
* @param employeeList 元の employeeList
|
||||||
|
* @param updatePersonalUserForm 更新対象のデータ
|
||||||
|
* @return true:重複無し false:重複あり
|
||||||
|
*/
|
||||||
|
private static boolean checkDuplicateMailAddress(List<Employee> employeeList, UpdatePersonalUserForm updatePersonalUserForm) {
|
||||||
|
// メールアドレスが既に使われていた場合
|
||||||
|
if (!employeeList.isEmpty()) {
|
||||||
|
// 更新対象のデータと同じIDの場合は重複していないとみなす
|
||||||
|
return Objects.equals(employeeList.get(0).getIdEmployee(), updatePersonalUserForm.getIdEmployee());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public UpdatePersonalUserForm personalUpdateUserForm() {
|
||||||
|
return new UpdatePersonalUserForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 個人情報更新結果画面表示処理
|
||||||
|
*
|
||||||
|
* @param updatePersonalUserForm 個人情報更新画面のフォーム
|
||||||
|
* @param model ビューにデータを渡すためのコンテナ
|
||||||
|
* @return 遷移先の画面
|
||||||
|
*/
|
||||||
|
@PermissionCheck
|
||||||
|
@SessionCheck
|
||||||
|
@RequestMapping(value = TransitionTargetPageNameKeyword.PERSONAL_UPDATE_RESULT, method = RequestMethod.POST)
|
||||||
|
public String personalEmployeeUpdateResult(UpdatePersonalUserForm updatePersonalUserForm, Model model) {
|
||||||
|
|
||||||
|
final String NOTHING = "項目が空欄です。";
|
||||||
|
final String DUPLICATION = "既に登録済みのメールアドレスです。";
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// 更新完了画面からの遷移の場合
|
||||||
|
if (updatePersonalUserForm.getIdEmployee() == null) {
|
||||||
|
// ログイン者の情報を取得
|
||||||
|
LoginUserForm loginUserForm = (LoginUserForm) httpSession.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
// ログイン者の情報を元に個人情報更新画面の初期表示用のインスタンスを作成
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_PERSONAL_EMPLOYEE_USER_FORM, UpdatePersonalUserForm.convertFrom(searchEmployee.searchLoginUser(loginUserForm.getMailAddress())));
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_PERSONAL_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// パスワードが仕様を満たしているかチェック
|
||||||
|
String error = UpdatePersonalUserForm.validatePassword(
|
||||||
|
updatePersonalUserForm.getPassword(),
|
||||||
|
updatePersonalUserForm.getPasswordConfirm()
|
||||||
|
);
|
||||||
|
|
||||||
|
// エラーがあるか
|
||||||
|
if (!error.isBlank()) {
|
||||||
|
// エラーが有る場合メッセージをセットして個人情報更新入力画面に遷移
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(error));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_PERSONAL_EMPLOYEE_USER_FORM, updatePersonalUserForm);
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_PERSONAL_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 入力必須を満たしているか
|
||||||
|
if (!UpdatePersonalUserForm.hasErrorParameter(updatePersonalUserForm)) {
|
||||||
|
// 満たしていない場合、メッセージをセットして個人情報更新入力画面に遷移
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(NOTHING));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_PERSONAL_EMPLOYEE_USER_FORM, updatePersonalUserForm);
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_PERSONAL_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// メールアドレス重複チェック
|
||||||
|
if (!checkDuplicateMailAddress(
|
||||||
|
searchEmployee.searchEmployee(updatePersonalUserForm.getMailAddress()),
|
||||||
|
updatePersonalUserForm)
|
||||||
|
) {
|
||||||
|
// メールアドレスが既に使われていた場合
|
||||||
|
// 個人情報更新ページに遷移
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_PERSONAL_EMPLOYEE_USER_FORM, updatePersonalUserForm);
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_PERSONAL_EMPLOYEE_INPUT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新前のEmployeeの情報を取得
|
||||||
|
// 画面用のインスタンスから更新用のインスタンスに変換し、Update実施
|
||||||
|
updateEmployee.updateEmployee(
|
||||||
|
searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee()),
|
||||||
|
UpdatePersonalUserForm.convertTo(updatePersonalUserForm)
|
||||||
|
);
|
||||||
|
|
||||||
|
// ログイン者の情報をセッション情報に格納
|
||||||
|
httpSession.setAttribute(
|
||||||
|
SessionKeyword.LOGIN_USER,
|
||||||
|
LoginUserForm.convertFrom(
|
||||||
|
searchEmployee.searchLoginUser(updatePersonalUserForm.getMailAddress()))
|
||||||
|
);
|
||||||
|
|
||||||
|
// 更新結果画面に遷移
|
||||||
|
return TransitionTargetPageNameKeyword.UPDATE_PERSONAL_RESULT_HTML;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ログイン情報の破棄
|
||||||
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
// エラーログ出力
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// エラー画面遷移
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller.pageproperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Servlet から Servlet に返却する際に使用する文字列を管理するクラス
|
||||||
|
*/
|
||||||
|
public class PageReturnAttributeKeyword {
|
||||||
|
|
||||||
|
public static final String MESSAGE_ERROR = "messageError";
|
||||||
|
public static final String MESSAGE_INFO = "messageInfo";
|
||||||
|
|
||||||
|
public static final String DEPARTMENT_FORM_LIST = "departmentFormList";
|
||||||
|
public static final String UPDATE_EMPLOYEE_INFO_FORM = "updateEmployeeInfoForm";
|
||||||
|
public static final String INSERT_EMPLOYEE_FORM = "insertEmployeeForm";
|
||||||
|
public static final String LOGIN_INFO_FORM = "loginInfoForm";
|
||||||
|
public static final String UPDATE_PERSONAL_EMPLOYEE_USER_FORM = "updatePersonalEmployeeUserForm";
|
||||||
|
public static final String EMPLOYEE_INFO_FORM_LIST = "employeeInfoFormList";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller.pageproperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sessionキーを管理する
|
||||||
|
*/
|
||||||
|
public class SessionKeyword {
|
||||||
|
// SESSION情報として格納したいログイン者の情報
|
||||||
|
public static final String LOGIN_USER = "loginUser";
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller.pageproperty;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* システムで利用しているJSPのリスト
|
||||||
|
*/
|
||||||
|
public class TransitionTargetPageNameKeyword {
|
||||||
|
|
||||||
|
// 共通
|
||||||
|
public static final String LOGIN_HTML = "login";
|
||||||
|
|
||||||
|
// 一般向け
|
||||||
|
public static final String UPDATE_PERSONAL_EMPLOYEE_INPUT_HTML = "updatePersonalEmployeeInput";
|
||||||
|
public static final String UPDATE_PERSONAL_RESULT_HTML = "updatePersonalEmployeeResult";
|
||||||
|
|
||||||
|
// 管理者向け
|
||||||
|
public static final String MENU_HTML = "menu";
|
||||||
|
public static final String SELECT_EMPLOYEE_HTML = "selectEmployee";
|
||||||
|
public static final String INSERT_EMPLOYEE_INPUT_HTML = "insertEmployeeInput";
|
||||||
|
public static final String INSERT_EMPLOYEE_CONFIRM_HTML = "insertEmployeeConfirm";
|
||||||
|
public static final String INSERT_EMPLOYEE_RESULT_HTML = "insertEmployeeResult";
|
||||||
|
public static final String UPDATE_EMPLOYEE_INPUT_HTML = "updateEmployeeInput";
|
||||||
|
|
||||||
|
public static final String ERROR_HTML = "error";
|
||||||
|
|
||||||
|
// 共通(Controller)
|
||||||
|
public static final String INDEX_BLANK = "";
|
||||||
|
public static final String INDEX_SLASH = "/";
|
||||||
|
public static final String INDEX_LOGIN = "/login";
|
||||||
|
public static final String LOGOUT = "/logout";
|
||||||
|
public static final String DO_LOGIN = "/doLogin";
|
||||||
|
|
||||||
|
// 一般向け(Controller)
|
||||||
|
public static final String PERSONAL_UPDATE_RESULT = "/updatePersonalEmployeeResult";
|
||||||
|
|
||||||
|
// 管理者向け(Controller)
|
||||||
|
public static final String DELETE_EMPLOYEE = "/deleteEmployee";
|
||||||
|
public static final String INSERT_EMPLOYEE_INPUT = "/insertEmployeeInput";
|
||||||
|
public static final String INSERT_EMPLOYEE_CONFIRM = "/insertEmployeeConfirm";
|
||||||
|
public static final String INSERT_EMPLOYEE = "/insertEmployee";
|
||||||
|
public static final String SHOW_MENU = "/showMenu";
|
||||||
|
public static final String SELECT_EMPLOYEE_INFO = "/selectEmployeeInfo";
|
||||||
|
public static final String SELECT_EMPLOYEE_INFO_FORM_EMPTY = "/selectAll";
|
||||||
|
public static final String SHOW_UPDATE_EMPLOYEE = "/showUpdateEmployee";
|
||||||
|
public static final String UPDATE_EMPLOYEE_RESULT = "/updateEmployeeResult";
|
||||||
|
|
||||||
|
// Department
|
||||||
|
// HTML
|
||||||
|
// Controller
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理者向けのページリストを返す
|
||||||
|
*
|
||||||
|
* @return 管理者向けのページリスト
|
||||||
|
*/
|
||||||
|
public static Set<String> getAdminPageList() {
|
||||||
|
|
||||||
|
return Set.of(
|
||||||
|
INDEX_BLANK,
|
||||||
|
INDEX_SLASH,
|
||||||
|
INDEX_LOGIN,
|
||||||
|
LOGOUT,
|
||||||
|
DO_LOGIN,
|
||||||
|
DELETE_EMPLOYEE,
|
||||||
|
INSERT_EMPLOYEE_INPUT,
|
||||||
|
INSERT_EMPLOYEE_CONFIRM,
|
||||||
|
INSERT_EMPLOYEE,
|
||||||
|
SHOW_MENU,
|
||||||
|
SELECT_EMPLOYEE_INFO,
|
||||||
|
SELECT_EMPLOYEE_INFO_FORM_EMPTY,
|
||||||
|
SHOW_UPDATE_EMPLOYEE,
|
||||||
|
UPDATE_EMPLOYEE_RESULT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一般向けのページリストを返す
|
||||||
|
*
|
||||||
|
* @return 一般向けのページリスト
|
||||||
|
*/
|
||||||
|
public static Set<String> getUserPageList() {
|
||||||
|
return Set.of(
|
||||||
|
INDEX_BLANK,
|
||||||
|
INDEX_SLASH,
|
||||||
|
INDEX_LOGIN,
|
||||||
|
LOGOUT,
|
||||||
|
DO_LOGIN,
|
||||||
|
PERSONAL_UPDATE_RESULT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面の表示に使う部署コード管理用のクラス
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DepartmentForm {
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private Integer idDepartment;
|
||||||
|
/**
|
||||||
|
* 部署名
|
||||||
|
*/
|
||||||
|
private String nmDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* business 層の Department クラスから画面用(presentation 層)の DepartmentForm に
|
||||||
|
* 変換します。
|
||||||
|
*
|
||||||
|
* @param department business 層の Department インスタンス
|
||||||
|
* @return 画面用(presentation 層)の DepartmentForm インスタンス
|
||||||
|
*/
|
||||||
|
public static DepartmentForm convertFrom(Department department) {
|
||||||
|
return new DepartmentForm(department.getIdDepartment(), department.getNmDepartment());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* business 層の Department クラスから画面用(presentation 層)の DepartmentForm に
|
||||||
|
* 変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param departmentList business 層の Department インスタンスのリスト
|
||||||
|
* @return 画面用(presentation 層)の DepartmentForm インスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static List<DepartmentForm> convertFrom(List<Department> departmentList) {
|
||||||
|
return departmentList.stream().map(DepartmentForm::convertFrom).toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面に表示するために employee と department を Join した構造を扱うクラス
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class EmployeeInfoForm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
private Integer idEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
private String nmEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
private String knEmployee;
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private String mailAddress;
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
private Integer adminAuth;
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private Integer idDepartment;
|
||||||
|
/**
|
||||||
|
* 部署名
|
||||||
|
*/
|
||||||
|
private String nmDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* business 層の EmployeeInfo クラスから画面用(presentation 層)の EmployeeInfoForm に
|
||||||
|
* 変換します。
|
||||||
|
*
|
||||||
|
* @param employeeInfo business 層の EmployeeInfo インスタンス
|
||||||
|
* @return クラスから画面用(presentation 層)の EmployeeInfoForm インスタンス
|
||||||
|
*/
|
||||||
|
public static EmployeeInfoForm convertFrom(EmployeeInfo employeeInfo) {
|
||||||
|
return new EmployeeInfoForm(
|
||||||
|
employeeInfo.getEmployee().getIdEmployee(),
|
||||||
|
employeeInfo.getEmployee().getNmEmployee(),
|
||||||
|
employeeInfo.getEmployee().getKnEmployee(),
|
||||||
|
employeeInfo.getEmployee().getMailAddress(),
|
||||||
|
employeeInfo.getEmployee().getPassword(),
|
||||||
|
employeeInfo.getEmployee().getAdminAuth(),
|
||||||
|
employeeInfo.getDepartment().getIdDepartment(),
|
||||||
|
employeeInfo.getDepartment().getNmDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* business 層の EmployeeInfo クラスから画面用(presentation 層)の EmployeeInfoForm に
|
||||||
|
* 変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param employeeInfoList business 層の EmployeeInfo インスタンスのリスト
|
||||||
|
* @return クラスから画面用(presentation 層)の EmployeeInfoForm インスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static List<EmployeeInfoForm> convertFrom(List<EmployeeInfo> employeeInfoList) {
|
||||||
|
return employeeInfoList.stream().map(EmployeeInfoForm::convertFrom).toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面から渡ってきた登録内容をまとめ、再度画面に表示する為のクラス
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class InsertEmployeeForm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
private String nmEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
private String knEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private String mailAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 確認用パスワード
|
||||||
|
*/
|
||||||
|
private String passwordConfirm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
|
*/
|
||||||
|
private Integer adminAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private Integer idDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワードのValidation
|
||||||
|
* チェック対象にエラーが有った場合エラーリストに文言を追加する
|
||||||
|
*
|
||||||
|
* @param password 登録対象のパスワード
|
||||||
|
* @param passwordConfirm 登録対象のパスワード再入力
|
||||||
|
* @param error エラーリスト
|
||||||
|
*/
|
||||||
|
private static void checkPassword(String password, String passwordConfirm, List<String> error) {
|
||||||
|
final String PASSWORD_NULL_BLANK = "パスワード が未入力です。";
|
||||||
|
final String PASSWORD_CONFIRM_NULL_BLANK = "パスワード確認用 が未入力です。";
|
||||||
|
final String PASSWORD_MISMATCH = "パスワード と パスワード確認用 が一致しません。";
|
||||||
|
|
||||||
|
if (isNullOrBlank(password)) {
|
||||||
|
error.add(PASSWORD_NULL_BLANK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isNullOrBlank(passwordConfirm)) {
|
||||||
|
error.add(PASSWORD_CONFIRM_NULL_BLANK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!password.equals(passwordConfirm)) {
|
||||||
|
error.add(PASSWORD_MISMATCH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仮引数を null or 空 判定する
|
||||||
|
*
|
||||||
|
* @param str 判定対象の文字列
|
||||||
|
* @return true:null or 空 false:null or 空 では無い
|
||||||
|
*/
|
||||||
|
private static boolean isNullOrBlank(String str) {
|
||||||
|
if (null == str) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str.isBlank();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面から渡ってきた登録内容をまとめ、ビジネスモデルに変換
|
||||||
|
*
|
||||||
|
* @param insertEmployeeForm 画面から渡ってきた登録内容
|
||||||
|
* @return ビジネスモデルのインスタンス
|
||||||
|
*/
|
||||||
|
public static Employee convertTo(InsertEmployeeForm insertEmployeeForm) {
|
||||||
|
return new Employee(
|
||||||
|
null,
|
||||||
|
insertEmployeeForm.getNmEmployee(),
|
||||||
|
insertEmployeeForm.getKnEmployee(),
|
||||||
|
insertEmployeeForm.getMailAddress(),
|
||||||
|
insertEmployeeForm.getPassword(),
|
||||||
|
insertEmployeeForm.getAdminAuth(),
|
||||||
|
insertEmployeeForm.getIdDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登録データのValidationを行う
|
||||||
|
*
|
||||||
|
* @return エラーが有った場合はエラー文言、無ければ空のリストが返る
|
||||||
|
*/
|
||||||
|
public List<String> validateParameter() {
|
||||||
|
final String EMPLOYEE_NAME_NULL_BLANK = "社員名";
|
||||||
|
final String EMPLOYEE_KANA_NULL_BLANK = "社員名フリガナ";
|
||||||
|
final String MAIL_ADDRESS_NULL_BLANK = "メールアドレス";
|
||||||
|
final String MANAGEMENT_ERROR = "管理者権限指定";
|
||||||
|
final String DEPARTMENT_ID_NULL_BLANK = "所属部署";
|
||||||
|
|
||||||
|
List<String> error = new ArrayList<>();
|
||||||
|
|
||||||
|
if (isNullOrBlank(nmEmployee)) {
|
||||||
|
error.add(EMPLOYEE_NAME_NULL_BLANK);
|
||||||
|
}
|
||||||
|
if (isNullOrBlank(knEmployee)) {
|
||||||
|
error.add(EMPLOYEE_KANA_NULL_BLANK);
|
||||||
|
}
|
||||||
|
if (isNullOrBlank(mailAddress)) {
|
||||||
|
error.add(MAIL_ADDRESS_NULL_BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
|
// パスワードが仕様を満たしているか確認
|
||||||
|
checkPassword(password, passwordConfirm, error);
|
||||||
|
|
||||||
|
if (adminAuth == null) {
|
||||||
|
error.add(MANAGEMENT_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idDepartment == null) {
|
||||||
|
error.add(DEPARTMENT_ID_NULL_BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ログインを試みる人を表現するモデルクラスです
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class LoginInfoForm {
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private String mailAddress;
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class LoginUserForm {
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
private Integer idEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
private String nmEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
private String knEmployee;
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private String mailAddress;
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
|
*/
|
||||||
|
private Integer adminAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private Integer idDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* business 層の LoginUser クラスから画面用(presentation 層)の LoginUserForm に
|
||||||
|
* 変換します。
|
||||||
|
*
|
||||||
|
* @param loginUser business 層の LoginUser インスタンス
|
||||||
|
* @return クラスから画面用(presentation 層)の LoginUserForm
|
||||||
|
*/
|
||||||
|
public static LoginUserForm convertFrom(LoginUser loginUser) {
|
||||||
|
return new LoginUserForm(
|
||||||
|
loginUser.getIdEmployee(),
|
||||||
|
loginUser.getNmEmployee(),
|
||||||
|
loginUser.getKnEmployee(),
|
||||||
|
loginUser.getMailAddress(),
|
||||||
|
loginUser.getPassword(),
|
||||||
|
loginUser.getAdminAuth(),
|
||||||
|
loginUser.getIdDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面用(presentation 層)の LoginUserForm クラスから business 層の LoginUser クラスに
|
||||||
|
* 変換します。
|
||||||
|
*
|
||||||
|
* @param loginUserForm 画面用(presentation 層)の LoginUserForm インスタンス
|
||||||
|
* @return business 層の LoginUser インスタンス
|
||||||
|
*/
|
||||||
|
public static LoginUser convertTo(LoginUserForm loginUserForm) {
|
||||||
|
return new LoginUser(
|
||||||
|
loginUserForm.getIdEmployee(),
|
||||||
|
loginUserForm.getNmEmployee(),
|
||||||
|
loginUserForm.getKnEmployee(),
|
||||||
|
loginUserForm.getMailAddress(),
|
||||||
|
loginUserForm.getPassword(),
|
||||||
|
loginUserForm.getAdminAuth(),
|
||||||
|
loginUserForm.getIdDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面から渡ってきた必須の値が仕様を満たしているか確認
|
||||||
|
*
|
||||||
|
* @param loginInfoForm 画面から渡ってきた mailAddress, password を格納しているインスタンス
|
||||||
|
* @return true:仕様を満たしている , false:仕様を満たしていない
|
||||||
|
*/
|
||||||
|
public static boolean checkParameter(LoginInfoForm loginInfoForm) {
|
||||||
|
if (null == loginInfoForm.getMailAddress()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loginInfoForm.getMailAddress().isBlank()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null == loginInfoForm.getPassword()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !loginInfoForm.getPassword().isBlank();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理者権限を持っているか確認
|
||||||
|
*
|
||||||
|
* @return true:管理者権限を持っている , false:管理者権限を持っていない
|
||||||
|
*/
|
||||||
|
public boolean isAdminUser() {
|
||||||
|
return getAdminAuth() == 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面に表示するエラーメッセージを管理するクラスです。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MessageForm {
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionEmployee;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面から渡ってきた検索条件をまとめ、再度画面に表示する為のクラス
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SearchConditionEmployeeForm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
private Integer idEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
private String nmEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
private String knEmployee;
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private String mailAddress;
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private Integer idDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* business 層の SearchConditionEmployee クラスから画面用(presentation 層)の SearchConditionEmployeeForm に
|
||||||
|
* 変換します。
|
||||||
|
*
|
||||||
|
* @param searchConditionEmployee business 層の SearchConditionEmployee インスタンス
|
||||||
|
* @return 画面用(presentation 層)の SearchConditionEmployeeForm インスタンス
|
||||||
|
*/
|
||||||
|
public static SearchConditionEmployeeForm convertFrom(SearchConditionEmployee searchConditionEmployee) {
|
||||||
|
return new SearchConditionEmployeeForm(
|
||||||
|
searchConditionEmployee.getIdEmployee(),
|
||||||
|
searchConditionEmployee.getNmEmployee(),
|
||||||
|
searchConditionEmployee.getKnEmployee(),
|
||||||
|
searchConditionEmployee.getMailAddress(),
|
||||||
|
searchConditionEmployee.getIdDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面用(presentation 層)の SearchConditionEmployeeForm クラスから business 層の SearchConditionEmployee クラスに
|
||||||
|
* 変換します。
|
||||||
|
*
|
||||||
|
* @param searchConditionEmployeeForm 画面用(presentation 層)の SearchConditionEmployeeForm インスタンス
|
||||||
|
* @return business 層の SearchConditionEmployee インスタンス
|
||||||
|
*/
|
||||||
|
public static SearchConditionEmployee convertTo(SearchConditionEmployeeForm searchConditionEmployeeForm) {
|
||||||
|
return new SearchConditionEmployee(
|
||||||
|
searchConditionEmployeeForm.getIdEmployee(),
|
||||||
|
searchConditionEmployeeForm.getNmEmployee(),
|
||||||
|
searchConditionEmployeeForm.getKnEmployee(),
|
||||||
|
searchConditionEmployeeForm.getMailAddress(),
|
||||||
|
searchConditionEmployeeForm.getIdDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.model.EmployeeInfo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面から渡ってきた更新内容をまとめ、再度画面に表示する為のクラス
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class UpdateEmployeeInfoForm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
private Integer idEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
private String nmEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
private String knEmployee;
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private String mailAddress;
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
/**
|
||||||
|
* パスワード確認用
|
||||||
|
*/
|
||||||
|
private String passwordConfirm;
|
||||||
|
/**
|
||||||
|
* 管理者権限
|
||||||
|
*/
|
||||||
|
private Integer adminAuth;
|
||||||
|
/**
|
||||||
|
* 部署ID
|
||||||
|
*/
|
||||||
|
private Integer idDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* business 層の EmployeeInfo クラスから画面用(presentation 層)の UpdateEmployeeInfoForm に
|
||||||
|
* 変換します。
|
||||||
|
*
|
||||||
|
* @param employeeInfo business 層の EmployeeInfo インスタンス
|
||||||
|
* @return 画面用(presentation 層)の UpdateEmployeeInfoForm インスタンス
|
||||||
|
*/
|
||||||
|
public static UpdateEmployeeInfoForm convertFrom(EmployeeInfo employeeInfo) {
|
||||||
|
return new UpdateEmployeeInfoForm(
|
||||||
|
employeeInfo.getEmployee().getIdEmployee(),
|
||||||
|
employeeInfo.getEmployee().getNmEmployee(),
|
||||||
|
employeeInfo.getEmployee().getKnEmployee(),
|
||||||
|
employeeInfo.getEmployee().getMailAddress(),
|
||||||
|
employeeInfo.getEmployee().getPassword(),
|
||||||
|
null,
|
||||||
|
employeeInfo.getEmployee().getAdminAuth(),
|
||||||
|
employeeInfo.getDepartment().getIdDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* business 層の EmployeeInfo クラスから画面用(presentation 層)の UpdateEmployeeInfoForm に
|
||||||
|
* 変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param employeeInfoList business 層の EmployeeInfo インスタンスのリスト
|
||||||
|
* @return 画面用(presentation 層)の UpdateEmployeeInfoForm インスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static List<UpdateEmployeeInfoForm> convertFrom(List<EmployeeInfo> employeeInfoList) {
|
||||||
|
return employeeInfoList.stream().map(UpdateEmployeeInfoForm::convertFrom).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面用(presentation 層)の UpdateEmployeeInfoForm クラスから business 層の Employee クラスに
|
||||||
|
* 変換します。
|
||||||
|
*
|
||||||
|
* @param updateEmployeeInfoForm 画面用(presentation 層)の UpdateEmployeeInfoForm インスタンス
|
||||||
|
* @return business 層の Employee インスタンス
|
||||||
|
*/
|
||||||
|
public static Employee convertTo(UpdateEmployeeInfoForm updateEmployeeInfoForm) {
|
||||||
|
return new Employee(
|
||||||
|
updateEmployeeInfoForm.getIdEmployee(),
|
||||||
|
updateEmployeeInfoForm.getNmEmployee(),
|
||||||
|
updateEmployeeInfoForm.getKnEmployee(),
|
||||||
|
updateEmployeeInfoForm.getMailAddress(),
|
||||||
|
updateEmployeeInfoForm.getPassword(),
|
||||||
|
updateEmployeeInfoForm.getAdminAuth(),
|
||||||
|
updateEmployeeInfoForm.getIdDepartment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面から渡ってきたパラメータのチェック
|
||||||
|
*
|
||||||
|
* @param updateEmployeeInfoForm 画面から渡ってきたパラメータ
|
||||||
|
* @return true: エラー無し false:エラーあり(必須を満たしていない)
|
||||||
|
*/
|
||||||
|
public static boolean hasErrorParameter(UpdateEmployeeInfoForm updateEmployeeInfoForm) {
|
||||||
|
|
||||||
|
boolean errorFlag = !isNullOrBlank(updateEmployeeInfoForm.getNmEmployee());
|
||||||
|
|
||||||
|
if (!isNullOrBlank(updateEmployeeInfoForm.getKnEmployee())) {
|
||||||
|
errorFlag = true;
|
||||||
|
}
|
||||||
|
if (!isNullOrBlank(updateEmployeeInfoForm.getMailAddress())) {
|
||||||
|
errorFlag = true;
|
||||||
|
}
|
||||||
|
if (!isNullOrBlank(updateEmployeeInfoForm.getPassword())) {
|
||||||
|
errorFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return errorFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワードの仕様チェック
|
||||||
|
* パスワードが仕様を満たしてないか確認
|
||||||
|
*
|
||||||
|
* @param password 更新対象のパスワード
|
||||||
|
* @param passwordConfirm 更新対象の確認用パスワード
|
||||||
|
* @return 空文字: エラー無し それ以外:エラー内容
|
||||||
|
*/
|
||||||
|
public static String validatePassword(String password, String passwordConfirm) {
|
||||||
|
|
||||||
|
final String ERROR = "パスワードが一致していません";
|
||||||
|
|
||||||
|
if (areBothBlank(password, passwordConfirm)) {
|
||||||
|
// どちらもnullまたは空白の場合はOK
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// どちらかがnullまたは空白の場合のエラーハンドリング
|
||||||
|
if (isEitherBlank(password, passwordConfirm)) {
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 値が異なった場合はエラーハンドリング
|
||||||
|
if (!password.equals(passwordConfirm)) {
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仮引数を null or 空 判定する
|
||||||
|
*
|
||||||
|
* @param str 判定対象の文字列
|
||||||
|
* @return true:null or 空 false:null or 空 では無い
|
||||||
|
*/
|
||||||
|
private static boolean isNullOrBlank(String str) {
|
||||||
|
if (null == str) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return str.isBlank();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワードが今回更新対象に含まれているかチェック
|
||||||
|
*
|
||||||
|
* @param password 更新対象のパスワード
|
||||||
|
* @param passwordConfirm 更新対象の確認用パスワード
|
||||||
|
* @return true:どちらもnullまたは空白の場合 false:それ以外
|
||||||
|
*/
|
||||||
|
private static boolean areBothBlank(String password, String passwordConfirm) {
|
||||||
|
return (password == null || password.isBlank()) && (passwordConfirm == null || passwordConfirm.isBlank());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワードが今回更新対象に含まれているかチェック その2
|
||||||
|
*
|
||||||
|
* @param password 更新対象のパスワード
|
||||||
|
* @param passwordConfirm 更新対象の確認用パスワード
|
||||||
|
* @return true: 問題なし false:どちらかがnullまたは空白の場合
|
||||||
|
*/
|
||||||
|
// どちらかがnullまたは空白の場合のエラーハンドリング
|
||||||
|
private static boolean isEitherBlank(String password, String passwordConfirm) {
|
||||||
|
return password == null || password.isBlank() || passwordConfirm == null || passwordConfirm.isBlank();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,185 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.Employee;
|
||||||
|
import com.example.rhizome.app.domain.model.LoginUser;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 個人情報更新画面のフォームクラスです。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class UpdatePersonalUserForm {
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
private Integer idEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
private String nmEmployee;
|
||||||
|
/**
|
||||||
|
* 社員名カナ
|
||||||
|
*/
|
||||||
|
private String knEmployee;
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
private String mailAddress;
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
/**
|
||||||
|
* パスワード確認用
|
||||||
|
*/
|
||||||
|
private String passwordConfirm;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面用(presentation 層)の UpdatePersonalUserForm クラスから business 層の Employee クラスに
|
||||||
|
* 変換します。
|
||||||
|
*
|
||||||
|
* @param updatePersonalUserForm 画面用(presentation 層)の UpdatePersonalUserForm インスタンス
|
||||||
|
* @return business 層の Employee インスタンス
|
||||||
|
*/
|
||||||
|
public static Employee convertTo(UpdatePersonalUserForm updatePersonalUserForm) {
|
||||||
|
return new Employee(
|
||||||
|
updatePersonalUserForm.getIdEmployee(),
|
||||||
|
updatePersonalUserForm.getNmEmployee(),
|
||||||
|
updatePersonalUserForm.getKnEmployee(),
|
||||||
|
updatePersonalUserForm.getMailAddress(),
|
||||||
|
updatePersonalUserForm.getPassword(),
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* business 層の Employee クラスから画面用(presentation 層)の UpdatePersonalUserForm に
|
||||||
|
* 変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param employee business 層の employee インスタンスのリスト
|
||||||
|
* @return クラスから画面用(presentation 層)の UpdatePersonalUserForm インスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static UpdatePersonalUserForm convertFrom(Employee employee) {
|
||||||
|
return new UpdatePersonalUserForm(
|
||||||
|
employee.getIdEmployee(),
|
||||||
|
employee.getNmEmployee(),
|
||||||
|
employee.getKnEmployee(),
|
||||||
|
employee.getMailAddress(),
|
||||||
|
employee.getPassword(),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* business 層の Employee クラスから画面用(presentation 層)の UpdatePersonalUserForm に
|
||||||
|
* 変換します。(リスト版)
|
||||||
|
*
|
||||||
|
* @param loginUser business 層の loginUser インスタンスのリスト
|
||||||
|
* @return クラスから画面用(presentation 層)の UpdatePersonalUserForm インスタンスのリスト
|
||||||
|
*/
|
||||||
|
public static UpdatePersonalUserForm convertFrom(LoginUser loginUser) {
|
||||||
|
return new UpdatePersonalUserForm(
|
||||||
|
loginUser.getIdEmployee(),
|
||||||
|
loginUser.getNmEmployee(),
|
||||||
|
loginUser.getKnEmployee(),
|
||||||
|
loginUser.getMailAddress(),
|
||||||
|
loginUser.getPassword(),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面から渡ってきたパラメータのチェック
|
||||||
|
*
|
||||||
|
* @param updatePersonalUserForm 画面から渡ってきたパラメータ
|
||||||
|
* @return true: エラー無し false:エラーあり(必須を満たしていない)
|
||||||
|
*/
|
||||||
|
public static boolean hasErrorParameter(UpdatePersonalUserForm updatePersonalUserForm) {
|
||||||
|
|
||||||
|
boolean errorFlag = !isNullOrBlank(updatePersonalUserForm.getNmEmployee());
|
||||||
|
|
||||||
|
if (!isNullOrBlank(updatePersonalUserForm.getKnEmployee())) {
|
||||||
|
errorFlag = true;
|
||||||
|
}
|
||||||
|
if (!isNullOrBlank(updatePersonalUserForm.getMailAddress())) {
|
||||||
|
errorFlag = true;
|
||||||
|
}
|
||||||
|
if (!isNullOrBlank(updatePersonalUserForm.getPassword())) {
|
||||||
|
errorFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return errorFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワードの仕様チェック
|
||||||
|
* パスワードが仕様を満たしてないか確認
|
||||||
|
*
|
||||||
|
* @param password 更新対象のパスワード
|
||||||
|
* @param passwordConfirm 更新対象の確認用パスワード
|
||||||
|
* @return 空文字: エラー無し それ以外:エラー内容
|
||||||
|
*/
|
||||||
|
public static String validatePassword(String password, String passwordConfirm) {
|
||||||
|
|
||||||
|
final String ERROR = "パスワードが一致していません";
|
||||||
|
|
||||||
|
if (areBothBlank(password, passwordConfirm)) {
|
||||||
|
// どちらもnullまたは空白の場合はOK
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// どちらかがnullまたは空白の場合のエラーハンドリング
|
||||||
|
if (isEitherBlank(password, passwordConfirm)) {
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 値が異なった場合はエラーハンドリング
|
||||||
|
if (!password.equals(passwordConfirm)) {
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仮引数を null or 空 判定する
|
||||||
|
*
|
||||||
|
* @param str 判定対象の文字列
|
||||||
|
* @return true:null or 空 false:null or 空 では無い
|
||||||
|
*/
|
||||||
|
private static boolean isNullOrBlank(String str) {
|
||||||
|
if (null == str) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return str.isBlank();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワードが今回更新対象に含まれているかチェック
|
||||||
|
*
|
||||||
|
* @param password 更新対象のパスワード
|
||||||
|
* @param passwordConfirm 更新対象の確認用パスワード
|
||||||
|
* @return true:どちらもnullまたは空白の場合 false:それ以外
|
||||||
|
*/
|
||||||
|
private static boolean areBothBlank(String password, String passwordConfirm) {
|
||||||
|
return (password == null || password.isBlank()) && (passwordConfirm == null || passwordConfirm.isBlank());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワードが今回更新対象に含まれているかチェック その2
|
||||||
|
*
|
||||||
|
* @param password 更新対象のパスワード
|
||||||
|
* @param passwordConfirm 更新対象の確認用パスワード
|
||||||
|
* @return true: 問題なし false:どちらかがnullまたは空白の場合
|
||||||
|
*/
|
||||||
|
private static boolean isEitherBlank(String password, String passwordConfirm) {
|
||||||
|
return password == null || password.isBlank() || passwordConfirm == null || passwordConfirm.isBlank();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.example.rhizome.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 権限不足の例外を表現するクラスです。
|
||||||
|
*/
|
||||||
|
public class InsufficientPermissionException extends RuntimeException {
|
||||||
|
|
||||||
|
public InsufficientPermissionException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.example.rhizome.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 権限不足の例外を表現するクラスです。
|
||||||
|
*/
|
||||||
|
public class NoSessionException extends RuntimeException {
|
||||||
|
|
||||||
|
public NoSessionException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
3
src/main/resources/application.properties
Normal file
3
src/main/resources/application.properties
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
spring.datasource.url=jdbc:mysql://localhost:3306/rezodb
|
||||||
|
spring.datasource.username=rezouser
|
||||||
|
spring.datasource.password=Rezo_0000
|
||||||
10563
src/main/resources/static/css/all.css
Normal file
10563
src/main/resources/static/css/all.css
Normal file
File diff suppressed because it is too large
Load Diff
2046
src/main/resources/static/css/brands.css
Normal file
2046
src/main/resources/static/css/brands.css
Normal file
File diff suppressed because it is too large
Load Diff
8438
src/main/resources/static/css/fontawesome.css
vendored
Normal file
8438
src/main/resources/static/css/fontawesome.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
22
src/main/resources/static/css/regular.css
Normal file
22
src/main/resources/static/css/regular.css
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*!
|
||||||
|
* Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
|
||||||
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||||
|
* Copyright 2023 Fonticons, Inc.
|
||||||
|
*/
|
||||||
|
:root, :host {
|
||||||
|
--fa-style-family-classic: 'Font Awesome 6 Free';
|
||||||
|
--fa-font-regular: normal 400 1em/1 'Font Awesome 6 Free';
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Font Awesome 6 Free';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
font-display: block;
|
||||||
|
src: url("../webfonts/fa-regular-400.woff2") format("woff2"), url("../webfonts/fa-regular-400.ttf") format("truetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
.far,
|
||||||
|
.fa-regular {
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
22
src/main/resources/static/css/solid.css
Normal file
22
src/main/resources/static/css/solid.css
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*!
|
||||||
|
* Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
|
||||||
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||||
|
* Copyright 2023 Fonticons, Inc.
|
||||||
|
*/
|
||||||
|
:root, :host {
|
||||||
|
--fa-style-family-classic: 'Font Awesome 6 Free';
|
||||||
|
--fa-font-solid: normal 900 1em/1 'Font Awesome 6 Free';
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Font Awesome 6 Free';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 900;
|
||||||
|
font-display: block;
|
||||||
|
src: url("../webfonts/fa-solid-900.woff2") format("woff2"), url("../webfonts/fa-solid-900.ttf") format("truetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
.fas,
|
||||||
|
.fa-solid {
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
171
src/main/resources/static/css/style.css
Normal file
171
src/main/resources/static/css/style.css
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
@CHARSET "UTF-8";
|
||||||
|
|
||||||
|
/* グローバル */
|
||||||
|
* {
|
||||||
|
color: #505050;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
border-left: 10px solid #696969;
|
||||||
|
border-bottom: 1px solid #696969;
|
||||||
|
padding: 10px;
|
||||||
|
width: 50%;
|
||||||
|
max-width: 960px;
|
||||||
|
min-width: 640px;
|
||||||
|
font-size: 15pt;
|
||||||
|
font-weight: bold;
|
||||||
|
display: flex; /* フレックスボックスを使う */
|
||||||
|
justify-content: space-between; /* 左右の要素を端に寄せる */
|
||||||
|
align-items: center; /* 上下中央に配置 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.rightSection {
|
||||||
|
display: flex; /* フレックスボックスを使う */
|
||||||
|
align-items: center; /* 上下中央に配置 */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 入力フォーム */
|
||||||
|
|
||||||
|
input, button, select {
|
||||||
|
padding: 5px 15px 5px 15px;
|
||||||
|
margin: 3px;
|
||||||
|
/* border-radius: 5px; /* CSS3草案 */
|
||||||
|
/* -webkit-border-radius: 5px; /* Safari,Google Chrome用 */
|
||||||
|
/* -moz-border-radius: 5px; /* Firefox用 */
|
||||||
|
}
|
||||||
|
|
||||||
|
input.readOnly {
|
||||||
|
background-color: #696969;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* メッセージボックスデザイン */
|
||||||
|
|
||||||
|
.msgBox {
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #696969;
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
background-color: #ffb6c1;
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning {
|
||||||
|
background-color: #ff8c00;
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
background-color: #b0c4de;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 個別デザイン */
|
||||||
|
|
||||||
|
th.header {
|
||||||
|
width: 150px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginInfo {
|
||||||
|
font-size: 9pt;
|
||||||
|
color: #008080;
|
||||||
|
margin-right: 10px; /* ログアウトボタンとの間隔 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.logoutButton {
|
||||||
|
font-size: 9pt;
|
||||||
|
background-color: #008080;
|
||||||
|
color: #ffffff;
|
||||||
|
border: none;
|
||||||
|
padding: 5px 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.btnArea {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-spacing {
|
||||||
|
margin-top: 20px; /* 上部に20ピクセルのマージン */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* グリッドラインの追加 */
|
||||||
|
.table-grid {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-grid th, .table-grid td {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-grid th, .half-table-grid th {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ストライプ効果(奇数行と偶数行で色を交互に) */
|
||||||
|
.table-striped tbody tr:nth-child(odd) {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ホバー効果(マウスオーバー時に行の色を変更) */
|
||||||
|
.table-hover tbody tr:hover {
|
||||||
|
background-color: #ccffcc; /* パステルグリーンの背景色 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* レスポンシブデザイン(小さい画面でスクロール) */
|
||||||
|
.table-responsive {
|
||||||
|
overflow-x: auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.menuClass {
|
||||||
|
color: #008080; /* ターコイズ色 */
|
||||||
|
text-decoration: none; /* 下線をなくす */
|
||||||
|
padding: 10px 20px; /* パディングを追加 */
|
||||||
|
border: 1px solid #008080; /* 枠線を追加 */
|
||||||
|
border-radius: 5px; /* 角を丸くする */
|
||||||
|
display: inline-block; /* ブロック要素として表示 */
|
||||||
|
transition: 0.3s; /* アニメーション効果 */
|
||||||
|
}
|
||||||
|
|
||||||
|
a.menuClass:hover {
|
||||||
|
background-color: #008080; /* マウスオーバー時の背景色 */
|
||||||
|
color: #ffffff; /* マウスオーバー時の文字色 */
|
||||||
|
}
|
||||||
|
|
||||||
|
table.menuClass td {
|
||||||
|
padding: 20px; /* パディングを増やす */
|
||||||
|
text-align: center; /* 中央寄せ */
|
||||||
|
vertical-align: middle; /* 上下中央寄せ */
|
||||||
|
}
|
||||||
|
|
||||||
|
table.menuClass td.description {
|
||||||
|
text-align: left; /* 左寄せ */
|
||||||
|
font-size: 14px; /* フォントサイズを少し大きく */
|
||||||
|
color: #707070; /* 色を少し薄く */
|
||||||
|
line-height: 1.5; /* 行間を調整 */
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="submit"], input[type="reset"], button {
|
||||||
|
color: #008080; /* ターコイズ色 */
|
||||||
|
text-decoration: none; /* 下線をなくす */
|
||||||
|
padding: 10px 20px; /* パディングを追加 */
|
||||||
|
border: 1px solid #008080; /* 枠線を追加 */
|
||||||
|
border-radius: 5px; /* 角を丸くする */
|
||||||
|
background-color: transparent; /* 背景色を透明に */
|
||||||
|
cursor: pointer; /* カーソルをポインターに */
|
||||||
|
transition: 0.3s; /* アニメーション効果 */
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="submit"]:hover, input[type="reset"]:hover, button:hover {
|
||||||
|
background-color: #008080; /* マウスオーバー時の背景色 */
|
||||||
|
color: #ffffff; /* マウスオーバー時の文字色 */
|
||||||
|
}
|
||||||
790
src/main/resources/static/css/svg-with-js.css
Normal file
790
src/main/resources/static/css/svg-with-js.css
Normal file
@@ -0,0 +1,790 @@
|
|||||||
|
/*!
|
||||||
|
* Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
|
||||||
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||||
|
* Copyright 2023 Fonticons, Inc.
|
||||||
|
*/
|
||||||
|
:root, :host {
|
||||||
|
--fa-font-solid: normal 900 1em/1 'Font Awesome 6 Solid';
|
||||||
|
--fa-font-regular: normal 400 1em/1 'Font Awesome 6 Regular';
|
||||||
|
--fa-font-light: normal 300 1em/1 'Font Awesome 6 Light';
|
||||||
|
--fa-font-thin: normal 100 1em/1 'Font Awesome 6 Thin';
|
||||||
|
--fa-font-duotone: normal 900 1em/1 'Font Awesome 6 Duotone';
|
||||||
|
--fa-font-sharp-solid: normal 900 1em/1 'Font Awesome 6 Sharp';
|
||||||
|
--fa-font-sharp-regular: normal 400 1em/1 'Font Awesome 6 Sharp';
|
||||||
|
--fa-font-sharp-light: normal 300 1em/1 'Font Awesome 6 Sharp';
|
||||||
|
--fa-font-brands: normal 400 1em/1 'Font Awesome 6 Brands';
|
||||||
|
}
|
||||||
|
|
||||||
|
svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {
|
||||||
|
overflow: visible;
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa {
|
||||||
|
display: var(--fa-display, inline-block);
|
||||||
|
height: 1em;
|
||||||
|
overflow: visible;
|
||||||
|
vertical-align: -.125em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-2xs {
|
||||||
|
vertical-align: 0.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-xs {
|
||||||
|
vertical-align: 0em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-sm {
|
||||||
|
vertical-align: -0.07143em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-lg {
|
||||||
|
vertical-align: -0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-xl {
|
||||||
|
vertical-align: -0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-2xl {
|
||||||
|
vertical-align: -0.3125em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-pull-left {
|
||||||
|
margin-right: var(--fa-pull-margin, 0.3em);
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-pull-right {
|
||||||
|
margin-left: var(--fa-pull-margin, 0.3em);
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-li {
|
||||||
|
width: var(--fa-li-width, 2em);
|
||||||
|
top: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-fw {
|
||||||
|
width: var(--fa-fw-width, 1.25em);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-layers svg.svg-inline--fa {
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
margin: auto;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-layers-text, .fa-layers-counter {
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-layers {
|
||||||
|
display: inline-block;
|
||||||
|
height: 1em;
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: -.125em;
|
||||||
|
width: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-layers svg.svg-inline--fa {
|
||||||
|
-webkit-transform-origin: center center;
|
||||||
|
transform-origin: center center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-layers-text {
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
-webkit-transform: translate(-50%, -50%);
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
-webkit-transform-origin: center center;
|
||||||
|
transform-origin: center center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-layers-counter {
|
||||||
|
background-color: var(--fa-counter-background-color, #ff253a);
|
||||||
|
border-radius: var(--fa-counter-border-radius, 1em);
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: var(--fa-inverse, #fff);
|
||||||
|
line-height: var(--fa-counter-line-height, 1);
|
||||||
|
max-width: var(--fa-counter-max-width, 5em);
|
||||||
|
min-width: var(--fa-counter-min-width, 1.5em);
|
||||||
|
overflow: hidden;
|
||||||
|
padding: var(--fa-counter-padding, 0.25em 0.5em);
|
||||||
|
right: var(--fa-right, 0);
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
top: var(--fa-top, 0);
|
||||||
|
-webkit-transform: scale(var(--fa-counter-scale, 0.25));
|
||||||
|
transform: scale(var(--fa-counter-scale, 0.25));
|
||||||
|
-webkit-transform-origin: top right;
|
||||||
|
transform-origin: top right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-layers-bottom-right {
|
||||||
|
bottom: var(--fa-bottom, 0);
|
||||||
|
right: var(--fa-right, 0);
|
||||||
|
top: auto;
|
||||||
|
-webkit-transform: scale(var(--fa-layers-scale, 0.25));
|
||||||
|
transform: scale(var(--fa-layers-scale, 0.25));
|
||||||
|
-webkit-transform-origin: bottom right;
|
||||||
|
transform-origin: bottom right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-layers-bottom-left {
|
||||||
|
bottom: var(--fa-bottom, 0);
|
||||||
|
left: var(--fa-left, 0);
|
||||||
|
right: auto;
|
||||||
|
top: auto;
|
||||||
|
-webkit-transform: scale(var(--fa-layers-scale, 0.25));
|
||||||
|
transform: scale(var(--fa-layers-scale, 0.25));
|
||||||
|
-webkit-transform-origin: bottom left;
|
||||||
|
transform-origin: bottom left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-layers-top-right {
|
||||||
|
top: var(--fa-top, 0);
|
||||||
|
right: var(--fa-right, 0);
|
||||||
|
-webkit-transform: scale(var(--fa-layers-scale, 0.25));
|
||||||
|
transform: scale(var(--fa-layers-scale, 0.25));
|
||||||
|
-webkit-transform-origin: top right;
|
||||||
|
transform-origin: top right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-layers-top-left {
|
||||||
|
left: var(--fa-left, 0);
|
||||||
|
right: auto;
|
||||||
|
top: var(--fa-top, 0);
|
||||||
|
-webkit-transform: scale(var(--fa-layers-scale, 0.25));
|
||||||
|
transform: scale(var(--fa-layers-scale, 0.25));
|
||||||
|
-webkit-transform-origin: top left;
|
||||||
|
transform-origin: top left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-1x {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-2x {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-3x {
|
||||||
|
font-size: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-4x {
|
||||||
|
font-size: 4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-5x {
|
||||||
|
font-size: 5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-6x {
|
||||||
|
font-size: 6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-7x {
|
||||||
|
font-size: 7em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-8x {
|
||||||
|
font-size: 8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-9x {
|
||||||
|
font-size: 9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-10x {
|
||||||
|
font-size: 10em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-2xs {
|
||||||
|
font-size: 0.625em;
|
||||||
|
line-height: 0.1em;
|
||||||
|
vertical-align: 0.225em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-xs {
|
||||||
|
font-size: 0.75em;
|
||||||
|
line-height: 0.08333em;
|
||||||
|
vertical-align: 0.125em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-sm {
|
||||||
|
font-size: 0.875em;
|
||||||
|
line-height: 0.07143em;
|
||||||
|
vertical-align: 0.05357em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-lg {
|
||||||
|
font-size: 1.25em;
|
||||||
|
line-height: 0.05em;
|
||||||
|
vertical-align: -0.075em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-xl {
|
||||||
|
font-size: 1.5em;
|
||||||
|
line-height: 0.04167em;
|
||||||
|
vertical-align: -0.125em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-2xl {
|
||||||
|
font-size: 2em;
|
||||||
|
line-height: 0.03125em;
|
||||||
|
vertical-align: -0.1875em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-fw {
|
||||||
|
text-align: center;
|
||||||
|
width: 1.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-ul {
|
||||||
|
list-style-type: none;
|
||||||
|
margin-left: var(--fa-li-margin, 2.5em);
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-ul > li {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-li {
|
||||||
|
left: calc(var(--fa-li-width, 2em) * -1);
|
||||||
|
position: absolute;
|
||||||
|
text-align: center;
|
||||||
|
width: var(--fa-li-width, 2em);
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-border {
|
||||||
|
border-color: var(--fa-border-color, #eee);
|
||||||
|
border-radius: var(--fa-border-radius, 0.1em);
|
||||||
|
border-style: var(--fa-border-style, solid);
|
||||||
|
border-width: var(--fa-border-width, 0.08em);
|
||||||
|
padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-pull-left {
|
||||||
|
float: left;
|
||||||
|
margin-right: var(--fa-pull-margin, 0.3em);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-pull-right {
|
||||||
|
float: right;
|
||||||
|
margin-left: var(--fa-pull-margin, 0.3em);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-beat {
|
||||||
|
-webkit-animation-name: fa-beat;
|
||||||
|
animation-name: fa-beat;
|
||||||
|
-webkit-animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
-webkit-animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
-webkit-animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
-webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
-webkit-animation-timing-function: var(--fa-animation-timing, ease-in-out);
|
||||||
|
animation-timing-function: var(--fa-animation-timing, ease-in-out);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-bounce {
|
||||||
|
-webkit-animation-name: fa-bounce;
|
||||||
|
animation-name: fa-bounce;
|
||||||
|
-webkit-animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
-webkit-animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
-webkit-animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
-webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
-webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));
|
||||||
|
animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-fade {
|
||||||
|
-webkit-animation-name: fa-fade;
|
||||||
|
animation-name: fa-fade;
|
||||||
|
-webkit-animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
-webkit-animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
-webkit-animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
-webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
-webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
|
||||||
|
animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-beat-fade {
|
||||||
|
-webkit-animation-name: fa-beat-fade;
|
||||||
|
animation-name: fa-beat-fade;
|
||||||
|
-webkit-animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
-webkit-animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
-webkit-animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
-webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
-webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
|
||||||
|
animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-flip {
|
||||||
|
-webkit-animation-name: fa-flip;
|
||||||
|
animation-name: fa-flip;
|
||||||
|
-webkit-animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
-webkit-animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
-webkit-animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
-webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
-webkit-animation-timing-function: var(--fa-animation-timing, ease-in-out);
|
||||||
|
animation-timing-function: var(--fa-animation-timing, ease-in-out);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-shake {
|
||||||
|
-webkit-animation-name: fa-shake;
|
||||||
|
animation-name: fa-shake;
|
||||||
|
-webkit-animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
-webkit-animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
-webkit-animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
-webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
-webkit-animation-timing-function: var(--fa-animation-timing, linear);
|
||||||
|
animation-timing-function: var(--fa-animation-timing, linear);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-spin {
|
||||||
|
-webkit-animation-name: fa-spin;
|
||||||
|
animation-name: fa-spin;
|
||||||
|
-webkit-animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
animation-delay: var(--fa-animation-delay, 0s);
|
||||||
|
-webkit-animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
-webkit-animation-duration: var(--fa-animation-duration, 2s);
|
||||||
|
animation-duration: var(--fa-animation-duration, 2s);
|
||||||
|
-webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
-webkit-animation-timing-function: var(--fa-animation-timing, linear);
|
||||||
|
animation-timing-function: var(--fa-animation-timing, linear);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-spin-reverse {
|
||||||
|
--fa-animation-direction: reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-pulse,
|
||||||
|
.fa-spin-pulse {
|
||||||
|
-webkit-animation-name: fa-spin;
|
||||||
|
animation-name: fa-spin;
|
||||||
|
-webkit-animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
animation-direction: var(--fa-animation-direction, normal);
|
||||||
|
-webkit-animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
animation-duration: var(--fa-animation-duration, 1s);
|
||||||
|
-webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
animation-iteration-count: var(--fa-animation-iteration-count, infinite);
|
||||||
|
-webkit-animation-timing-function: var(--fa-animation-timing, steps(8));
|
||||||
|
animation-timing-function: var(--fa-animation-timing, steps(8));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.fa-beat,
|
||||||
|
.fa-bounce,
|
||||||
|
.fa-fade,
|
||||||
|
.fa-beat-fade,
|
||||||
|
.fa-flip,
|
||||||
|
.fa-pulse,
|
||||||
|
.fa-shake,
|
||||||
|
.fa-spin,
|
||||||
|
.fa-spin-pulse {
|
||||||
|
-webkit-animation-delay: -1ms;
|
||||||
|
animation-delay: -1ms;
|
||||||
|
-webkit-animation-duration: 1ms;
|
||||||
|
animation-duration: 1ms;
|
||||||
|
-webkit-animation-iteration-count: 1;
|
||||||
|
animation-iteration-count: 1;
|
||||||
|
-webkit-transition-delay: 0s;
|
||||||
|
transition-delay: 0s;
|
||||||
|
-webkit-transition-duration: 0s;
|
||||||
|
transition-duration: 0s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fa-beat {
|
||||||
|
0%, 90% {
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
45% {
|
||||||
|
-webkit-transform: scale(var(--fa-beat-scale, 1.25));
|
||||||
|
transform: scale(var(--fa-beat-scale, 1.25));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fa-beat {
|
||||||
|
0%, 90% {
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
45% {
|
||||||
|
-webkit-transform: scale(var(--fa-beat-scale, 1.25));
|
||||||
|
transform: scale(var(--fa-beat-scale, 1.25));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fa-bounce {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: scale(1, 1) translateY(0);
|
||||||
|
transform: scale(1, 1) translateY(0);
|
||||||
|
}
|
||||||
|
10% {
|
||||||
|
-webkit-transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
|
||||||
|
transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
|
||||||
|
}
|
||||||
|
30% {
|
||||||
|
-webkit-transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
|
||||||
|
transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
-webkit-transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
|
||||||
|
transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
|
||||||
|
}
|
||||||
|
57% {
|
||||||
|
-webkit-transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
|
||||||
|
transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
|
||||||
|
}
|
||||||
|
64% {
|
||||||
|
-webkit-transform: scale(1, 1) translateY(0);
|
||||||
|
transform: scale(1, 1) translateY(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: scale(1, 1) translateY(0);
|
||||||
|
transform: scale(1, 1) translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fa-bounce {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: scale(1, 1) translateY(0);
|
||||||
|
transform: scale(1, 1) translateY(0);
|
||||||
|
}
|
||||||
|
10% {
|
||||||
|
-webkit-transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
|
||||||
|
transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
|
||||||
|
}
|
||||||
|
30% {
|
||||||
|
-webkit-transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
|
||||||
|
transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
-webkit-transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
|
||||||
|
transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
|
||||||
|
}
|
||||||
|
57% {
|
||||||
|
-webkit-transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
|
||||||
|
transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
|
||||||
|
}
|
||||||
|
64% {
|
||||||
|
-webkit-transform: scale(1, 1) translateY(0);
|
||||||
|
transform: scale(1, 1) translateY(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: scale(1, 1) translateY(0);
|
||||||
|
transform: scale(1, 1) translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fa-fade {
|
||||||
|
50% {
|
||||||
|
opacity: var(--fa-fade-opacity, 0.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fa-fade {
|
||||||
|
50% {
|
||||||
|
opacity: var(--fa-fade-opacity, 0.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fa-beat-fade {
|
||||||
|
0%, 100% {
|
||||||
|
opacity: var(--fa-beat-fade-opacity, 0.4);
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 1;
|
||||||
|
-webkit-transform: scale(var(--fa-beat-fade-scale, 1.125));
|
||||||
|
transform: scale(var(--fa-beat-fade-scale, 1.125));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fa-beat-fade {
|
||||||
|
0%, 100% {
|
||||||
|
opacity: var(--fa-beat-fade-opacity, 0.4);
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 1;
|
||||||
|
-webkit-transform: scale(var(--fa-beat-fade-scale, 1.125));
|
||||||
|
transform: scale(var(--fa-beat-fade-scale, 1.125));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fa-flip {
|
||||||
|
50% {
|
||||||
|
-webkit-transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
|
||||||
|
transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fa-flip {
|
||||||
|
50% {
|
||||||
|
-webkit-transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
|
||||||
|
transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fa-shake {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(-15deg);
|
||||||
|
transform: rotate(-15deg);
|
||||||
|
}
|
||||||
|
4% {
|
||||||
|
-webkit-transform: rotate(15deg);
|
||||||
|
transform: rotate(15deg);
|
||||||
|
}
|
||||||
|
8%, 24% {
|
||||||
|
-webkit-transform: rotate(-18deg);
|
||||||
|
transform: rotate(-18deg);
|
||||||
|
}
|
||||||
|
12%, 28% {
|
||||||
|
-webkit-transform: rotate(18deg);
|
||||||
|
transform: rotate(18deg);
|
||||||
|
}
|
||||||
|
16% {
|
||||||
|
-webkit-transform: rotate(-22deg);
|
||||||
|
transform: rotate(-22deg);
|
||||||
|
}
|
||||||
|
20% {
|
||||||
|
-webkit-transform: rotate(22deg);
|
||||||
|
transform: rotate(22deg);
|
||||||
|
}
|
||||||
|
32% {
|
||||||
|
-webkit-transform: rotate(-12deg);
|
||||||
|
transform: rotate(-12deg);
|
||||||
|
}
|
||||||
|
36% {
|
||||||
|
-webkit-transform: rotate(12deg);
|
||||||
|
transform: rotate(12deg);
|
||||||
|
}
|
||||||
|
40%, 100% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fa-shake {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(-15deg);
|
||||||
|
transform: rotate(-15deg);
|
||||||
|
}
|
||||||
|
4% {
|
||||||
|
-webkit-transform: rotate(15deg);
|
||||||
|
transform: rotate(15deg);
|
||||||
|
}
|
||||||
|
8%, 24% {
|
||||||
|
-webkit-transform: rotate(-18deg);
|
||||||
|
transform: rotate(-18deg);
|
||||||
|
}
|
||||||
|
12%, 28% {
|
||||||
|
-webkit-transform: rotate(18deg);
|
||||||
|
transform: rotate(18deg);
|
||||||
|
}
|
||||||
|
16% {
|
||||||
|
-webkit-transform: rotate(-22deg);
|
||||||
|
transform: rotate(-22deg);
|
||||||
|
}
|
||||||
|
20% {
|
||||||
|
-webkit-transform: rotate(22deg);
|
||||||
|
transform: rotate(22deg);
|
||||||
|
}
|
||||||
|
32% {
|
||||||
|
-webkit-transform: rotate(-12deg);
|
||||||
|
transform: rotate(-12deg);
|
||||||
|
}
|
||||||
|
36% {
|
||||||
|
-webkit-transform: rotate(12deg);
|
||||||
|
transform: rotate(12deg);
|
||||||
|
}
|
||||||
|
40%, 100% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fa-spin {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fa-spin {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-rotate-90 {
|
||||||
|
-webkit-transform: rotate(90deg);
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-rotate-180 {
|
||||||
|
-webkit-transform: rotate(180deg);
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-rotate-270 {
|
||||||
|
-webkit-transform: rotate(270deg);
|
||||||
|
transform: rotate(270deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-flip-horizontal {
|
||||||
|
-webkit-transform: scale(-1, 1);
|
||||||
|
transform: scale(-1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-flip-vertical {
|
||||||
|
-webkit-transform: scale(1, -1);
|
||||||
|
transform: scale(1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-flip-both,
|
||||||
|
.fa-flip-horizontal.fa-flip-vertical {
|
||||||
|
-webkit-transform: scale(-1, -1);
|
||||||
|
transform: scale(-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-rotate-by {
|
||||||
|
-webkit-transform: rotate(var(--fa-rotate-angle, none));
|
||||||
|
transform: rotate(var(--fa-rotate-angle, none));
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-stack {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
height: 2em;
|
||||||
|
position: relative;
|
||||||
|
width: 2.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-stack-1x,
|
||||||
|
.fa-stack-2x {
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
margin: auto;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
z-index: var(--fa-stack-z-index, auto);
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-stack-1x {
|
||||||
|
height: 1em;
|
||||||
|
width: 1.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-stack-2x {
|
||||||
|
height: 2em;
|
||||||
|
width: 2.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-inverse {
|
||||||
|
color: var(--fa-inverse, #fff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sr-only,
|
||||||
|
.fa-sr-only {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
white-space: nowrap;
|
||||||
|
border-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sr-only-focusable:not(:focus),
|
||||||
|
.fa-sr-only-focusable:not(:focus) {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
white-space: nowrap;
|
||||||
|
border-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa .fa-primary {
|
||||||
|
fill: var(--fa-primary-color, currentColor);
|
||||||
|
opacity: var(--fa-primary-opacity, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa .fa-secondary {
|
||||||
|
fill: var(--fa-secondary-color, currentColor);
|
||||||
|
opacity: var(--fa-secondary-opacity, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-swap-opacity .fa-primary {
|
||||||
|
opacity: var(--fa-secondary-opacity, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa.fa-swap-opacity .fa-secondary {
|
||||||
|
opacity: var(--fa-primary-opacity, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-inline--fa mask .fa-primary,
|
||||||
|
.svg-inline--fa mask .fa-secondary {
|
||||||
|
fill: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fad.fa-inverse,
|
||||||
|
.fa-duotone.fa-inverse {
|
||||||
|
color: var(--fa-inverse, #fff);
|
||||||
|
}
|
||||||
30
src/main/resources/static/css/v4-font-face.css
Normal file
30
src/main/resources/static/css/v4-font-face.css
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*!
|
||||||
|
* Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
|
||||||
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||||
|
* Copyright 2023 Fonticons, Inc.
|
||||||
|
*/
|
||||||
|
@font-face {
|
||||||
|
font-family: 'FontAwesome';
|
||||||
|
font-display: block;
|
||||||
|
src: url("../webfonts/fa-solid-900.woff2") format("woff2"), url("../webfonts/fa-solid-900.ttf") format("truetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'FontAwesome';
|
||||||
|
font-display: block;
|
||||||
|
src: url("../webfonts/fa-brands-400.woff2") format("woff2"), url("../webfonts/fa-brands-400.ttf") format("truetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'FontAwesome';
|
||||||
|
font-display: block;
|
||||||
|
src: url("../webfonts/fa-regular-400.woff2") format("woff2"), url("../webfonts/fa-regular-400.ttf") format("truetype");
|
||||||
|
unicode-range: U+F003, U+F006, U+F014, U+F016-F017, U+F01A-F01B, U+F01D, U+F022, U+F03E, U+F044, U+F046, U+F05C-F05D, U+F06E, U+F070, U+F087-F088, U+F08A, U+F094, U+F096-F097, U+F09D, U+F0A0, U+F0A2, U+F0A4-F0A7, U+F0C5, U+F0C7, U+F0E5-F0E6, U+F0EB, U+F0F6-F0F8, U+F10C, U+F114-F115, U+F118-F11A, U+F11C-F11D, U+F133, U+F147, U+F14E, U+F150-F152, U+F185-F186, U+F18E, U+F190-F192, U+F196, U+F1C1-F1C9, U+F1D9, U+F1DB, U+F1E3, U+F1EA, U+F1F7, U+F1F9, U+F20A, U+F247-F248, U+F24A, U+F24D, U+F255-F25B, U+F25D, U+F271-F274, U+F278, U+F27B, U+F28C, U+F28E, U+F29C, U+F2B5, U+F2B7, U+F2BA, U+F2BC, U+F2BE, U+F2C0-F2C1, U+F2C3, U+F2D0, U+F2D2, U+F2D4, U+F2DC;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'FontAwesome';
|
||||||
|
font-display: block;
|
||||||
|
src: url("../webfonts/fa-v4compatibility.woff2") format("woff2"), url("../webfonts/fa-v4compatibility.ttf") format("truetype");
|
||||||
|
unicode-range: U+F041, U+F047, U+F065-F066, U+F07D-F07E, U+F080, U+F08B, U+F08E, U+F090, U+F09A, U+F0AC, U+F0AE, U+F0B2, U+F0D0, U+F0D6, U+F0E4, U+F0EC, U+F10A-F10B, U+F123, U+F13E, U+F148-F149, U+F14C, U+F156, U+F15E, U+F160-F161, U+F163, U+F175-F178, U+F195, U+F1F8, U+F219, U+F27A;
|
||||||
|
}
|
||||||
2818
src/main/resources/static/css/v4-shims.css
Normal file
2818
src/main/resources/static/css/v4-shims.css
Normal file
File diff suppressed because it is too large
Load Diff
25
src/main/resources/static/css/v5-font-face.css
Normal file
25
src/main/resources/static/css/v5-font-face.css
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*!
|
||||||
|
* Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
|
||||||
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||||
|
* Copyright 2023 Fonticons, Inc.
|
||||||
|
*/
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Font Awesome 5 Brands';
|
||||||
|
font-display: block;
|
||||||
|
font-weight: 400;
|
||||||
|
src: url("../webfonts/fa-brands-400.woff2") format("woff2"), url("../webfonts/fa-brands-400.ttf") format("truetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Font Awesome 5 Free';
|
||||||
|
font-display: block;
|
||||||
|
font-weight: 900;
|
||||||
|
src: url("../webfonts/fa-solid-900.woff2") format("woff2"), url("../webfonts/fa-solid-900.ttf") format("truetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Font Awesome 5 Free';
|
||||||
|
font-display: block;
|
||||||
|
font-weight: 400;
|
||||||
|
src: url("../webfonts/fa-regular-400.woff2") format("woff2"), url("../webfonts/fa-regular-400.ttf") format("truetype");
|
||||||
|
}
|
||||||
31
src/main/resources/static/js/common.js
Normal file
31
src/main/resources/static/js/common.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
function convertToKatakana(input) {
|
||||||
|
// 漢字とローマ字を削除
|
||||||
|
const valueWithoutKanjiAndRomaji = input.value.replace(/[\u4E00-\u9FFF\u0041-\u009F]/g, '');
|
||||||
|
|
||||||
|
// ひらがなをカタカナに変換
|
||||||
|
const katakanaValue = valueWithoutKanjiAndRomaji.replace(/[\u3041-\u3096]/g, function (match) {
|
||||||
|
const chr = match.charCodeAt(0) + 0x60;
|
||||||
|
return String.fromCharCode(chr);
|
||||||
|
});
|
||||||
|
|
||||||
|
input.value = katakanaValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
function logoutSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'logout');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "logout");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
BIN
src/main/resources/static/webfonts/fa-brands-400.ttf
Normal file
BIN
src/main/resources/static/webfonts/fa-brands-400.ttf
Normal file
Binary file not shown.
BIN
src/main/resources/static/webfonts/fa-brands-400.woff2
Normal file
BIN
src/main/resources/static/webfonts/fa-brands-400.woff2
Normal file
Binary file not shown.
BIN
src/main/resources/static/webfonts/fa-regular-400.ttf
Normal file
BIN
src/main/resources/static/webfonts/fa-regular-400.ttf
Normal file
Binary file not shown.
BIN
src/main/resources/static/webfonts/fa-regular-400.woff2
Normal file
BIN
src/main/resources/static/webfonts/fa-regular-400.woff2
Normal file
Binary file not shown.
BIN
src/main/resources/static/webfonts/fa-solid-900.ttf
Normal file
BIN
src/main/resources/static/webfonts/fa-solid-900.ttf
Normal file
Binary file not shown.
BIN
src/main/resources/static/webfonts/fa-solid-900.woff2
Normal file
BIN
src/main/resources/static/webfonts/fa-solid-900.woff2
Normal file
Binary file not shown.
BIN
src/main/resources/static/webfonts/fa-v4compatibility.ttf
Normal file
BIN
src/main/resources/static/webfonts/fa-v4compatibility.ttf
Normal file
Binary file not shown.
BIN
src/main/resources/static/webfonts/fa-v4compatibility.woff2
Normal file
BIN
src/main/resources/static/webfonts/fa-v4compatibility.woff2
Normal file
Binary file not shown.
20
src/main/resources/templates/error.html
Normal file
20
src/main/resources/templates/error.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>エラー</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>エラーが発生しました。</h1>
|
||||||
|
|
||||||
|
<div>ログインからやり直してください。</div>
|
||||||
|
<a href="login">ログイン</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
157
src/main/resources/templates/insertEmployeeConfirm.html
Normal file
157
src/main/resources/templates/insertEmployeeConfirm.html
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>登録内容確認</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>登録内容確認
|
||||||
|
<div class="rightSection">
|
||||||
|
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||||
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<form action="insertEmployee"
|
||||||
|
id="insertForm"
|
||||||
|
method="post"
|
||||||
|
th:object="${insertEmployeeForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError != null}">
|
||||||
|
<span class="error" th:each="message : ${messageError.message}" th:text="${message}"></span>
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="empId"
|
||||||
|
readonly="readonly"
|
||||||
|
type="text"
|
||||||
|
value="自動で設定されます"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="nmEmployee"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{nmEmployee}"
|
||||||
|
type="text"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名フリガナ</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="knEmployee"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{knEmployee}"
|
||||||
|
type="text"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="mailAddress"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{mailAddress}"
|
||||||
|
type="text"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
name="password"
|
||||||
|
readonly="readonly"
|
||||||
|
th:value="*{password}"
|
||||||
|
type="password"/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">管理者権限</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth1" name="adminAuth" onclick="return false;"
|
||||||
|
th:checked="${insertEmployeeForm .adminAuth == 1}" type="radio"
|
||||||
|
value="1"> 管理者権限
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth0" name="adminAuth" onclick="return false;"
|
||||||
|
th:checked="${insertEmployeeForm.adminAuth == null or insertEmployeeForm.adminAuth == 0}"
|
||||||
|
type="radio"
|
||||||
|
value="0">
|
||||||
|
一般権限
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">所属部署</th>
|
||||||
|
<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">
|
||||||
|
function onClickEdit() {
|
||||||
|
const form = document.getElementById('insertForm');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'insertEmployeeInput');
|
||||||
|
|
||||||
|
// 確認画面から編集画面に戻ってきたときのフラグ(未使用)
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("name", "backFlg");
|
||||||
|
inputField.setAttribute("value", "edit");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
158
src/main/resources/templates/insertEmployeeInput.html
Normal file
158
src/main/resources/templates/insertEmployeeInput.html
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>社員登録</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
社員登録
|
||||||
|
<div class="rightSection">
|
||||||
|
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||||
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
<form action="insertEmployeeConfirm"
|
||||||
|
method="post"
|
||||||
|
th:object="${insertEmployeeForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
readonly="readonly"
|
||||||
|
type="text"
|
||||||
|
value="自動で設定されます"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50"
|
||||||
|
placeholder="社員名"
|
||||||
|
required="required"
|
||||||
|
th:field="*{nmEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名フリガナ</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50"
|
||||||
|
oninput="convertToKatakana(this)"
|
||||||
|
placeholder="フリガナ"
|
||||||
|
required="required"
|
||||||
|
th:field="*{knEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="100"
|
||||||
|
placeholder="メールアドレス"
|
||||||
|
required="required"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
type="email"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</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="*{password}"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- *** Chrome等のブラウザの場合自動でセットされる可能性があるので注意書きを外にも *** -->
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td><span
|
||||||
|
style="font-size:8pt; font-weight:bold; color:red;">※半角英数字をそれぞれ1種類以上含む3-10文字</span>
|
||||||
|
</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 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>
|
||||||
|
<th class="header">所属部署</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<select required="required" th:field="*{idDepartment}">
|
||||||
|
<option th:each="department : ${departmentFormList}"
|
||||||
|
th:selected="${insertEmployeeForm.idDepartment != null && department.idDepartment == insertEmployeeForm.idDepartment}"
|
||||||
|
th:text="${department.nmDepartment}"
|
||||||
|
th:value="${department.idDepartment}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="登録確認"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<a href="showMenu">メニューに戻る</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
40
src/main/resources/templates/insertEmployeeResult.html
Normal file
40
src/main/resources/templates/insertEmployeeResult.html
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>社員登録完了</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>社員登録が完了しました</h2>
|
||||||
|
<br/>
|
||||||
|
<a href="javascript:insertSubmit()">続けて登録する</a> | <a href="showMenu">メニューに戻る</a>
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function insertSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'insertEmployeeInput');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "select");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
63
src/main/resources/templates/login.html
Normal file
63
src/main/resources/templates/login.html
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>ログイン</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>ログイン</h1>
|
||||||
|
<form action="doLogin"
|
||||||
|
method="post"
|
||||||
|
th:object="${loginInfoForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td style="width: 250px;">
|
||||||
|
<input placeholder="メールアドレス"
|
||||||
|
required="required"
|
||||||
|
style="width: 100%;"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
type="text"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th style="text-align: right;">パスワード</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="パスワード"
|
||||||
|
required="required"
|
||||||
|
style="width: 100%;"
|
||||||
|
th:field="*{password}"
|
||||||
|
type="password"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="ログイン"/>
|
||||||
|
<button onclick="clearInput()">リセット</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function clearInput() {
|
||||||
|
document.getElementById('mailAddress').value = '';
|
||||||
|
document.getElementById('password').value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
117
src/main/resources/templates/menu.html
Normal file
117
src/main/resources/templates/menu.html
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>メニュー</title>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
メインメニュー
|
||||||
|
<div class="rightSection">
|
||||||
|
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||||
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
<table class="menuClass">
|
||||||
|
<tr>
|
||||||
|
<td><a class="menuClass" href="javascript:selectEmployeeSubmit()"><i class="fas fa-search"></i> 社員検索 </a>
|
||||||
|
</td>
|
||||||
|
<td class="description">登録済みのユーザ一覧表示と</br>更新、削除を行います。</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><a class="menuClass" href="javascript:insertEmployeeSubmit()"><i class="fas fa-plus"></i> 社員登録 </a></td>
|
||||||
|
<td class="description">新規でユーザ追加を行います。</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function selectEmployeeSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'selectEmployeeInfo');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "selectEmployeeInfo");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectDepartmentSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'selectDepartment');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "selectDepartment");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertEmployeeSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'insertEmployeeInput');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "insertEmployeeInput");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertDepartmentSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'insertDepartmentInput');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "insertDepartmentInput");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
||||||
157
src/main/resources/templates/selectEmployee.html
Normal file
157
src/main/resources/templates/selectEmployee.html
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>検索</title>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
検索条件入力
|
||||||
|
<div class="rightSection">
|
||||||
|
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||||
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
<form action="selectEmployeeInfo"
|
||||||
|
method="post"
|
||||||
|
th:object="${searchConditionEmployeeForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員ID</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="社員ID"
|
||||||
|
th:field="*{idEmployee}"
|
||||||
|
type="number"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="社員名"
|
||||||
|
th:field="*{nmEmployee}"
|
||||||
|
type="text"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名フリガナ</th>
|
||||||
|
<td>
|
||||||
|
<input oninput="convertToKatakana(this)"
|
||||||
|
placeholder="フリガナ"
|
||||||
|
th:field="*{knEmployee}"
|
||||||
|
type="text"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="メールアドレス"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
type="email"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">所属部署</th>
|
||||||
|
<td>
|
||||||
|
<select th:field="*{idDepartment}">
|
||||||
|
<option value=""></option>
|
||||||
|
<option th:each="department : ${departmentFormList}"
|
||||||
|
th:selected="${searchConditionEmployeeForm.idDepartment != null && department.idDepartment == searchConditionEmployeeForm.idDepartment}"
|
||||||
|
th:text="${department.nmDepartment}"
|
||||||
|
th:value="${department.idDepartment}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="検索"/>
|
||||||
|
</td>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<button onclick="clearInput()">クリア</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<div class="header-spacing"></div>
|
||||||
|
<a href="showMenu">メニューに戻る</a>
|
||||||
|
<div class="header-spacing"></div>
|
||||||
|
<h1><span>検索結果</span></h1>
|
||||||
|
<div class="header-spacing"></div>
|
||||||
|
<th:block th:if="${messageInfo != null}">
|
||||||
|
<script th:inline="javascript">
|
||||||
|
alert([[${messageInfo.message}]]);
|
||||||
|
</script>
|
||||||
|
</th:block>
|
||||||
|
<div class="header-spacing"></div>
|
||||||
|
<th:block th:if="${employeeInfoFormList != null and employeeInfoFormList.size() > 0}">
|
||||||
|
<!-- 検索結果が1件以上ある場合 -->
|
||||||
|
<table class="table-grid table-striped table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 60px;">社員ID</th>
|
||||||
|
<th style="width: 100px;">社員名</th>
|
||||||
|
<th style="width: 150px;">フリガナ</th>
|
||||||
|
<th style="width: 150px;">メールアドレス</th>
|
||||||
|
<th style="width: 100px;">パスワード</th>
|
||||||
|
<th style="width: 70px;">管理者フラグ</th>
|
||||||
|
<th style="width: 150px;">所属部署</th>
|
||||||
|
<th style="width: 150px;">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="employeeInfoForm : ${employeeInfoFormList}">
|
||||||
|
<td th:text="${employeeInfoForm.idEmployee}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.nmEmployee}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.knEmployee}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.mailAddress}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.password}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.adminAuth}"></td>
|
||||||
|
<td th:text="${employeeInfoForm.nmDepartment}"></td>
|
||||||
|
<td>
|
||||||
|
<!-- 更新フォーム -->
|
||||||
|
<form action="showUpdateEmployee" method="post" style="display: inline;">
|
||||||
|
<input name="idEmployee" th:value="${employeeInfoForm.idEmployee}" type="hidden">
|
||||||
|
<input type="submit" value="更新">
|
||||||
|
</form>
|
||||||
|
<!-- 削除フォーム -->
|
||||||
|
<form action="deleteEmployee" method="post" onsubmit="return confirm('本当に削除しますか?');"
|
||||||
|
style="display: inline;">
|
||||||
|
<input name="idEmployee" th:value="${employeeInfoForm.idEmployee}" type="hidden">
|
||||||
|
<input type="submit" value="削除">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</th:block>
|
||||||
|
<th:block th:if="${employeeInfoFormList == null or employeeInfoFormList.size() == 0}">
|
||||||
|
<!-- 検索結果が0件の場合 -->
|
||||||
|
検索結果はありません。
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function clearInput() {
|
||||||
|
document.getElementById('idEmployee').value = '';
|
||||||
|
document.getElementById('nmEmployee').value = '';
|
||||||
|
document.getElementById('knEmployee').value = '';
|
||||||
|
document.getElementById('mailAddress').value = '';
|
||||||
|
document.getElementById('idDepartment').selectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
181
src/main/resources/templates/updateEmployeeInput.html
Normal file
181
src/main/resources/templates/updateEmployeeInput.html
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>社員情報更新</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
社員情報更新
|
||||||
|
<div class="rightSection">
|
||||||
|
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||||
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
<form action="/updateEmployeeResult"
|
||||||
|
method="post"
|
||||||
|
onsubmit="return confirm('本当によろしいですか?');"
|
||||||
|
th:object="${updateEmployeeInfoForm}"
|
||||||
|
>
|
||||||
|
<div class="msgBox error" th:if="${messageError != null}">
|
||||||
|
<span class="error" th:each="message : ${messageError.message}" th:text="${message}"></span>
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員ID</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="readOnly"
|
||||||
|
readonly="readonly"
|
||||||
|
th:field="*{idEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50"
|
||||||
|
placeholder="社員名"
|
||||||
|
required="required"
|
||||||
|
th:field="*{nmEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名フリガナ</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="50"
|
||||||
|
oninput="convertToKatakana(this)"
|
||||||
|
placeholder="フリガナ"
|
||||||
|
required="required"
|
||||||
|
th:field="*{knEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input maxlength="100"
|
||||||
|
placeholder="メールアドレス"
|
||||||
|
required="required"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
type="email"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="パスワード"
|
||||||
|
th:field="*{password}"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- *** Chrome等のブラウザの場合自動でセットされる可能性があるので注意書きを外にも *** -->
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td>
|
||||||
|
<span style="font-size:8pt;
|
||||||
|
font-weight:bold;
|
||||||
|
color:red;">
|
||||||
|
※半角英数字をそれぞれ1種類以上含む3-10文字
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード確認用</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="パスワード確認用"
|
||||||
|
th:field="*{passwordConfirm}"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">管理者権限</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth1" name="adminAuth" th:checked="${updateEmployeeInfoForm.adminAuth == 1}"
|
||||||
|
type="radio"
|
||||||
|
value="1"> 管理者権限
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input id="adminAuth0" name="adminAuth"
|
||||||
|
th:checked="${updateEmployeeInfoForm.adminAuth == null or updateEmployeeInfoForm.adminAuth == 0}"
|
||||||
|
type="radio"
|
||||||
|
value="0">
|
||||||
|
一般権限
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">所属部署</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<select required="required" th:field="*{idDepartment}">
|
||||||
|
<option th:each="department : ${departmentFormList}"
|
||||||
|
th:selected="${updateEmployeeInfoForm.idDepartment != null && department.idDepartment == updateEmployeeInfoForm.idDepartment}"
|
||||||
|
th:text="${department.nmDepartment}"
|
||||||
|
th:value="${department.idDepartment}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="更新"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<a href="javascript:selectSubmit()">一覧に戻る</a>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function selectSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'selectAll');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "selectAll");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
108
src/main/resources/templates/updatePersonalEmployeeInput.html
Normal file
108
src/main/resources/templates/updatePersonalEmployeeInput.html
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>社員情報更新</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
社員情報更新
|
||||||
|
<div class="rightSection">
|
||||||
|
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||||
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
<form action="updatePersonalEmployeeResult"
|
||||||
|
method="post"
|
||||||
|
th:object="${updatePersonalEmployeeUserForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError != null}">
|
||||||
|
<span class="error" th:each="message : ${messageError.message}" th:text="${message}"></span>
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名</th>
|
||||||
|
<td>
|
||||||
|
<input maxlength="50"
|
||||||
|
placeholder="社員名"
|
||||||
|
required
|
||||||
|
th:name="nmEmployee"
|
||||||
|
th:value="*{nmEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">社員名フリガナ</th>
|
||||||
|
<td>
|
||||||
|
<input maxlength="50"
|
||||||
|
name="knEmployee"
|
||||||
|
oninput="convertToKatakana(this)"
|
||||||
|
placeholder="フリガナ"
|
||||||
|
required
|
||||||
|
th:value="*{knEmployee}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">メールアドレス</th>
|
||||||
|
<td>
|
||||||
|
<input maxlength="100"
|
||||||
|
name="mailAddress"
|
||||||
|
placeholder="メールアドレス"
|
||||||
|
required
|
||||||
|
th:value="*{mailAddress}"
|
||||||
|
type="email"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード</th>
|
||||||
|
<td>
|
||||||
|
<input name="password"
|
||||||
|
pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="※更新する場合は入力"
|
||||||
|
th:field="*{password}"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- *** Chrome等のブラウザの場合自動でセットされる可能性があるので注意書きを外にも *** -->
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td>
|
||||||
|
<span style="font-size:8pt; font-weight:bold; color:red;">更新する場合は入力してください<br>
|
||||||
|
※半角英数字をそれぞれ1種類以上含む3-10文字</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">パスワード確認</th>
|
||||||
|
<td>
|
||||||
|
<input name="passwordConfirm"
|
||||||
|
pattern="^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{3,10}$"
|
||||||
|
placeholder="※更新する場合は再入力"
|
||||||
|
th:field="*{passwordConfirm}"
|
||||||
|
type="password"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input name="submit" type="submit" value="更新"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<input name="idEmployee"
|
||||||
|
th:value="*{idEmployee}"
|
||||||
|
type="hidden"/>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>更新完了</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>更新が完了しました</h2>
|
||||||
|
<br/>
|
||||||
|
<a href="javascript:backSubmit()">戻る</a>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function backSubmit() {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.setAttribute('method', 'post');
|
||||||
|
form.setAttribute('action', 'updatePersonalEmployeeResult');
|
||||||
|
|
||||||
|
// 動的送信用のHidden
|
||||||
|
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||||
|
const inputField = document.createElement("input");
|
||||||
|
inputField.setAttribute("type", "hidden");
|
||||||
|
inputField.setAttribute("value", "updatePersonalEmployeeResult");
|
||||||
|
|
||||||
|
form.appendChild(inputField);
|
||||||
|
|
||||||
|
// フォームをDOMに追加
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.record.DepartmentEnum;
|
||||||
|
import org.junit.jupiter.api.Nested;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
class DepartmentTest {
|
||||||
|
|
||||||
|
// テストデータの用意
|
||||||
|
final static Department departmentTest = new Department(
|
||||||
|
DepartmentEnum.TEST_DEPARTMENT.getIdDepartment(),
|
||||||
|
DepartmentEnum.TEST_DEPARTMENT.getNmDepartment()
|
||||||
|
);
|
||||||
|
|
||||||
|
// テストデータの用意
|
||||||
|
final static Department departmentNull = new Department(
|
||||||
|
DepartmentEnum.NULL_DEPARTMENT.getIdDepartment(),
|
||||||
|
DepartmentEnum.NULL_DEPARTMENT.getNmDepartment()
|
||||||
|
);
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
static class GetIdDepartmentTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getIdDepartment_正常系_IdDepartmentの取得() {
|
||||||
|
// 期待値
|
||||||
|
Integer expected = DepartmentEnum.TEST_DEPARTMENT.getIdDepartment();
|
||||||
|
// 実測値
|
||||||
|
Integer actual = departmentTest.getIdDepartment();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getIdDepartment_正常系_IdDepartmentの取得結果がnull() {
|
||||||
|
|
||||||
|
Integer expected = DepartmentEnum.NULL_DEPARTMENT.getIdDepartment();
|
||||||
|
Integer actual = departmentNull.getIdDepartment();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
static class GetNmDepartmentTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getNmDepartment_正常系_NmDepartmentの取得() {
|
||||||
|
|
||||||
|
String expected = DepartmentEnum.TEST_DEPARTMENT.getNmDepartment();
|
||||||
|
String actual = departmentTest.getNmDepartment();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getNmDepartment_正常系_NmDepartmentの取得結果がnull() {
|
||||||
|
|
||||||
|
String expected = DepartmentEnum.NULL_DEPARTMENT.getNmDepartment();
|
||||||
|
String actual = departmentNull.getNmDepartment();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
package com.example.rhizome.app.domain.model;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.infra.record.DepartmentEnum;
|
||||||
|
import com.example.rhizome.app.infra.record.EmployeeEnum;
|
||||||
|
import org.junit.jupiter.api.Nested;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
class EmployeeInfoTest {
|
||||||
|
|
||||||
|
static EmployeeInfo testEmployeeInfo = new EmployeeInfo(
|
||||||
|
EmployeeEnum.ADMIN_EMPLOYEE.getEmployeeInstance(),
|
||||||
|
DepartmentEnum.TEST_DEPARTMENT.getDepartmentInstance()
|
||||||
|
);
|
||||||
|
|
||||||
|
static EmployeeInfo nullEmployeeInfo = new EmployeeInfo(
|
||||||
|
EmployeeEnum.NULL_EMPLOYEE.getEmployeeInstance(),
|
||||||
|
DepartmentEnum.NULL_DEPARTMENT.getDepartmentInstance()
|
||||||
|
);
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
static class getIdEmployeeTest {
|
||||||
|
@Test
|
||||||
|
void getIdEmployee_正常系_IdEmployeeの取得() {
|
||||||
|
Integer expected = EmployeeEnum.ADMIN_EMPLOYEE.getIdEmployee();
|
||||||
|
Integer actual = testEmployeeInfo.getEmployee().getIdEmployee();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getIdEmployee_正常系_IdEmployeeの取得結果がnull() {
|
||||||
|
Integer expected = EmployeeEnum.NULL_EMPLOYEE.getIdEmployee();
|
||||||
|
Integer actual = nullEmployeeInfo.getEmployee().getIdEmployee();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
static class getNmEmployeeTest {
|
||||||
|
@Test
|
||||||
|
void getNmEmployee_正常系_NmEmployeeの取得() {
|
||||||
|
String expected = EmployeeEnum.ADMIN_EMPLOYEE.getNmEmployee();
|
||||||
|
String actual = testEmployeeInfo.getEmployee().getNmEmployee();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getNmEmployee_正常系_NmEmployeeの取得結果がnull() {
|
||||||
|
String expected = EmployeeEnum.NULL_EMPLOYEE.getNmEmployee();
|
||||||
|
String actual = nullEmployeeInfo.getEmployee().getNmEmployee();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
static class GetKnEmployeeTest {
|
||||||
|
@Test
|
||||||
|
void getKnEmployee_正常系_KnEmployeeの取得() {
|
||||||
|
String expected = EmployeeEnum.ADMIN_EMPLOYEE.getKnEmployee();
|
||||||
|
String actual = testEmployeeInfo.getEmployee().getKnEmployee();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getKnEmployee_正常系_KnEmployeeの取得結果がnull() {
|
||||||
|
String expected = EmployeeEnum.NULL_EMPLOYEE.getKnEmployee();
|
||||||
|
String actual = nullEmployeeInfo.getEmployee().getKnEmployee();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
static class GetMailAddressTest {
|
||||||
|
@Test
|
||||||
|
void getMailAddress_正常系_MailAddressの取得() {
|
||||||
|
String expected = EmployeeEnum.ADMIN_EMPLOYEE.getMailAddress();
|
||||||
|
String actual = testEmployeeInfo.getEmployee().getMailAddress();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getMailAddress_正常系_MailAddressの取得結果がnull() {
|
||||||
|
String expected = EmployeeEnum.NULL_EMPLOYEE.getMailAddress();
|
||||||
|
String actual = nullEmployeeInfo.getEmployee().getMailAddress();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
static class GetPasswordTest {
|
||||||
|
@Test
|
||||||
|
void getPassword_正常系_Passwordの取得() {
|
||||||
|
String expected = EmployeeEnum.ADMIN_EMPLOYEE.getPassword();
|
||||||
|
String actual = testEmployeeInfo.getEmployee().getPassword();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getPassword_正常系_Passwordの取得結果がnull() {
|
||||||
|
String expected = EmployeeEnum.NULL_EMPLOYEE.getPassword();
|
||||||
|
String actual = nullEmployeeInfo.getEmployee().getPassword();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
static class GetAdminAuthTest {
|
||||||
|
@Test
|
||||||
|
void getAdminAuth_正常系_AdminAuthの取得() {
|
||||||
|
Integer expected = EmployeeEnum.ADMIN_EMPLOYEE.getAdminAuth();
|
||||||
|
Integer actual = testEmployeeInfo.getEmployee().getAdminAuth();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getAdminAuth_正常系_AdminAuthの取得結果がnull() {
|
||||||
|
Integer expected = EmployeeEnum.NULL_EMPLOYEE.getAdminAuth();
|
||||||
|
Integer actual = nullEmployeeInfo.getEmployee().getAdminAuth();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
static class GetIdDepartmentTest {
|
||||||
|
@Test
|
||||||
|
void getIdDepartment_正常系_IdDepartmentの取得() {
|
||||||
|
Integer expected = DepartmentEnum.TEST_DEPARTMENT.getIdDepartment();
|
||||||
|
Integer actual = testEmployeeInfo.getDepartment().getIdDepartment();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getIdDepartment_正常系_IdDepartmentの取得結果がnull() {
|
||||||
|
Integer expected = DepartmentEnum.NULL_DEPARTMENT.getIdDepartment();
|
||||||
|
Integer actual = nullEmployeeInfo.getDepartment().getIdDepartment();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
static class GetNmDepartmentTest {
|
||||||
|
@Test
|
||||||
|
void getNmDepartment_正常系_NmDepartmentの取得() {
|
||||||
|
String expected = DepartmentEnum.TEST_DEPARTMENT.getNmDepartment();
|
||||||
|
String actual = testEmployeeInfo.getDepartment().getNmDepartment();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getNmDepartment_正常系_NmDepartmentの取得結果がnull() {
|
||||||
|
String expected = DepartmentEnum.NULL_DEPARTMENT.getNmDepartment();
|
||||||
|
String actual = nullEmployeeInfo.getDepartment().getNmDepartment();
|
||||||
|
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user