From be875090b5ac20c374bef782eccbdaa1d8bdeaba Mon Sep 17 00:00:00 2001 From: s-sakiyama <26-m-s-stella-tecnica@it-college.jp> Date: Wed, 28 Oct 2026 10:30:11 +0900 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=93=81=20test=E3=83=97?= =?UTF-8?q?=E3=83=AD=E3=82=B8=E3=82=A7=E3=82=AF=E3=83=88=E3=81=AE=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/.gitattributes | 2 + test/.gitignore | 33 ++ test/.mvn/wrapper/maven-wrapper.properties | 3 + test/mvnw | 295 ++++++++++++++++++ test/mvnw.cmd | 189 +++++++++++ test/pom.xml | 130 ++++++++ .../com/example/demo/ServletInitializer.java | 13 + .../com/example/demo/TestApplication.java | 13 + .../controller/ApplicationListController.java | 49 +++ .../controller/ApprovalConfirmController.java | 54 ++++ .../ApprovalConfirmResultController.java | 72 +++++ .../demo/controller/LendingController.java | 141 +++++++++ .../controller/LendingListController.java | 71 +++++ .../demo/controller/LoginController.java | 76 +++++ .../demo/controller/LogoutController.java | 24 ++ .../demo/controller/MenuController.java | 27 ++ .../controller/ReturnCompleteController.java | 51 +++ .../controller/ReturnConfirmController.java | 47 +++ .../demo/controller/SelectBookController.java | 141 +++++++++ .../demo/entity/Book_collectionEntity.java | 121 +++++++ .../demo/entity/Borrow_booksEntity.java | 101 ++++++ .../example/demo/entity/EmployeeEntity.java | 141 +++++++++ .../com/example/demo/form/LendingForm.java | 60 ++++ .../com/example/demo/form/LoginInfoForm.java | 22 ++ .../com/example/demo/form/LoginUserForm.java | 94 ++++++ .../com/example/demo/form/MessageForm.java | 15 + .../com/example/demo/form/ReturnForm.java | 36 +++ .../demo/form/SearchConditionBookForm.java | 18 ++ .../example/demo/model/LeadingListModel.java | 18 ++ .../repository/Book_CollectionRepository.java | 49 +++ .../repository/Borrow_BooksRepository.java | 13 + .../demo/repository/EmployeeRepository.java | 15 + .../example/demo/service/ReturnService.java | 201 ++++++++++++ .../src/main/resources/application.properties | 4 + .../main/resources/templates/admin_menu.html | 47 +++ .../main/resources/templates/application.html | 76 +++++ .../templates/applicationComplete.html | 46 +++ .../templates/applicationConfirm.html | 80 +++++ .../resources/templates/applicationList.html | 57 ++++ .../resources/templates/approvalComplete.html | 20 ++ .../resources/templates/approvalConfirm.html | 141 +++++++++ .../resources/templates/approvalRejected.html | 19 ++ .../main/resources/templates/bookList.html | 114 +++++++ .../main/resources/templates/lendingList.html | 56 ++++ test/src/main/resources/templates/login.html | 67 ++++ test/src/main/resources/templates/menu.html | 32 ++ .../resources/templates/returnComplete.html | 26 ++ .../resources/templates/returnConfirm.html | 140 +++++++++ .../example/demo/TestApplicationTests.java | 13 + 49 files changed, 3273 insertions(+) create mode 100644 test/.gitattributes create mode 100644 test/.gitignore create mode 100644 test/.mvn/wrapper/maven-wrapper.properties create mode 100644 test/mvnw create mode 100644 test/mvnw.cmd create mode 100644 test/pom.xml create mode 100644 test/src/main/java/com/example/demo/ServletInitializer.java create mode 100644 test/src/main/java/com/example/demo/TestApplication.java create mode 100644 test/src/main/java/com/example/demo/controller/ApplicationListController.java create mode 100644 test/src/main/java/com/example/demo/controller/ApprovalConfirmController.java create mode 100644 test/src/main/java/com/example/demo/controller/ApprovalConfirmResultController.java create mode 100644 test/src/main/java/com/example/demo/controller/LendingController.java create mode 100644 test/src/main/java/com/example/demo/controller/LendingListController.java create mode 100644 test/src/main/java/com/example/demo/controller/LoginController.java create mode 100644 test/src/main/java/com/example/demo/controller/LogoutController.java create mode 100644 test/src/main/java/com/example/demo/controller/MenuController.java create mode 100644 test/src/main/java/com/example/demo/controller/ReturnCompleteController.java create mode 100644 test/src/main/java/com/example/demo/controller/ReturnConfirmController.java create mode 100644 test/src/main/java/com/example/demo/controller/SelectBookController.java create mode 100644 test/src/main/java/com/example/demo/entity/Book_collectionEntity.java create mode 100644 test/src/main/java/com/example/demo/entity/Borrow_booksEntity.java create mode 100644 test/src/main/java/com/example/demo/entity/EmployeeEntity.java create mode 100644 test/src/main/java/com/example/demo/form/LendingForm.java create mode 100644 test/src/main/java/com/example/demo/form/LoginInfoForm.java create mode 100644 test/src/main/java/com/example/demo/form/LoginUserForm.java create mode 100644 test/src/main/java/com/example/demo/form/MessageForm.java create mode 100644 test/src/main/java/com/example/demo/form/ReturnForm.java create mode 100644 test/src/main/java/com/example/demo/form/SearchConditionBookForm.java create mode 100644 test/src/main/java/com/example/demo/model/LeadingListModel.java create mode 100644 test/src/main/java/com/example/demo/repository/Book_CollectionRepository.java create mode 100644 test/src/main/java/com/example/demo/repository/Borrow_BooksRepository.java create mode 100644 test/src/main/java/com/example/demo/repository/EmployeeRepository.java create mode 100644 test/src/main/java/com/example/demo/service/ReturnService.java create mode 100644 test/src/main/resources/application.properties create mode 100644 test/src/main/resources/templates/admin_menu.html create mode 100644 test/src/main/resources/templates/application.html create mode 100644 test/src/main/resources/templates/applicationComplete.html create mode 100644 test/src/main/resources/templates/applicationConfirm.html create mode 100644 test/src/main/resources/templates/applicationList.html create mode 100644 test/src/main/resources/templates/approvalComplete.html create mode 100644 test/src/main/resources/templates/approvalConfirm.html create mode 100644 test/src/main/resources/templates/approvalRejected.html create mode 100644 test/src/main/resources/templates/bookList.html create mode 100644 test/src/main/resources/templates/lendingList.html create mode 100644 test/src/main/resources/templates/login.html create mode 100644 test/src/main/resources/templates/menu.html create mode 100644 test/src/main/resources/templates/returnComplete.html create mode 100644 test/src/main/resources/templates/returnConfirm.html create mode 100644 test/src/test/java/com/example/demo/TestApplicationTests.java diff --git a/test/.gitattributes b/test/.gitattributes new file mode 100644 index 0000000..3b41682 --- /dev/null +++ b/test/.gitattributes @@ -0,0 +1,2 @@ +/mvnw text eol=lf +*.cmd text eol=crlf diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..667aaef --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/test/.mvn/wrapper/maven-wrapper.properties b/test/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..bb58b3c --- /dev/null +++ b/test/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.10.0/apache-maven-3.10.0-bin.zip diff --git a/test/mvnw b/test/mvnw new file mode 100644 index 0000000..bd8896b --- /dev/null +++ b/test/mvnw @@ -0,0 +1,295 @@ +#!/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 +# +# http://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + 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" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/test/mvnw.cmd b/test/mvnw.cmd new file mode 100644 index 0000000..92450f9 --- /dev/null +++ b/test/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@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 http://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 Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/test/pom.xml b/test/pom.xml new file mode 100644 index 0000000..dfb2741 --- /dev/null +++ b/test/pom.xml @@ -0,0 +1,130 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 4.1.1 + + + com.example + test + 0.0.1-SNAPSHOT + war + test + + + + + + + + + + + + + + + + 21 + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-webmvc + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + com.mysql + mysql-connector-j + runtime + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + org.springframework.boot + spring-boot-starter-data-jpa-test + test + + + org.springframework.boot + spring-boot-starter-thymeleaf-test + test + + + org.springframework.boot + spring-boot-starter-webmvc-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + default-compile + compile + + compile + + + + + org.projectlombok + lombok + + + + + + default-testCompile + test-compile + + testCompile + + + + + org.projectlombok + lombok + + + + + + + + + + diff --git a/test/src/main/java/com/example/demo/ServletInitializer.java b/test/src/main/java/com/example/demo/ServletInitializer.java new file mode 100644 index 0000000..fd14e23 --- /dev/null +++ b/test/src/main/java/com/example/demo/ServletInitializer.java @@ -0,0 +1,13 @@ +package com.example.demo; + +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(TestApplication.class); + } + +} diff --git a/test/src/main/java/com/example/demo/TestApplication.java b/test/src/main/java/com/example/demo/TestApplication.java new file mode 100644 index 0000000..04759aa --- /dev/null +++ b/test/src/main/java/com/example/demo/TestApplication.java @@ -0,0 +1,13 @@ +package com.example.demo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class TestApplication { + + public static void main(String[] args) { + SpringApplication.run(TestApplication.class, args); + } + +} diff --git a/test/src/main/java/com/example/demo/controller/ApplicationListController.java b/test/src/main/java/com/example/demo/controller/ApplicationListController.java new file mode 100644 index 0000000..e9db932 --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/ApplicationListController.java @@ -0,0 +1,49 @@ +package com.example.demo.controller; +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 com.example.demo.service.ReturnService; + +@Controller +public class ApplicationListController{ + + @Autowired + ReturnService returnService; + + public ApplicationListController(ReturnService returnService) { + this.returnService = returnService; + } + + //applicationListにアクセスしたときに実行されるメソッド + @RequestMapping(value = "/applicationList", method = { RequestMethod.POST, RequestMethod.GET }) + public String index(Model model) { + //サービスから一覧を取得し、getAwaitingApprovalListという名前でHTMLに渡す + model.addAttribute("applicationList", returnService.getAwaitingApprovalList()); + return "applicationList"; + } + +// //メニュー画面に戻るURLへMapping +// @RequestMapping(value = "/menu", method = RequestMethod.POST) +// public String menu() { +// return "menu"; +// } + + //申請承認待ちページに遷移するためのMapping + @RequestMapping(value = "/returnApproval", method = RequestMethod.POST) + //返却確認ページにアクセスしたときに実行されるメソッド + public String returnApproval( + //URLから送られた申請IDを受け取る + @RequestParam("idRequest") Integer idRequest, Model model) { + //受け取った申請IDをidRequestという名前でModelに登録してHTMLに渡す + model.addAttribute("idRequest", idRequest); + //上記で渡すHTMLのURL + return "returnApproval"; + } + + +} + \ No newline at end of file diff --git a/test/src/main/java/com/example/demo/controller/ApprovalConfirmController.java b/test/src/main/java/com/example/demo/controller/ApprovalConfirmController.java new file mode 100644 index 0000000..ee07348 --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/ApprovalConfirmController.java @@ -0,0 +1,54 @@ +package com.example.demo.controller; + +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 com.example.demo.form.ReturnForm; +import com.example.demo.service.ReturnService; + +/** + * 書籍貸出承認確認用のコントローラ + */ +@Controller +public class ApprovalConfirmController { + + // HttpSession httpSession; + ReturnService returnService; + + @Autowired + ApprovalConfirmController(ReturnService returnService) { + this.returnService = returnService; + } + + @ModelAttribute + ReturnForm returnForm() { + return new ReturnForm(); + } + + @RequestMapping(value = "/approvalConfirm", method = { RequestMethod.POST, RequestMethod.GET }) + public String ApporvalForm(@RequestParam("idRequest") int idRequest,Model model) { + //System.out.println("a"); + try { + //仮の値を入れる 貸出テーブルのID + Integer id = idRequest; + //申請IDを元に取得 + ReturnForm approvalresultForm = returnService.getReturnForm(id); + approvalresultForm.setIdRequest(id); + + //returnFormに値をセット + // 画面に返す為の情報をセット + model.addAttribute("returnForm", approvalresultForm); + return "approvalConfirm"; + + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + } + +} diff --git a/test/src/main/java/com/example/demo/controller/ApprovalConfirmResultController.java b/test/src/main/java/com/example/demo/controller/ApprovalConfirmResultController.java new file mode 100644 index 0000000..16344e7 --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/ApprovalConfirmResultController.java @@ -0,0 +1,72 @@ +package com.example.demo.controller; + +import jakarta.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.example.demo.form.ReturnForm; +import com.example.demo.service.ReturnService; + +/** + * 書籍貸出承認完了・却下処理用のコントローラ + */ +@Controller +public class ApprovalConfirmResultController { + + HttpSession httpSession; + ReturnService returnService; + + @Autowired + public ApprovalConfirmResultController(HttpSession httpSession, ReturnService returnService) { + this.httpSession = httpSession; + this.returnService = returnService; + } + + @ModelAttribute + ReturnForm returnForm() { + return new ReturnForm(); + } + + //承認完了画面表示処理 + @RequestMapping(value = "/approvalComplete", method = RequestMethod.POST) + public String approvalComplete(ReturnForm returnForm) { + + try { + //セッションからIDを拾いたい + //いったん1ということで + int id =(int)httpSession.getAttribute("loginUser");; + + returnService.setReturnComplete(returnForm.getIdRequest(), id); + + return "approvalComplete"; + + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + } + + //却下完了画面表示処理 + @RequestMapping(value = "/approvalRejected", method = RequestMethod.POST) + public String approvalRejected(ReturnForm returnForm) { + + try { + //セッションからIDを拾いたい + httpSession.getAttribute(""); + //いったん1ということで + int id =(int)httpSession.getAttribute("loginUser");; + + returnService.setReturnRejected(returnForm.getIdRequest(), id); + + return "approvalRejected"; + + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + } +} diff --git a/test/src/main/java/com/example/demo/controller/LendingController.java b/test/src/main/java/com/example/demo/controller/LendingController.java new file mode 100644 index 0000000..e59790e --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/LendingController.java @@ -0,0 +1,141 @@ +package com.example.demo.controller; + +import java.util.logging.Logger; + +import jakarta.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import com.example.demo.form.LendingForm; +import com.example.demo.service.ReturnService; + +@Controller +public class LendingController { + + // ログ出力用インスタンス + private final static Logger LOGGER = Logger.getLogger(LendingController.class.getName()); + + // エラーメッセージ用の定数フィールド + private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!"; + + //まとめられたserviceクラスを入れる準備 + private final ReturnService returnService; + private final HttpSession httpSession; + + //アノテーションを使用してコンストラクタにインスタンスを代入する + @Autowired + public LendingController(ReturnService returnService,HttpSession httpSession) { + this.returnService = returnService; + this.httpSession=httpSession; + } + + /** + * 【画面1】書籍貸出申請入力画面を表示する + */ + + @GetMapping("/requestLending") + public String showLendingForm( + //書籍一覧から送られてくる蔵書ID + @RequestParam("idBook") int idBook, + //書籍一覧から送られてくる書籍名 + @RequestParam("nmBook") String nmBook, + Model model) { + + LendingForm form = new LendingForm(); + + //前の画面(bookList)から貰ったデータの移し替え + form.setIdBook(idBook); + form.setNmBook(nmBook); + + //次の画面(application.html)へ渡す + model.addAttribute("lendingForm", form); + return "application"; + } + + /** + * 申請画面から確認画面へ進む + */ + //@PostMappingでデータを送信(POST) + @PostMapping("/confirmLending") + public String confirmLending(@ModelAttribute("lendingForm") LendingForm form, + BindingResult result, // + Model model) { + + validateParameter(form, result); + + // result.hasErrors() でエラー判定 + if (result.hasErrors()) { + // エラーが1つでもあったら入力画面に戻す + return "application"; + } + + return "applicationConfirm"; + } + + /** + * + * 確認画面の「申請情報入力に戻る」文字を押すとリンクさせた入力画面へ戻る処理 + */ + //@PostMappingで確認画面のデータ(hidden)を持ったまま送信(POST) + @PostMapping("/backToRequest") + public String backToRequest(@ModelAttribute("lendingForm") LendingForm form, Model model) { + // 確認画面に隠されていたデータを、もう一度トレイ(Model)に載せて引き継ぐ + model.addAttribute("lendingForm", form); + // 1番目の入力画面「application.html」を表示して戻す(日付が残る!) + return "application"; + } + + /** + * 確認画面の「申請」ボタンを押して完了画面へ遷移 + */ + // @PostMappingでデータを送信(POST) + @PostMapping("/executeLending") + public String executeLending(@ModelAttribute("lendingForm") LendingForm form) { + + // 1. 仮のログイン社員ID準備 + int loginEmployeeId = (int)httpSession.getAttribute("loginUser"); + + // 2. サービスクラス内の貸出申請機能を呼び出しを行う + returnService.executeLending(form, loginEmployeeId); + + // 3. redirectメソッドにて次画面である完了画面のURLへ接続し直す + return "redirect:/lendingComplete"; + } + + /** + * 書籍貸出申請完了画面を表示する + */ + //@GetMappingでデータをもらう + @GetMapping("/lendingComplete") + public String showCompletePage() { + return "applicationComplete"; + } + + // 画面でエラーが出た場合の表示 + // エラーが出た場合、BindingResultに直接エラーを登録する + public void validateParameter(LendingForm form, BindingResult result) { + // 1.「貸出日」が未入力(null)かどうかをチェックする + if (form.getDateBorrow() == null) { + result.rejectValue("dateBorrow", "error.dateBorrow", "貸出日 が未入力です。"); + } + // 2.「返却予定日」が未入力(null)かどうかをチェック + if (form.getDateScheduledReturn() == null) { + result.rejectValue("dateScheduledReturn", "error.dateScheduledReturn", "返却予定日 が未入力です。"); + } + // 3「両方ともnullではない(入力されている)」ときのみ日付の前後を比較する + if (form.getDateBorrow() != null && form.getDateScheduledReturn() != null) { + if (form.getDateScheduledReturn().before(form.getDateBorrow())) { + // 日付の前後エラーを返却予定日のエラーとして登録 + result.rejectValue("dateScheduledReturn", "error.dateOrder", "返却予定日 には、貸出日以降の日付を選択してください。"); + } + } + + } +} diff --git a/test/src/main/java/com/example/demo/controller/LendingListController.java b/test/src/main/java/com/example/demo/controller/LendingListController.java new file mode 100644 index 0000000..ce18bd2 --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/LendingListController.java @@ -0,0 +1,71 @@ +package com.example.demo.controller; + +import jakarta.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; + +import com.example.demo.service.ReturnService; + +@Controller +public class LendingListController { + + @Autowired + ReturnService returnService; + + public LendingListController(ReturnService returnService) { + this.returnService = returnService; + } + + //貸出中書籍一覧を表示 + @RequestMapping(value = "/lendingList", method = { RequestMethod.POST, RequestMethod.GET }) + //lendingListにアクセスしたときに実行されるメソッド + public String index(Model model) { + //サービスと連携する処理 + //サービスから一覧を取得し、borrowListという名前でHTMLに渡す + model.addAttribute("borrowList", returnService.getBorrowList()); + //表示するHTML + return "lendingList"; + } + @RequestMapping(value = "/menu", method = RequestMethod.GET) + + @PostMapping("/menu") + public String menu(HttpSession session, Model model) { + Character FlgAdmin = (Character) session.getAttribute("FlgAdmin"); + model.addAttribute("FlgAdmin", FlgAdmin); + if(FlgAdmin=='1') { + return "admin_menu"; + } + return "menu"; + } +// //メニューに戻る +// @RequestMapping(value = "/menu", method = RequestMethod.GET) +// public String menu() { +// return "menu"; +// } + + //書籍返却ページに遷移 + @RequestMapping(value = "/returnConfirm", method = RequestMethod.GET) + //返却確認ページにアクセスしたときに実行されるメソッド + public String returnConfirm( + //URLから送られた申請IDを受け取る + @RequestParam("idRequest") Integer idRequest, Model model) { + //受け取った申請IDをidRequestという名前でHTMLに渡す + model.addAttribute("idRequest", idRequest); + //上記で渡すHTMLのURL + return "returnConfirm"; + } + + //@GetMapping("/lendingList")//登録されているデータを取得する役割を果たす + // public String show(Model model) { + // List x = xservice.getX(); + // model.addAttribute("Y", x); + // return LendingListService.select; + // } + // +} diff --git a/test/src/main/java/com/example/demo/controller/LoginController.java b/test/src/main/java/com/example/demo/controller/LoginController.java new file mode 100644 index 0000000..d3c6d02 --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/LoginController.java @@ -0,0 +1,76 @@ +package com.example.demo.controller; + +import java.util.logging.Logger; + +import jakarta.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; + +import com.example.demo.form.LoginInfoForm; +import com.example.demo.form.LoginUserForm; +import com.example.demo.form.MessageForm; +import com.example.demo.repository.EmployeeRepository; +import com.example.demo.service.ReturnService; + +@Controller +public class LoginController { + + // // ログ出力用インスタンス + private static final Logger LOGGER = Logger.getLogger(LoginController.class.getName()); + + @Autowired + ReturnService service; + @Autowired + EmployeeRepository repo; + + @GetMapping("/login") + public String view(Model model) { + model.addAttribute("loginInfoForm",new LoginInfoForm()); + return "login"; + } + + // ログインボタンが押されたときの処理 + @PostMapping("/doLogin") + public String doLogin(LoginInfoForm form, HttpSession session, Model model) { + + // 入力チェック(メールアドレスやパスワードの形が正しいか) + if (!LoginUserForm.checkParameter(form)) { + // エラーメッセージと、入力されたデータを画面に返す + model.addAttribute("messageError", new MessageForm("メールアドレス、パスワードの入力内容に誤りがあります")); + model.addAttribute("loginInfoForm", form); + return "login"; // login.html を表示 + } + + // 認証チェック(メールアドレスとパスワードが一致するか) + if (service.canlogin(form.getMailAddress(), form.getPassword()) == false) { + // 間違っている場合のメッセージを画面に返す + model.addAttribute("messageError", new MessageForm("IDまたはパスワードが間違っています")); + model.addAttribute("loginInfoForm", form); + return "login"; // login.html を表示 + } + + int userId = service.getUserID(form); + session.setAttribute("loginUser", userId);// セッションにユーザー情報を保存 = 「ログイン中」の状態 + String userName=repo.findById(userId).get().getNmEmployee(); + session.setAttribute("loginName" ,userName); + + //管理者チェック + Character adminFlg = service.getUserFlg(form); + if (adminFlg != null && adminFlg == '1') { +// return "admin_menu";//admin_menuを表示 + } + session.setAttribute("FlgAdmin", adminFlg); + + model.addAttribute("FlgAdmin", adminFlg); + + // 成功したらメニュー画面へ進む + if(adminFlg=='1') { + return "admin_menu"; + } + return "menu"; // menu.html を表示 + } +} diff --git a/test/src/main/java/com/example/demo/controller/LogoutController.java b/test/src/main/java/com/example/demo/controller/LogoutController.java new file mode 100644 index 0000000..059dbac --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/LogoutController.java @@ -0,0 +1,24 @@ +package com.example.demo.controller; + +import jakarta.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PostMapping; + +import com.example.demo.form.LoginInfoForm; + +@Controller +public class LogoutController { + @Autowired + HttpSession session; + + @PostMapping("/doLogout") + public String doLogout(Model model) { + //セッションをすべて破棄 + session.invalidate(); + model.addAttribute("loginInfoForm",new LoginInfoForm()); + return "login"; + } +} \ No newline at end of file diff --git a/test/src/main/java/com/example/demo/controller/MenuController.java b/test/src/main/java/com/example/demo/controller/MenuController.java new file mode 100644 index 0000000..4534630 --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/MenuController.java @@ -0,0 +1,27 @@ +package com.example.demo.controller; + +import jakarta.servlet.http.HttpSession; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PostMapping; + + +@Controller +public class MenuController { + +// @RequestMapping(value = "/menu", method = RequestMethod.GET) +// public String showmenu() { +// return "menu"; +// } + + @PostMapping("/menu") + public String menu(HttpSession session, Model model) { + Character FlgAdmin = (Character) session.getAttribute("FlgAdmin"); + model.addAttribute("FlgAdmin", FlgAdmin); + if(FlgAdmin=='1') { + return "admin_menu"; + } + return "menu"; + } +} diff --git a/test/src/main/java/com/example/demo/controller/ReturnCompleteController.java b/test/src/main/java/com/example/demo/controller/ReturnCompleteController.java new file mode 100644 index 0000000..9404ba2 --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/ReturnCompleteController.java @@ -0,0 +1,51 @@ +package com.example.demo.controller; + +import jakarta.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.example.demo.form.ReturnForm; +import com.example.demo.service.ReturnService; + +//返却完了用のコントローラー +@Controller +public class ReturnCompleteController { + + HttpSession httpSession; + ReturnService returnService; + + @Autowired + public ReturnCompleteController(HttpSession httpSession, ReturnService returnService) { + this.httpSession = httpSession; + this.returnService = returnService; + } + + @ModelAttribute + ReturnForm returnForm() { + return new ReturnForm(); + } + + //返却完了画面表示処理 + @RequestMapping(value = "/returnComplete", method = RequestMethod.POST) + public String returnComplete(ReturnForm returnForm) { + + try { + //いったん1ということで + int id = 1; + //sessionから + id=(int)httpSession.getAttribute("loginUser"); + returnService.setReturn(returnForm.getIdRequest(), id); + + return "returnComplete"; + + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + + } +} diff --git a/test/src/main/java/com/example/demo/controller/ReturnConfirmController.java b/test/src/main/java/com/example/demo/controller/ReturnConfirmController.java new file mode 100644 index 0000000..3dd964a --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/ReturnConfirmController.java @@ -0,0 +1,47 @@ +package com.example.demo.controller; + +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 com.example.demo.form.ReturnForm; +import com.example.demo.service.ReturnService; + +@Controller +public class ReturnConfirmController { + + ReturnService returnService; + + @Autowired + ReturnConfirmController(ReturnService returnService) { + this.returnService = returnService; + } + + @ModelAttribute + ReturnForm returnForm() { + return new ReturnForm(); + } + + @RequestMapping(value = "/returnConfirm", method = { RequestMethod.POST, RequestMethod.GET }) + public String returnConfirm(@RequestParam("idRequest") int idRequest,Model model) { + try { + //仮の値を入れる + Integer id = idRequest; + //申請IDを元に取得 + ReturnForm resultForm = returnService.getReturnForm(id); + resultForm.setIdRequest(id); + + //returnFormに値をセット + // 画面に返す為の情報をセット + model.addAttribute("returnForm", resultForm); + return "returnConfirm"; + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + } +} diff --git a/test/src/main/java/com/example/demo/controller/SelectBookController.java b/test/src/main/java/com/example/demo/controller/SelectBookController.java new file mode 100644 index 0000000..a15664a --- /dev/null +++ b/test/src/main/java/com/example/demo/controller/SelectBookController.java @@ -0,0 +1,141 @@ +package com.example.demo.controller; + +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import jakarta.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.example.demo.entity.Book_collectionEntity; +import com.example.demo.form.SearchConditionBookForm; +import com.example.demo.service.ReturnService; + +@Controller +public class SelectBookController { + + // ログ出力用インスタンス + private final static Logger LOGGER = Logger.getLogger(SelectBookController.class.getName()); + // エラーメッセージ用の定数フィールド + private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!"; + + HttpSession httpsession; + ReturnService returnService; + + @Autowired + public SelectBookController(HttpSession httpSession, ReturnService returnService) { + this.httpsession = httpSession; + this.returnService = returnService; + } + + //空の検索条件Form + @ModelAttribute("bookSearchForm") + public SearchConditionBookForm searchConditionBookForm() { + return new SearchConditionBookForm(); + } + + // ① 書籍一覧の初期表示 + + @RequestMapping(value = "/selectBook", method = RequestMethod.GET) + public String selectBook(Model model) { + try { + //貸出可能な書籍を全て取得 + List books = returnService.availableSelectAll(); + + //取得した書籍情報をModelに登録する + model.addAttribute("books", books); + // + // //管理者か一般ユーザかを判定 + // boolean isAdmin = loginUser.isAdminUser(); + // + // //判定結果をModelに登録する + // model.addAttribute("isAdmin" , isAdmin); + + //書籍一覧画面へ遷移 + return "bookList"; + + } catch (Exception e) { + //httpSessionを破棄 + httpsession.invalidate(); + //エラー内容を出力 + e.printStackTrace(); + //ログにエラーを記録 + LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e); + //エラー画面へ遷移 + return "error"; + } + } + + // ② 検索ボタン押下時の処理 + + @RequestMapping(value = "/selectBook", method = RequestMethod.POST) + public String select(@ModelAttribute("bookSearchForm") SearchConditionBookForm searchConditionBookForm, + Model model) { + try { + + System.out.println("検索処理が実行されました"); + // HTMLから受け取った書籍名を確認する + System.out.println("書籍名:" + searchConditionBookForm.getNmBook()); + // Serviceを呼び出して検索する + List books = returnService.searchByWithLike(searchConditionBookForm); + // 検索結果の件数を確認する + System.out.println("検索結果;" + books.size() + "件"); + // 検索結果をModelに登録する + model.addAttribute("books", books); + model.addAttribute("searched", true); + // 書籍一覧画面へ遷移 + return "bookList"; + + // // 検索結果をModelに登録する + // model.addAttribute("books", books); + // // 書籍一覧画面へ遷移 + // return "bookList"; + + // model.addAttribute("isAdmin" , isAdmin); + // return "bookList"; + + } catch (Exception e) { + //httpSessionを破棄 + httpsession.invalidate(); + //エラー内容を出力 + e.printStackTrace(); + //ログにエラーを記録 + LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e); + //エラー画面へ遷移 + return "error"; + + } + + } +} + +// //書籍一覧画面へ遷移 +// model.addAttribute("isAdmin", isAdmin); +//return "bookList"; +////貸出可能な書籍を全権取得する +////List books = returnService.availableSelectAll(); +////検索結果をmodelに登録する +//model.addAttribute("books" , books); +// +//!!ここに管理者か一般ユーザか判断・でボタンを表示するための処理が必要 + +////一旦コメントアウト +//LoginUser loginUser = (LoginUser)httpSession.getAttribute("loginUser"); + +// +// +////LoginUserのisAdminUser()を呼び出す + +//////管理者ならtrue、一般社員ならfalse +//boolean isAdmin = loginUser.isAdminUser(); +//////判定結果をModelに格納あうる +//////HTMLでは"{isAdmin}"として使用 +//model.addAttribute("isAdmin",isAdmin); +////// Sessionからログイン者情報を取得する +// diff --git a/test/src/main/java/com/example/demo/entity/Book_collectionEntity.java b/test/src/main/java/com/example/demo/entity/Book_collectionEntity.java new file mode 100644 index 0000000..c3b28f4 --- /dev/null +++ b/test/src/main/java/com/example/demo/entity/Book_collectionEntity.java @@ -0,0 +1,121 @@ +package com.example.demo.entity; + +import java.util.Date; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + +import org.springframework.data.annotation.LastModifiedDate; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +//テーブル名 +@Table(name = "book_collection") +@Entity +@Data +@NoArgsConstructor +@AllArgsConstructor +public class Book_collectionEntity { + + //蔵書ID + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id_book", nullable = false) + private Integer idBook; + + //ISBN + @Column(name = "isbn", nullable = false, length = 13) + private String isBn; + + //書籍名 + @Column(name = "nm_book", nullable = false, length = 50) + private String nmBook; + + //書籍名よみ + @Column(name = "kn_book", nullable = true, length = 100) + private String knBook; + + //出版社 + @Column(name = "publisher", nullable = true, length = 50) + private String pubLisher; + + //特記事項 + @Column(name = "note", nullable = true) + private String noteText; + + //貸出フラグ -> charに変更する + @Column(name = "flg_lending", nullable = false, columnDefinition = "default 0") + private Character flgLending; + + //更新者 + @Column(name = "id_update", nullable = false) + private Integer idUpdate; + + //更新日 + @Column(name = "date_update", nullable = false) + @LastModifiedDate + private Date dateUpdate; + + // public static Book_collection convertFrom(Book_collection book_collection) { + // // 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。 + // return new Book_collection Entity( + // book_colletion.getIdBook(), + // book_colletion.getisBn(), + // book_colletion.getnmBook(), + // book_colletion..getknBook(), + // book_colletion.getpublisher(), + // book_colletion.getnoteText(), + // book_colletion.getflgLending(), + // book_colletion.getidUpdate(), + // book_colletion.getdateUupdate() + // ); + // + //} + //public static EmployeeEntity convertFrom(SearchConditionEmployee searchConditionEmployee) { + // EmployeeEntity employeeEntity = new EmployeeEntity(); + // + // employeeEntity.setIdBook(searchConditionEmployee.getIdBook()); + // employeeEntity.setisBn(searchConditionEmployee.getisBn()); + // employeeEntity.setnmBook(searchConditionEmployee.getnmBook()); + + // employeeEntity.setknBook(searchConditionEmployee.knBook()); + // employeeEntity.setpublisher(searchConditionEmployee.getpublisher()); + // employeeEntity.setnoteText(searchConditionEmployee.getnoteText()); + // employeeEntity.setflgLending(searchConditionEmployee.getflgLending()); + // employeeEntity.setidUpdate(searchConditionEmployee.getidUpdate()); + // employeeEntity.setdateUpdate(searchConditionEmployee.getdateUupdate()); + + // + //// public static List createbook_collectionList(List employeeEntityList) { + //// return employeeEntityList.stream().map(EmployeeEntity::createbook_collection).toList(); + //// } + // + // List book_collectionList = new ArrayList<>(); + // for(book_collectionEntity book_collectionEntity:employeeEntityList){ + // book_collection employee = book_collectionEntity.createbook_collection(book_collectionEntity); + // book_collectionList.add(employee); + // } + // return employeeList; + // + // + // public LoginUser createLoginUser() { + // // 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。 + // return new LoginUser( + // getidBook(), + // getisBn(), + // getnmBook(), + // getknBook(), + // getpublisher(), + // getnoteText(), + // getflgLending(), + // getidUpdate(), + // getdateUpdate() + // ); + // } +} diff --git a/test/src/main/java/com/example/demo/entity/Borrow_booksEntity.java b/test/src/main/java/com/example/demo/entity/Borrow_booksEntity.java new file mode 100644 index 0000000..da9059d --- /dev/null +++ b/test/src/main/java/com/example/demo/entity/Borrow_booksEntity.java @@ -0,0 +1,101 @@ +package com.example.demo.entity; + +import java.util.Date; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + +//import org.hibernate.annotations.Audited.Table; +import org.springframework.data.annotation.LastModifiedDate; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Entity +@Table(name = "borrow_books") +@Data +@NoArgsConstructor +@AllArgsConstructor + +public class Borrow_booksEntity { + + /* + * 申請ID + * */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id_request", nullable = false) + private Integer idRequest; + + /* + * 申請者ID + * */ + @Column(name = "id_applicant", nullable = false) + private Integer idApplicant; + + /* + * 蔵書ID + * */ + @Column(name = "id_book", nullable = false) + private Integer idBook; + + /* + * 申請日 + * */ + @Column(name = "date_request", nullable = false) + private Date dateRequest; + + /* + * ステータス + * */ + @Column(name = "status", nullable = false, columnDefinition = "default 1") + private Character status; + + /* + * 承認者 + * */ + @Column(name = "id_approval", nullable = true) + private Integer idApproval; + + /* + * 承認日 + * */ + @Column(name = "date_approval", nullable = true) + private Date dateApproval; + + /* + * 貸出日 + * */ + @Column(name = "date_borrow", nullable = false) + private Date dateBorrow; + + /* + * 返却予定日 + * */ + @Column(name = "date_scheduled_return", nullable = false) + private Date dateScheduledReturn; + + /* + * 返却日 + * */ + @Column(name = "date_return", nullable = true) + private Date dateReturn; + + /* + * 更新者 + * */ + @Column(name = "id_update", nullable = false) + private Integer idUpdate; + + /* + * 更新日 + * */ + @Column(name = "date_update", nullable = false) + @LastModifiedDate + private Date dateUpdate; +} diff --git a/test/src/main/java/com/example/demo/entity/EmployeeEntity.java b/test/src/main/java/com/example/demo/entity/EmployeeEntity.java new file mode 100644 index 0000000..527ac75 --- /dev/null +++ b/test/src/main/java/com/example/demo/entity/EmployeeEntity.java @@ -0,0 +1,141 @@ +package com.example.demo.entity; + +import java.util.Date; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + +import org.springframework.data.annotation.LastModifiedDate; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * EmployeeテーブルのEntity + */ + +@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, length = 50) + private String nmEmployee; + + /** + * 社員よみ + */ + @Column(name = "kn_employee", nullable = false, length = 100) + private String knEmployee; + + /** + * メールアドレス + */ + @Column(name = "mail_address", nullable = false, length = 256) + private String mailAddress; + + /** + * パスワード + */ + @Column(name = "password", nullable = false, length = 256) + private String password; + + /** + * 管理者フラグ + */ + @Column(name = "flg_admin", nullable = false) + private Character FlgAdmin; + + /** + * 退職者フラグ + */ + @Column(name = "flg_retirement", nullable = false) + private Character FlgRetirement; + + /** + * 更新者 + */ + @Column(name = "id_update", nullable = false) + private Integer idUpdate; + + /** + * 更新日 + */ + @Column(name = "date_update", nullable = false) + @LastModifiedDate + private Date dateUpdate; +} + +// public static EmployeeEntity convertForm(Employee employee) { +// return new EmployeeEntity( +// employee.getIdEmployee(), +// employee.getnmEmployee(), +// employee.getknEmployee(), +// employee.getMailAddress(), +// employee.getPassword(), +// employee.getFlgAdmin(), +// employee.getFlgRetirement(), +// employee.getIdUpdate(), +// employee.getDateUpdate()); +// +// } +// +// 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()); +// +// return employeeEntity; +// +// } +// +// public static Employee createEmployee(EmployeeEntity employeeEntity) { +// return new Employee( +// employeeEntity.getIdEmployee(), +// employeeEntity.getNmEmployee(), +// employeeEntity.getKnEmployee(), +// employeeEntity.getMailAddress(), +// employeeEntity.getPassword(), +// employeeEntity.getFlgAdmin(), +// employeeEntity.getFlgRetirement(), +// employeeEntity.getIdUpdate(), +// employeeEntity.getDateUpdate()); +// } +// +// public static List createEmployeeList(List employeeEntityList) { +// return employeeEntityList.stream().map(EmployeeEntity::createEmployee).toList(); +// } +// +// public LoginUser createLoginUser() { +// getIdEmployee(), +// getNmEmployee(), +// getKnEmployee(), +// getMailAddress(), +// getPassword(), +// getFlgAdmin(), +// getFlgRetirement(), +// getIdUpdate(), +// getDateUpdate()); +//} +//} diff --git a/test/src/main/java/com/example/demo/form/LendingForm.java b/test/src/main/java/com/example/demo/form/LendingForm.java new file mode 100644 index 0000000..f61a9da --- /dev/null +++ b/test/src/main/java/com/example/demo/form/LendingForm.java @@ -0,0 +1,60 @@ +package com.example.demo.form; + +import java.util.Date; + +import org.springframework.format.annotation.DateTimeFormat; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class LendingForm { + /** + * 蔵書ID + */ + private int idBook; + /** + * 書籍名 + */ + private String nmBook; + + //貸出日と返却予定日にアノテーションで日付や時刻の表示形式を指定 + + /** + * 貸出日 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd") + //Date型で取り扱う + private Date dateBorrow; + + /** + * 返却予定日 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date dateScheduledReturn; + + /** + * 貸出日を取得するメソッド + */ + public Date getDate_borrow() { + return this.dateBorrow; + } + + /** + * 返却予定日を取得するメソッド + */ + public Date getDate_scheduled_return() { + return this.dateScheduledReturn; + } + + /** + * サービスクラスの表記に合わせるためのメソッド + */ + public int getId_book() { + return this.idBook; + + } +} diff --git a/test/src/main/java/com/example/demo/form/LoginInfoForm.java b/test/src/main/java/com/example/demo/form/LoginInfoForm.java new file mode 100644 index 0000000..ec02f33 --- /dev/null +++ b/test/src/main/java/com/example/demo/form/LoginInfoForm.java @@ -0,0 +1,22 @@ +package com.example.demo.form; + +//ログイン情報 +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor + +public class LoginInfoForm { + /** + * メールアドレス + */ + private String mailAddress; + /** + * パスワード + */ + private String password; + +} diff --git a/test/src/main/java/com/example/demo/form/LoginUserForm.java b/test/src/main/java/com/example/demo/form/LoginUserForm.java new file mode 100644 index 0000000..8d6657a --- /dev/null +++ b/test/src/main/java/com/example/demo/form/LoginUserForm.java @@ -0,0 +1,94 @@ +package com.example.demo.form; + +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 flgadmin; + + /** + * business 層の LoginUser クラスから画面用(presentation 層)の LoginUserForm に + * 変換します。 + * + * @param loginUser business 層の LoginUser インスタンス + * @return クラスから画面用(presentation 層)の LoginUserForm + */ + public static LoginUserForm convertFrom(LoginUserForm loginUser) { + return new LoginUserForm( + loginUser.getIdEmployee(), + loginUser.getNmEmployee(), + loginUser.getKnEmployee(), + loginUser.getMailAddress(), + loginUser.getPassword(), + loginUser.getFlgadmin() + ); + } + + + public static LoginUserForm convertTo(LoginUserForm loginUserForm) { + return new LoginUserForm( + loginUserForm.getIdEmployee(), + loginUserForm.getNmEmployee(), + loginUserForm.getKnEmployee(), + loginUserForm.getMailAddress(), + loginUserForm.getPassword(), + loginUserForm.getFlgadmin() + ); + } + + + 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 getFlgadmin() == 1; + } +} diff --git a/test/src/main/java/com/example/demo/form/MessageForm.java b/test/src/main/java/com/example/demo/form/MessageForm.java new file mode 100644 index 0000000..bfcca6e --- /dev/null +++ b/test/src/main/java/com/example/demo/form/MessageForm.java @@ -0,0 +1,15 @@ +package com.example.demo.form; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 画面に表示するエラーメッセージを管理するクラスです。 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class MessageForm { + private String message; +} diff --git a/test/src/main/java/com/example/demo/form/ReturnForm.java b/test/src/main/java/com/example/demo/form/ReturnForm.java new file mode 100644 index 0000000..3047723 --- /dev/null +++ b/test/src/main/java/com/example/demo/form/ReturnForm.java @@ -0,0 +1,36 @@ +package com.example.demo.form; + +import java.util.Date; + +import org.springframework.format.annotation.DateTimeFormat; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ReturnForm { + //申請ID + private Integer idRequest; + //申請者名//社員名 + private String nmEmployee; + //申請日 + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date dateRequest; + //貸出日 + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date dateBorrow; + //返却予定日 + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date dateScheduledReturn; + //ISBN + private String isBn; + //書籍名 + private String nmBook; + //出版社 + private String pubLisher; + //特記事項 + private String noteText; +} diff --git a/test/src/main/java/com/example/demo/form/SearchConditionBookForm.java b/test/src/main/java/com/example/demo/form/SearchConditionBookForm.java new file mode 100644 index 0000000..e180cc6 --- /dev/null +++ b/test/src/main/java/com/example/demo/form/SearchConditionBookForm.java @@ -0,0 +1,18 @@ +package com.example.demo.form; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class SearchConditionBookForm { + //書籍名 + private String nmBook; + //出版社 + private String pubLisher; + //特記事項 + private String noteText; + +} diff --git a/test/src/main/java/com/example/demo/model/LeadingListModel.java b/test/src/main/java/com/example/demo/model/LeadingListModel.java new file mode 100644 index 0000000..e63918b --- /dev/null +++ b/test/src/main/java/com/example/demo/model/LeadingListModel.java @@ -0,0 +1,18 @@ +package com.example.demo.model; + +import java.util.Date; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class LeadingListModel { + //データの保持 + private final Integer idRequest; + private final String nmEmployee; + private final String nmBook; + private final Date dateRequest; + private final Date dateBorrow; + private final Date dateScheduledReturn; +} diff --git a/test/src/main/java/com/example/demo/repository/Book_CollectionRepository.java b/test/src/main/java/com/example/demo/repository/Book_CollectionRepository.java new file mode 100644 index 0000000..20efe7b --- /dev/null +++ b/test/src/main/java/com/example/demo/repository/Book_CollectionRepository.java @@ -0,0 +1,49 @@ +package com.example.demo.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.example.demo.entity.Book_collectionEntity; + +@Repository +public interface Book_CollectionRepository extends JpaRepository { + //JpaRepositoruを継承することで基本的なDB操作が使用できる + //Book_collctionEntity:操作するEntity + //Integer: Entity の主キーの"id_book"の型 + + List findByFlgLending(Character flgLending); + +// [ b.noteText ] …Entityのフィールドを表す +// [ :noteText ]…Javaから渡された検索条件を表す。ユーザが入力した(Java)などの文字列が入る +// [:]…JPQLでは、名前付きパラメータを指定するときに、名前の前に : を付け + + + @Query(""" + SELECT b FROM Book_collectionEntity b + WHERE b.flgLending='0' + AND (:nmBook = '' OR b.nmBook LIKE CONCAT('%', :nmBook,'%')) + AND (:pubLisher = '' OR b.pubLisher LIKE CONCAT('%', :pubLisher,'%')) + AND (:noteText = '' OR b.noteText LIKE CONCAT('%',:noteText,'%')) + ORDER BY b.idBook + """) + //上から:貸出フラグが'0'の書籍だけを取得する + //書籍名が空欄なら絞り込まない、入力されてるなら部分一致検索する + //出版社が... + //特記事項が... + //蔵書IDの昇順で並べる + + + //書籍名・出版社・特記事項を条件に書籍を検索するメソッド + //検索結果はBook_collectionEntityのListで返す + List searchBooks( + //入力された書籍名をJPQLの:nmBookに返す +// [:]…JPQLでは、名前付きパラメータを指定するときに、名前の前に : を付け +//    └[ : ] 以降の名前は @Param("noteText") の名前と一致させる + @Param("nmBook") String nmBook, + @Param("pubLisher") String pubLisher, + @Param("noteText") String noteText); +} diff --git a/test/src/main/java/com/example/demo/repository/Borrow_BooksRepository.java b/test/src/main/java/com/example/demo/repository/Borrow_BooksRepository.java new file mode 100644 index 0000000..865b052 --- /dev/null +++ b/test/src/main/java/com/example/demo/repository/Borrow_BooksRepository.java @@ -0,0 +1,13 @@ +package com.example.demo.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.example.demo.entity.Borrow_booksEntity; + +@Repository +public interface Borrow_BooksRepository extends JpaRepository { + List findByStatus(Character status); +} diff --git a/test/src/main/java/com/example/demo/repository/EmployeeRepository.java b/test/src/main/java/com/example/demo/repository/EmployeeRepository.java new file mode 100644 index 0000000..d6c6271 --- /dev/null +++ b/test/src/main/java/com/example/demo/repository/EmployeeRepository.java @@ -0,0 +1,15 @@ +package com.example.demo.repository; + +import java.util.Optional; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.example.demo.entity.EmployeeEntity; + +@Repository +public interface EmployeeRepository extends JpaRepository { + + //メールアドレスとパスワードに合致するレコード + Optional findByMailAddressAndPassword(String mailAddress, String password); +} \ No newline at end of file diff --git a/test/src/main/java/com/example/demo/service/ReturnService.java b/test/src/main/java/com/example/demo/service/ReturnService.java new file mode 100644 index 0000000..6e2e341 --- /dev/null +++ b/test/src/main/java/com/example/demo/service/ReturnService.java @@ -0,0 +1,201 @@ +package com.example.demo.service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.example.demo.entity.Book_collectionEntity; +import com.example.demo.entity.Borrow_booksEntity; +import com.example.demo.form.LendingForm; +import com.example.demo.form.LoginInfoForm; +import com.example.demo.form.ReturnForm; +import com.example.demo.form.SearchConditionBookForm; +import com.example.demo.model.LeadingListModel; +import com.example.demo.repository.Book_CollectionRepository; +import com.example.demo.repository.Borrow_BooksRepository; +import com.example.demo.repository.EmployeeRepository; + +@Service +public class ReturnService { + + Book_CollectionRepository book_CollectionRepository; + Borrow_BooksRepository borrowRepository; + EmployeeRepository employeeRepository; + + @Autowired + public ReturnService( + Book_CollectionRepository book_CollectionRepository, + Borrow_BooksRepository borrowRepository, + EmployeeRepository employeeRepository) { + this.book_CollectionRepository = book_CollectionRepository; + this.borrowRepository = borrowRepository; + this.employeeRepository = employeeRepository; + } + + public ReturnForm getReturnForm(int id) { + ReturnForm result = new ReturnForm(); + Optional borrow = borrowRepository.findById(id); + // System.out.println(borrow); + result.setDateRequest(borrow.get().getDateRequest());//申請日 + result.setDateBorrow(borrow.get().getDateBorrow());//貸出日 + result.setDateScheduledReturn(borrow.get().getDateScheduledReturn());//返却予定日 + + var emp = employeeRepository.findById(borrow.get().getIdApplicant()); + result.setNmEmployee(emp.get().getNmEmployee());//申請者名、社員名 + + var book = book_CollectionRepository.findById(borrow.get().getIdBook()); + result.setIsBn(book.get().getIsBn());//ISBN + result.setNmBook(book.get().getNmBook());//書籍名 + result.setPubLisher(book.get().getPubLisher());//出版社 + result.setNoteText(book.get().getNoteText()); + + return result; + } + + public void setReturn(int id_request, int id_employee) { + var borrow = borrowRepository.findById(id_request); + var book = book_CollectionRepository.findById(borrow.get().getIdBook()); + book.get().setFlgLending('0');//「貸出フラグ」を【貸出可】 + borrow.get().setStatus('0');//貸出テーブルの「ステータス」を【返却済 + borrow.get().setDateReturn(new Date());//「返却日」を当日日付 + borrow.get().setIdUpdate(id_employee);//「更新者」を更新した人のID + borrow.get().setDateUpdate(new Date());//「更新日」を当日日付に更新する。 + + borrowRepository.save(borrow.get()); + book_CollectionRepository.save(book.get()); + } + + //貸出承認 + public void setReturnComplete(int id_request, int id_employee) { + var borrow = borrowRepository.findById(id_request); + var book = book_CollectionRepository.findById(borrow.get().getIdBook()); + + borrow.get().setStatus('2');//貸出テーブルの「ステータス」を【貸出中】 + borrow.get().setDateApproval(new Date());//「承認日」を当日日付 + borrow.get().setIdUpdate(id_employee);//「更新者」を更新した人のID + borrow.get().setDateUpdate(new Date());//「更新日」を当日日付に更新する。 + borrow.get().setIdApproval(id_employee); + borrowRepository.save(borrow.get()); + book_CollectionRepository.save(book.get()); + + } + + //却下 + //貸出テーブルの「ステータス」を【却下】、「更新者」を却下した人のID、「更新日」を当日日付に更新する。 + //また、蔵書テーブルの「貸出フラグ」を【貸出可】に更新する。 + public void setReturnRejected(int id_request, int id_employee) { + + var borrow = borrowRepository.findById(id_request); + var book = book_CollectionRepository.findById(borrow.get().getIdBook()); + + book.get().setFlgLending('0');//「貸出フラグ」を【貸出可】 + borrow.get().setStatus('9');//貸出テーブルの「ステータス」を【却下】 + borrow.get().setIdUpdate(id_employee);//「更新者」を却下した人のID + borrow.get().setDateUpdate(new Date());//「更新日」を当日日付に更新する。 + borrowRepository.save(borrow.get()); + book_CollectionRepository.save(book.get()); + } + + //貸し出し可能な書籍の全権取得 + public List availableSelectAll() { + return book_CollectionRepository.findByFlgLending('0'); + } + + //書籍名・出版社・特記事項の部分一致検索 + public List searchByWithLike( + SearchConditionBookForm form) { + String nmBook = form.getNmBook(); + String pubLisher = form.getPubLisher(); + String noteText = form.getNoteText(); + nmBook = nmBook == null ? "" : nmBook; + pubLisher = pubLisher == null ? "" : pubLisher; + noteText = noteText == null ? "" : noteText; + return book_CollectionRepository.searchBooks( + nmBook, + pubLisher, + noteText); + } + + public List getBorrowList() { + List result = new ArrayList(); + + List borrow = borrowRepository.findByStatus('2'); + for (Borrow_booksEntity borrow_booksEntity : borrow) { + String nmEmployee = employeeRepository.findById(borrow_booksEntity.getIdApplicant()).get().getNmEmployee(); + String nmBook = book_CollectionRepository.findById(borrow_booksEntity.getIdBook()).get().getNmBook(); + LeadingListModel a = new LeadingListModel(borrow_booksEntity.getIdRequest(), + nmEmployee, + nmBook, + borrow_booksEntity.getDateRequest(), + borrow_booksEntity.getDateBorrow(), + borrow_booksEntity.getDateScheduledReturn()); + result.add(a); + } + return result; + + } + + //書籍貸出申請機能 + public void executeLending(LendingForm form, int idEmployee) { + var book_collection = book_CollectionRepository.findById(form.getId_book());//更新したい本のEntityを取得 + book_collection.get().setFlgLending('1');//フラグだけ書き換え + book_CollectionRepository.save(book_collection.get()); + + Borrow_booksEntity borrow = new Borrow_booksEntity();//空の申請レコード + borrow.setIdApplicant(idEmployee);//申請者ID + borrow.setIdBook(form.getId_book());//蔵書ID + borrow.setDateRequest(new Date());//申請日 + borrow.setStatus('1');//ステータスを承認待ちに + borrow.setIdUpdate(idEmployee);//更新者ID + borrow.setDateUpdate(new Date());//更新日 + + //必要だったため追記 + borrow.setDateBorrow(form.getDate_borrow()); //貸出日 + borrow.setDateScheduledReturn(form.getDate_scheduled_return()); //返却予定日 + borrowRepository.save(borrow); + } + + //貸出テーブルの「ステータス」が「1:承認待」の情報を全件取得 +public List getAwaitingApprovalList() { + List result = new ArrayList(); + + List borrow = borrowRepository.findByStatus('1'); + for (Borrow_booksEntity borrow_booksEntity : borrow) { + String nmEmployee = employeeRepository.findById(borrow_booksEntity.getIdApplicant()).get().getNmEmployee(); + String nmBook = book_CollectionRepository.findById(borrow_booksEntity.getIdBook()).get().getNmBook(); + LeadingListModel a = new LeadingListModel(borrow_booksEntity.getIdRequest(), + nmEmployee, + nmBook, + borrow_booksEntity.getDateRequest(), + borrow_booksEntity.getDateBorrow(), + borrow_booksEntity.getDateScheduledReturn()); + result.add(a); + } + return result; + +} + +//メアドとパスワードが合っていればtureで返す +public boolean canlogin(String mail, String pass) { + if (mail == null || mail.isEmpty() || pass == null || pass.isEmpty()) { + return false; + } + return employeeRepository.findByMailAddressAndPassword(mail, pass).isPresent(); +} + +//LoginInfoFormの情報からidEmployeeを返す +public int getUserID(LoginInfoForm form) { + return employeeRepository.findByMailAddressAndPassword(form.getMailAddress(), form.getPassword()).get() + .getIdEmployee(); +} + +//LoginInfoFormの情報からFlgを返す 0なら一般,1なら管理 +public Character getUserFlg(LoginInfoForm form) { + return employeeRepository.findByMailAddressAndPassword(form.getMailAddress(), form.getPassword()).get() + .getFlgAdmin(); +} +} \ No newline at end of file diff --git a/test/src/main/resources/application.properties b/test/src/main/resources/application.properties new file mode 100644 index 0000000..ed8d833 --- /dev/null +++ b/test/src/main/resources/application.properties @@ -0,0 +1,4 @@ +spring.application.name=test +spring.datasource.url=jdbc:mysql://localhost:3306/rezodb +spring.datasource.username=rezouser +spring.datasource.password=Rezo_0000 \ No newline at end of file diff --git a/test/src/main/resources/templates/admin_menu.html b/test/src/main/resources/templates/admin_menu.html new file mode 100644 index 0000000..85a4766 --- /dev/null +++ b/test/src/main/resources/templates/admin_menu.html @@ -0,0 +1,47 @@ + + + + + + メニュー + + + +
+ +
+ ログイン者名: + +
+ +
+

