From 995676ae5d544b0375a6b7c158c374d4c556ad42 Mon Sep 17 00:00:00 2001 From: kaon Date: Wed, 7 May 2025 12:33:46 +0900 Subject: [PATCH] hahaha --- .gitattributes | 2 + .gitignore | 33 +++ .mvn/wrapper/maven-wrapper.properties | 19 ++ mvnw | 259 ++++++++++++++++++ mvnw.cmd | 149 ++++++++++ pom.xml | 87 ++++++ src/main/java/co/jp/app/Dog1Application.java | 13 + .../co/jp/app/controller/PetController.java | 25 ++ .../co/jp/app/controller/loginController.java | 41 +++ .../java/co/jp/app/entity/ErrorEntity.java | 35 +++ src/main/java/co/jp/app/entity/PetEntity.java | 101 +++++++ .../java/co/jp/app/entity/UserEntity.java | 42 +++ .../co/jp/app/repository/PetRepository.java | 18 ++ .../co/jp/app/repository/PetRepository.xml | 10 + .../co/jp/app/repository/erraRepository.java | 15 + .../co/jp/app/repository/erraRepository.xml | 10 + .../co/jp/app/repository/userRepository.java | 18 ++ .../co/jp/app/repository/userRepository.xml | 14 + .../java/co/jp/app/service/PetService.java | 22 ++ .../java/co/jp/app/service/erraService.java | 19 ++ .../java/co/jp/app/service/userService.java | 25 ++ src/main/resources/application.properties | 10 + .../resources/static/caJnmA6E_400x400.jpg | Bin 0 -> 8314 bytes src/test/java/application.properties | 11 + .../java/co/jp/app/Dog1ApplicationTests.java | 13 + 25 files changed, 991 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .mvn/wrapper/maven-wrapper.properties create mode 100644 mvnw create mode 100644 mvnw.cmd create mode 100644 pom.xml create mode 100644 src/main/java/co/jp/app/Dog1Application.java create mode 100644 src/main/java/co/jp/app/controller/PetController.java create mode 100644 src/main/java/co/jp/app/controller/loginController.java create mode 100644 src/main/java/co/jp/app/entity/ErrorEntity.java create mode 100644 src/main/java/co/jp/app/entity/PetEntity.java create mode 100644 src/main/java/co/jp/app/entity/UserEntity.java create mode 100644 src/main/java/co/jp/app/repository/PetRepository.java create mode 100644 src/main/java/co/jp/app/repository/PetRepository.xml create mode 100644 src/main/java/co/jp/app/repository/erraRepository.java create mode 100644 src/main/java/co/jp/app/repository/erraRepository.xml create mode 100644 src/main/java/co/jp/app/repository/userRepository.java create mode 100644 src/main/java/co/jp/app/repository/userRepository.xml create mode 100644 src/main/java/co/jp/app/service/PetService.java create mode 100644 src/main/java/co/jp/app/service/erraService.java create mode 100644 src/main/java/co/jp/app/service/userService.java create mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/static/caJnmA6E_400x400.jpg create mode 100644 src/test/java/application.properties create mode 100644 src/test/java/co/jp/app/Dog1ApplicationTests.java diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3b41682 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/mvnw text eol=lf +*.cmd text eol=crlf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/.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/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..d58dfb7 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,19 @@ +# 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. +wrapperVersion=3.3.2 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..19529dd --- /dev/null +++ b/mvnw @@ -0,0 +1,259 @@ +#!/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.2 +# +# 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:]' +} + +# 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 <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.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${0##*/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 +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..249bdf3 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,149 @@ +<# : 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.2 +@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) { "/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_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" +if ($env:MAVEN_USER_HOME) { + $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" +} +$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::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 +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -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/pom.xml b/pom.xml new file mode 100644 index 0000000..e38e0de --- /dev/null +++ b/pom.xml @@ -0,0 +1,87 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.4.5 + + + co.jp.app + dog-2 + 0.0.1-SNAPSHOT + dog-1 + dog introduce project for Spring Boot + + + + + + + + + + + + + + + 17 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.mysql + mysql-connector-j + runtime + + + org.springframework.boot + spring-boot-starter-test + test + + + com.fasterxml.jackson.core + jackson-databind + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.projectlombok + lombok + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + \ No newline at end of file diff --git a/src/main/java/co/jp/app/Dog1Application.java b/src/main/java/co/jp/app/Dog1Application.java new file mode 100644 index 0000000..025d47a --- /dev/null +++ b/src/main/java/co/jp/app/Dog1Application.java @@ -0,0 +1,13 @@ +package co.jp.app; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Dog1Application { + + public static void main(String[] args) { + SpringApplication.run(Dog1Application.class, args); + } + +} diff --git a/src/main/java/co/jp/app/controller/PetController.java b/src/main/java/co/jp/app/controller/PetController.java new file mode 100644 index 0000000..530a677 --- /dev/null +++ b/src/main/java/co/jp/app/controller/PetController.java @@ -0,0 +1,25 @@ +package co.jp.app.controller; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import co.jp.app.service.PetService; + + +@Controller + +public class PetController { + + @Autowired + private PetService service; + + @GetMapping("/api/dogs/pet") + public String getListByEntities(@RequestParam List id) { + service.getPetByID(id); + return "pet"; + } +} diff --git a/src/main/java/co/jp/app/controller/loginController.java b/src/main/java/co/jp/app/controller/loginController.java new file mode 100644 index 0000000..156d326 --- /dev/null +++ b/src/main/java/co/jp/app/controller/loginController.java @@ -0,0 +1,41 @@ +package co.jp.app.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import co.jp.app.entity.ErrorEntity; +import co.jp.app.entity.UserEntity; +import co.jp.app.service.erraService; +import co.jp.app.service.userService; + + +@CrossOrigin("http://192.168.1.50:5173") +@RestController("/api/login") +public class loginController { + + @Autowired + private userService userService; + + @Autowired + private erraService erraService; + + @GetMapping("/status") + public String getStatusByNameOrEmail() { + String input="aaa"; + + // input 可能是名字 或 email + UserEntity userByName = userService.getNameByEntity(input); + UserEntity userByEmail = userService.getEmailByEntity(input); + + if (userByName == null && userByEmail == null) { + return "全項目に入力してください"; + } + + // 如果有找到,就固定使用 ID 1001 去查 erraEntity + ErrorEntity erra = erraService.getStatusById(1001); + + return erra.getStatus(); + } +} diff --git a/src/main/java/co/jp/app/entity/ErrorEntity.java b/src/main/java/co/jp/app/entity/ErrorEntity.java new file mode 100644 index 0000000..5854646 --- /dev/null +++ b/src/main/java/co/jp/app/entity/ErrorEntity.java @@ -0,0 +1,35 @@ +package co.jp.app.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +@Entity +public class ErrorEntity { + +@GeneratedValue(strategy = GenerationType.IDENTITY) +@Id +private int id; + +private String status; + +public int getId() { + return id; +} + +public void setId(int id) { + this.id = id; +} + +public String getStatus() { + return status; +} + +public void setStatus(String status) { + this.status = status; +} + + + +} diff --git a/src/main/java/co/jp/app/entity/PetEntity.java b/src/main/java/co/jp/app/entity/PetEntity.java new file mode 100644 index 0000000..918c635 --- /dev/null +++ b/src/main/java/co/jp/app/entity/PetEntity.java @@ -0,0 +1,101 @@ +package co.jp.app.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +@Entity +public class PetEntity{ +@GeneratedValue(strategy = GenerationType.IDENTITY) + +@Id +private int ID; + //犬の名前 + private String name; + //犬の種類 + private String type; + //犬の誕生日 + private String brithday; + //犬の体重 + private int weight; + //犬の身長 + private int lenght; + //犬の性格 + private String persionarity; + //犬の健康状態 + private String status; + //犬の圖片 + private String image; + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getBrithday() { + return brithday; + } + + public void setBrithday(String brithday) { + this.brithday = brithday; + } + + public int getWeight() { + return weight; + } + + public void setWeight(int weight) { + this.weight = weight; + } + + public int getLenght() { + return lenght; + } + + public void setLenght(int lenght) { + this.lenght = lenght; + } + + public String getPersionarity() { + return persionarity; + } + + public void setPersionarity(String persionarity) { + this.persionarity = persionarity; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + public int getID() { + return ID; + } + + public void setID(int iD) { + ID = iD; + } + +} diff --git a/src/main/java/co/jp/app/entity/UserEntity.java b/src/main/java/co/jp/app/entity/UserEntity.java new file mode 100644 index 0000000..dfd1526 --- /dev/null +++ b/src/main/java/co/jp/app/entity/UserEntity.java @@ -0,0 +1,42 @@ +package co.jp.app.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +@Entity +public class UserEntity { + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Id + private String name; + + private String email; + + private String password; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + +} \ No newline at end of file diff --git a/src/main/java/co/jp/app/repository/PetRepository.java b/src/main/java/co/jp/app/repository/PetRepository.java new file mode 100644 index 0000000..9c5b065 --- /dev/null +++ b/src/main/java/co/jp/app/repository/PetRepository.java @@ -0,0 +1,18 @@ +package co.jp.app.repository; + + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; + +import co.jp.app.entity.PetEntity; + +public interface PetRepository extends JpaRepository { + +@Override +default List findAllById(Iterable id) { + return findAllById(id); + } +} + + diff --git a/src/main/java/co/jp/app/repository/PetRepository.xml b/src/main/java/co/jp/app/repository/PetRepository.xml new file mode 100644 index 0000000..017bcfe --- /dev/null +++ b/src/main/java/co/jp/app/repository/PetRepository.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/co/jp/app/repository/erraRepository.java b/src/main/java/co/jp/app/repository/erraRepository.java new file mode 100644 index 0000000..2578e5a --- /dev/null +++ b/src/main/java/co/jp/app/repository/erraRepository.java @@ -0,0 +1,15 @@ +package co.jp.app.repository; + + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; + +import co.jp.app.entity.ErrorEntity; + + +public interface erraRepository extends JpaRepository{ + + public default ErrorEntity getById(@Param("id") int id) { + return getById(id); + } +} diff --git a/src/main/java/co/jp/app/repository/erraRepository.xml b/src/main/java/co/jp/app/repository/erraRepository.xml new file mode 100644 index 0000000..f331a98 --- /dev/null +++ b/src/main/java/co/jp/app/repository/erraRepository.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/co/jp/app/repository/userRepository.java b/src/main/java/co/jp/app/repository/userRepository.java new file mode 100644 index 0000000..8c89ccd --- /dev/null +++ b/src/main/java/co/jp/app/repository/userRepository.java @@ -0,0 +1,18 @@ +package co.jp.app.repository; + + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; + +import co.jp.app.entity.UserEntity; + +public interface userRepository extends JpaRepository { + + public default UserEntity getByName(@Param("name") String name) { + return getByName(name); + } + + public default UserEntity getByEmail(@Param("email")String email) { + return getByEmail(email); + } +} diff --git a/src/main/java/co/jp/app/repository/userRepository.xml b/src/main/java/co/jp/app/repository/userRepository.xml new file mode 100644 index 0000000..60fa3d2 --- /dev/null +++ b/src/main/java/co/jp/app/repository/userRepository.xml @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/java/co/jp/app/service/PetService.java b/src/main/java/co/jp/app/service/PetService.java new file mode 100644 index 0000000..97d6c7c --- /dev/null +++ b/src/main/java/co/jp/app/service/PetService.java @@ -0,0 +1,22 @@ +package co.jp.app.service; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import co.jp.app.entity.PetEntity; +import co.jp.app.repository.PetRepository; + + +@Service +public class PetService { + @Autowired + private PetRepository dao; + + public List getPetByID(Iterable id) { + + return dao.findAllById(id); + + } +} diff --git a/src/main/java/co/jp/app/service/erraService.java b/src/main/java/co/jp/app/service/erraService.java new file mode 100644 index 0000000..a8d57a1 --- /dev/null +++ b/src/main/java/co/jp/app/service/erraService.java @@ -0,0 +1,19 @@ +package co.jp.app.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import co.jp.app.entity.ErrorEntity; +import co.jp.app.repository.erraRepository; + + +@Service +public class erraService { + +@Autowired +erraRepository erraDao; + + public ErrorEntity getStatusById(int id) { + return erraDao.getById(id); + } +} diff --git a/src/main/java/co/jp/app/service/userService.java b/src/main/java/co/jp/app/service/userService.java new file mode 100644 index 0000000..a2f4797 --- /dev/null +++ b/src/main/java/co/jp/app/service/userService.java @@ -0,0 +1,25 @@ +package co.jp.app.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import co.jp.app.entity.UserEntity; +import co.jp.app.repository.userRepository; + + +@Service +public class userService { + + @Autowired + userRepository userdao; + + public UserEntity getNameByEntity(String name) { + return userdao.getByName(name); + + } + + public UserEntity getEmailByEntity(String email) { + return userdao.getByEmail(email); + + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..18fc601 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,10 @@ +spring.application.name=dog-1 +spring.sql.init.platform=mysql +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=true +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + +spring.datasource.url=jdbc:mysql://localhost:3306/mysql?serverTimezone=Asia/Tokyo +spring.datasource.username=root +spring.datasource.password=Jaichbin119 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver \ No newline at end of file diff --git a/src/main/resources/static/caJnmA6E_400x400.jpg b/src/main/resources/static/caJnmA6E_400x400.jpg new file mode 100644 index 0000000000000000000000000000000000000000..95908005342e4aacc0d1534883dc66627c429fab GIT binary patch literal 8314 zcmcIo2_TeR+di{dC;Qm5RLD{WNtO_0i!j!r7g>tzOHtN@H>oJvkZf5a71_cNO18=x zBb0_nSxVOVpBZI&KmYr`-~aWU=gc|xxzD+;dpXN)UhPDQP!2p0k4Fw;jY#{?_pn-dA-95b_S{0%Xo%VJo)6o#kW_!ZM4x-Z_TEY`D z5TaYj{A0`X2Qqzpnf^hhJ&ked0Km}@EpU99mLSu|mT9st0=6eSU7#_}5WUUC*$1+L zlE|K*?OjcbpqiKR^8z@a3Dkf9I0k%xBX9=ZUW2f2*a0RZ)$M4A!YdVYnw0}9?5H=Yfq;>*ed=>!RCID{T20$3n$7o6F0qOvSKq8R{ z6jY#4C@N|+4KFH_F%#187%#6&;tn9oTtZdvEW@b)7PVUW{`T6--Iks%u!nci= zkDreW0)s@Usi+xfXc+j|nA!OL?L?{u%rvlQSTq8*1;CkM2xb`R8Q_8T%yJ_8KuOe8 zG)OoK0d;ag8x29;Y^w=@M8V*sw*ZZR0XP$a37W)*!K>ZBfns3{JUPtL68{M)naNaf zS8XnY{_n^%pN78B`nzPsFnC2(p5}G#2f^ePB~cYkQI&sa#B8Iqn8e5EKKR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