メニュー

+ + + +
+ + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/test/src/main/resources/templates/application.html b/test/src/main/resources/templates/application.html new file mode 100644 index 0000000..70b1b02 --- /dev/null +++ b/test/src/main/resources/templates/application.html @@ -0,0 +1,76 @@ + + + + + + + + 書籍貸出申請 + + + +
+
+ ログイン者名: + +
+
+ +

書籍貸出申請

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
蔵書ID
書籍名
貸出日 + + +
返却予定日 + + +
+ +
+
+ + + 書籍一覧に戻る + + + \ No newline at end of file diff --git a/test/src/main/resources/templates/applicationComplete.html b/test/src/main/resources/templates/applicationComplete.html new file mode 100644 index 0000000..e49f0f8 --- /dev/null +++ b/test/src/main/resources/templates/applicationComplete.html @@ -0,0 +1,46 @@ + + + + + + + + 書籍貸出申請完了 + + + +
+
+ ログイン者名: + +
+
+ +

書籍貸出申請

+ + + + + + + + + + + +

書籍貸出申請完了しました

+ + + + + \ No newline at end of file diff --git a/test/src/main/resources/templates/applicationConfirm.html b/test/src/main/resources/templates/applicationConfirm.html new file mode 100644 index 0000000..0cb6c0a --- /dev/null +++ b/test/src/main/resources/templates/applicationConfirm.html @@ -0,0 +1,80 @@ + + + + + + + 書籍貸出申請確認 + + + +
+
+ ログイン者名: + +
+
+ +

書籍貸出申請

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
蔵書ID
書籍名
貸出日 +
返却予定日 +
+ + +
+
+ + + + + \ No newline at end of file diff --git a/test/src/main/resources/templates/applicationList.html b/test/src/main/resources/templates/applicationList.html new file mode 100644 index 0000000..8ccf70a --- /dev/null +++ b/test/src/main/resources/templates/applicationList.html @@ -0,0 +1,57 @@ + + + + + + 書籍貸出申請一覧 + + + +
+
+ ログイン者名: + +
+
+

書籍貸出申請一覧

+ メニューに戻る +

検索結果

+ + + + + + + + + + + + + + + + + + + + + + + +
申請ID申請者名書籍名申請日貸出日返却予定日操作
+ +
+ + + +
+
+
+ + + 現在書籍貸出の申請はありません。 + + + + \ No newline at end of file diff --git a/test/src/main/resources/templates/approvalComplete.html b/test/src/main/resources/templates/approvalComplete.html new file mode 100644 index 0000000..4aa61c1 --- /dev/null +++ b/test/src/main/resources/templates/approvalComplete.html @@ -0,0 +1,20 @@ + + + + + + 書籍貸出承認画面 + +
+
+ ログイン者名: + +
+
+ +

書籍貸出申請を承認しました。

+
+承認待ち一覧に戻る | メニューに戻る + + + \ No newline at end of file diff --git a/test/src/main/resources/templates/approvalConfirm.html b/test/src/main/resources/templates/approvalConfirm.html new file mode 100644 index 0000000..e45eadd --- /dev/null +++ b/test/src/main/resources/templates/approvalConfirm.html @@ -0,0 +1,141 @@ + + + + + 書籍貸出承認確認 + + +
+
+ ログイン者名: + +
+
+

書籍貸出承認確認

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
申請ID + +
申請者名 + +
申請日 + +
ISBN + +
書籍名 + +
出版社 + +
特記事項 + +
貸出日 + +
返却予定日 + +
+ + +
+
+ + 承認待ち一覧に戻る +
+
+ + \ No newline at end of file diff --git a/test/src/main/resources/templates/approvalRejected.html b/test/src/main/resources/templates/approvalRejected.html new file mode 100644 index 0000000..d25a3c7 --- /dev/null +++ b/test/src/main/resources/templates/approvalRejected.html @@ -0,0 +1,19 @@ + + + + + + 書籍貸出却下画面 + +
+
+ ログイン者名: + +
+
+ +

書籍貸出申請を却下しました。

+
+承認待ち一覧に戻る | メニューに戻る + + \ No newline at end of file diff --git a/test/src/main/resources/templates/bookList.html b/test/src/main/resources/templates/bookList.html new file mode 100644 index 0000000..b6db0b6 --- /dev/null +++ b/test/src/main/resources/templates/bookList.html @@ -0,0 +1,114 @@ + + + + + +書籍一覧・検索 + + + + + + +
+
+ログイン者名: + +
+
+ +

書籍一覧・検索

+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
書籍名
出版社
特記事項
+ + + + +
+ + +メニューに戻る + +

検索結果

+

+ 検索結果は0件です。 +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
書籍IDISBN書籍名書籍名よみ出版社特記事項操作
+ + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/test/src/main/resources/templates/lendingList.html b/test/src/main/resources/templates/lendingList.html new file mode 100644 index 0000000..3f03cd2 --- /dev/null +++ b/test/src/main/resources/templates/lendingList.html @@ -0,0 +1,56 @@ + + + + + + 貸出中書籍一覧 + + + +
+
+ ログイン者名: + +
+
+

貸出中書籍一覧

+ メニューに戻る +

検索結果

+ + + + + + + + + + + + + + + + + + + + + + + +
申請ID申請者名書籍名申請日貸出日返却予定日操作
+ +
+ + + +
+
+
+ + 貸出中の書籍はありません + + + + \ No newline at end of file diff --git a/test/src/main/resources/templates/login.html b/test/src/main/resources/templates/login.html new file mode 100644 index 0000000..dbf7421 --- /dev/null +++ b/test/src/main/resources/templates/login.html @@ -0,0 +1,67 @@ + + + + + + + + + + + + ログイン画面 + + + +

ログイン

+
+ +
+ +
+ + + + + + + + + + + + + + + +
メールアドレス + +
パスワード + +
+ + +
+
+ + + + + diff --git a/test/src/main/resources/templates/menu.html b/test/src/main/resources/templates/menu.html new file mode 100644 index 0000000..4276756 --- /dev/null +++ b/test/src/main/resources/templates/menu.html @@ -0,0 +1,32 @@ + + + + + + メニュー + + + +
+
+ ログイン者名: + +
+
+

メニュー

+ + + +
+ + + + + + +
+ + + \ No newline at end of file diff --git a/test/src/main/resources/templates/returnComplete.html b/test/src/main/resources/templates/returnComplete.html new file mode 100644 index 0000000..a5fef39 --- /dev/null +++ b/test/src/main/resources/templates/returnComplete.html @@ -0,0 +1,26 @@ + + + + + + 書籍返却完了 + + + +
+
+ ログイン者名: + +
+
+

書籍返却確認

+

書籍の返却が完了しました

+ + + + + + \ No newline at end of file diff --git a/test/src/main/resources/templates/returnConfirm.html b/test/src/main/resources/templates/returnConfirm.html new file mode 100644 index 0000000..6b723bd --- /dev/null +++ b/test/src/main/resources/templates/returnConfirm.html @@ -0,0 +1,140 @@ + + + + + + 書籍返却確認 + + +
+
+ ログイン者名: + +
+
+

書籍返却確認

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
申請ID + +
申請者名 + +
申請日 + +
ISBN + +
書籍名 + +
出版社 + +
特記事項 + +
貸出日 + +
返却予定日 + +
+ +
+ + 貸出中書籍一覧に戻る +
+ + + \ No newline at end of file diff --git a/test/src/test/java/com/example/demo/TestApplicationTests.java b/test/src/test/java/com/example/demo/TestApplicationTests.java new file mode 100644 index 0000000..bdc7c14 --- /dev/null +++ b/test/src/test/java/com/example/demo/TestApplicationTests.java @@ -0,0 +1,13 @@ +package com.example.demo; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class TestApplicationTests { + + @Test + void contextLoads() { + } + +}