first commit
This commit is contained in:
commit
101ba7ba66
33
.gitignore
vendored
Normal file
33
.gitignore
vendored
Normal file
@ -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/
|
308
mvnw
vendored
Normal file
308
mvnw
vendored
Normal file
@ -0,0 +1,308 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "$(uname)" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
|
||||
else
|
||||
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=$(java-config --jre-home)
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="$(which javac)"
|
||||
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=$(which readlink)
|
||||
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
|
||||
else
|
||||
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
|
||||
fi
|
||||
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=$(cd "$wdir/.." || exit 1; pwd)
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
# Remove \r in case we run on Windows within Git Bash
|
||||
# and check out the repository with auto CRLF management
|
||||
# enabled. Otherwise, we may read lines that are delimited with
|
||||
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
|
||||
# splitting rules.
|
||||
tr -s '\r\n' ' ' < "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
log() {
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
printf '%s\n' "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
|
||||
log "$MAVEN_PROJECTBASEDIR"
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if [ -r "$wrapperJarPath" ]; then
|
||||
log "Found $wrapperJarPath"
|
||||
else
|
||||
log "Couldn't find $wrapperJarPath, downloading it ..."
|
||||
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
else
|
||||
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
fi
|
||||
while IFS="=" read -r key value; do
|
||||
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
|
||||
safeValue=$(echo "$value" | tr -d '\r')
|
||||
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
log "Downloading from: $wrapperUrl"
|
||||
|
||||
if $cygwin; then
|
||||
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
log "Found wget ... using wget"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
log "Found curl ... using curl"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
else
|
||||
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
else
|
||||
log "Falling back to using Java to download"
|
||||
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaSource=$(cygpath --path --windows "$javaSource")
|
||||
javaClass=$(cygpath --path --windows "$javaClass")
|
||||
fi
|
||||
if [ -e "$javaSource" ]; then
|
||||
if [ ! -e "$javaClass" ]; then
|
||||
log " - Compiling MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/javac" "$javaSource")
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
log " - Running MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
wrapperSha256Sum=""
|
||||
while IFS="=" read -r key value; do
|
||||
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ -n "$wrapperSha256Sum" ]; then
|
||||
wrapperSha256Result=false
|
||||
if command -v sha256sum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
elif command -v shasum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
else
|
||||
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
|
||||
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
|
||||
exit 1
|
||||
fi
|
||||
if [ $wrapperSha256Result = false ]; then
|
||||
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
|
||||
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
|
||||
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
# shellcheck disable=SC2086 # safe args
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
205
mvnw.cmd
vendored
Normal file
205
mvnw.cmd
vendored
Normal file
@ -0,0 +1,205 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %WRAPPER_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
SET WRAPPER_SHA_256_SUM=""
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
|
||||
)
|
||||
IF NOT %WRAPPER_SHA_256_SUM%=="" (
|
||||
powershell -Command "&{"^
|
||||
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
|
||||
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
|
||||
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
|
||||
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
|
||||
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
|
||||
" exit 1;"^
|
||||
"}"^
|
||||
"}"
|
||||
if ERRORLEVEL 1 goto error
|
||||
)
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
89
pom.xml
Normal file
89
pom.xml
Normal file
@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.4.2</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>car-manage</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>demo</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.24</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.10.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>6.2.5.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.23</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.32</version> <!-- 根据您的需要选择版本 -->
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
15
src/main/java/com/luozhihui/CarManagerApplication.java
Normal file
15
src/main/java/com/luozhihui/CarManagerApplication.java
Normal file
@ -0,0 +1,15 @@
|
||||
package com.luozhihui;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.luozhihui.project.mapper")
|
||||
public class CarManagerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CarManagerApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
26
src/main/java/com/luozhihui/project/common/ApiResponse.java
Normal file
26
src/main/java/com/luozhihui/project/common/ApiResponse.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.luozhihui.project.common;
|
||||
//定义响应体
|
||||
public class ApiResponse {
|
||||
private Object data;
|
||||
private int status;
|
||||
private String message;
|
||||
|
||||
public ApiResponse(Object data, int status, String message) {
|
||||
this.data = data;
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.luozhihui.project.common;
|
||||
//定义登录响应体
|
||||
public class LoginResponse {
|
||||
private Object data;
|
||||
private Object token;
|
||||
private int status;
|
||||
private String message;
|
||||
|
||||
public LoginResponse(Object token,Object data, int status, String message) {
|
||||
this.token = token;
|
||||
this.data=data;
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
public Object getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
27
src/main/java/com/luozhihui/project/common/SmsBaoConfig.java
Normal file
27
src/main/java/com/luozhihui/project/common/SmsBaoConfig.java
Normal file
@ -0,0 +1,27 @@
|
||||
package com.luozhihui.project.common;
|
||||
//定义短信宝
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "smsbao")
|
||||
public class SmsBaoConfig {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.luozhihui.project.common;
|
||||
//定义响应体
|
||||
public class totalResponse {
|
||||
private Object data;
|
||||
private int status;
|
||||
private String message;
|
||||
private int total;
|
||||
|
||||
public totalResponse(Object data, int status, String message, Integer total) {
|
||||
this.data = data;
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
this.total=total;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
public int getTotal() {
|
||||
return total;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
//package com.luozhihui.project.config;//package com.example.demo.config;
|
||||
//import com.luozhihui.project.util.JwtUtil;
|
||||
//import org.springframework.web.servlet.HandlerInterceptor;
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
////jwt
|
||||
//public class UserLoginInterceptor implements HandlerInterceptor {
|
||||
// @Override
|
||||
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
// // 允许OPTIONS请求直接通过,不做任何处理
|
||||
// if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
|
||||
// response.setStatus(HttpServletResponse.SC_OK);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// // 以下是原有的token处理逻辑
|
||||
// String token = request.getHeader("Authorization");
|
||||
// if (token == null || token.isEmpty()) {
|
||||
// response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
// response.getWriter().write("Token is missing");
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// String sub = JwtUtil.validateToken(token);
|
||||
// if (sub == null || sub.isEmpty()) {
|
||||
// response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
// response.getWriter().write("Token is invalid");
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (JwtUtil.isNeedUpdate(token)) {
|
||||
// String newToken = JwtUtil.createToken(sub);
|
||||
// response.setHeader("Authorization", newToken);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
// response.getWriter().write("Token verification failed: " + e.getMessage());
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//}
|
31
src/main/java/com/luozhihui/project/config/WebMvcConfig.java
Normal file
31
src/main/java/com/luozhihui/project/config/WebMvcConfig.java
Normal file
@ -0,0 +1,31 @@
|
||||
//package com.luozhihui.project.config;
|
||||
//
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.web.servlet.config.annotation.*;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * 注册自定义拦截器
|
||||
// */
|
||||
//@Configuration
|
||||
//public class WebMvcConfig implements WebMvcConfigurer {
|
||||
// @Override
|
||||
// public void addInterceptors(InterceptorRegistry registry) {
|
||||
// // 注册 registration 拦截器
|
||||
// InterceptorRegistration registration = registry.addInterceptor(new UserLoginInterceptor());
|
||||
// // 拦截所有的路径
|
||||
// registration.addPathPatterns("/**");
|
||||
//
|
||||
// // 添加不拦截路径 /api/user/login 是登录的请求, /api/user/register 注册的请求
|
||||
// registration.excludePathPatterns(
|
||||
// //后台管理员登录
|
||||
// "/api/admin_login",
|
||||
// //用户登录
|
||||
// "/api/login",
|
||||
// //用户注册
|
||||
// "/api/user_register",
|
||||
//// //发送验证码
|
||||
// "/api/sendCode"
|
||||
// );
|
||||
// }
|
||||
//}
|
@ -0,0 +1,47 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.LoginResponse;
|
||||
import com.luozhihui.project.entity.Admin;
|
||||
import com.luozhihui.project.mapper.AdminLoginMapper;
|
||||
import com.luozhihui.project.util.JwtUtil;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class AdminLoginController {
|
||||
@Resource
|
||||
AdminLoginMapper adminLoginMapper;
|
||||
|
||||
public AdminLoginController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/admin_login"})
|
||||
public LoginResponse login(@RequestParam("AdminUser") String AdminUser, @RequestParam("AdminPassWord") String AdminPassWord) {
|
||||
List<Admin> userList = this.adminLoginMapper.findByPhone(AdminUser);
|
||||
System.out.println(userList);
|
||||
if (userList.isEmpty()) {
|
||||
return new LoginResponse((Object)null, (Object)null, 500, "用户不存在");
|
||||
} else {
|
||||
Admin admin = (Admin)userList.get(0);
|
||||
if (admin.getAdminPassWord().equals(AdminPassWord)) {
|
||||
JwtUtil jwtUtil = new JwtUtil();
|
||||
String token = JwtUtil.createToken(((Admin)userList.get(0)).getAdminUser());
|
||||
return new LoginResponse(token, (Object)null, 200, "登录成功");
|
||||
} else {
|
||||
return new LoginResponse((Object)null, (Object)null, 500, "密码错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.entity.Order;
|
||||
import com.luozhihui.project.mapper.CarRentMapper;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class CarRentController {
|
||||
@Resource
|
||||
CarRentMapper carRentMapper;
|
||||
|
||||
public CarRentController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/carRent"})
|
||||
public ApiResponse carRent(Order order) {
|
||||
try {
|
||||
this.carRentMapper.addorder(order);
|
||||
System.out.println(order.getCarId());
|
||||
this.carRentMapper.updateCarStatus(Integer.valueOf(order.getCarId()));
|
||||
return new ApiResponse((Object)null, 200, "车位租借成功");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/returnCar"})
|
||||
public ApiResponse returnCar(Order order) {
|
||||
try {
|
||||
this.carRentMapper.carRented(order);
|
||||
this.carRentMapper.finishOrder(order.getOrderId());
|
||||
this.carRentMapper.endCarStatus(order.getCarId(), order.getParking_id());
|
||||
return new ApiResponse((Object)null, 200, "还车成功");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.entity.Car;
|
||||
import com.luozhihui.project.mapper.CarShowMapper;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class CarShowController {
|
||||
@Resource
|
||||
CarShowMapper carShowMapper;
|
||||
|
||||
public CarShowController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/AllCar"})
|
||||
public ApiResponse AllCar() {
|
||||
try {
|
||||
List<Car> car = this.carShowMapper.FindAllCar();
|
||||
return car != null ? new ApiResponse(car, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到车辆");
|
||||
} catch (Exception var2) {
|
||||
Exception e = var2;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/FindCarById"})
|
||||
public ApiResponse FindCarById(Car car) {
|
||||
try {
|
||||
List<Car> cars = this.carShowMapper.FindCarById(car.getCarId());
|
||||
return cars != null && !cars.isEmpty() ? new ApiResponse(cars, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到车辆");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/AddCar"})
|
||||
public ApiResponse addCar(@RequestBody Car car) {
|
||||
try {
|
||||
this.carShowMapper.addCar(car);
|
||||
return new ApiResponse((Object)null, 200, "车辆添加成功");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/delete_car"})
|
||||
public ApiResponse delete_cars(@RequestBody Map<String, Object> requestBody) {
|
||||
try {
|
||||
String carIdsParam = (String)requestBody.get("carIds");
|
||||
List<String> carIdStrings = Arrays.asList(carIdsParam.split(","));
|
||||
List<Long> carIds = (List)carIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
|
||||
int deletedCount = 0;
|
||||
Iterator var6 = carIds.iterator();
|
||||
|
||||
while(var6.hasNext()) {
|
||||
Long carId = (Long)var6.next();
|
||||
boolean isDeleted = this.carShowMapper.DeleteCarById(String.valueOf(carId));
|
||||
if (isDeleted) {
|
||||
++deletedCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (deletedCount == carIds.size()) {
|
||||
return new ApiResponse((Object)null, 200, "删除成功");
|
||||
} else if (deletedCount == 0) {
|
||||
return new ApiResponse((Object)null, 404, "未找到车辆信息");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 207, "部分车辆删除成功");
|
||||
}
|
||||
} catch (Exception var9) {
|
||||
Exception e = var9;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/upcarinfo"})
|
||||
public ApiResponse updateCar(@RequestBody Car car) {
|
||||
System.out.println("-----------------------------------------");
|
||||
System.out.println(Integer.valueOf(car.getCarId()));
|
||||
|
||||
try {
|
||||
System.out.println(Integer.valueOf(car.getCarId()));
|
||||
Car existingCarinfo = this.carShowMapper.CarId(Integer.valueOf(car.getCarId()));
|
||||
System.out.println(existingCarinfo);
|
||||
if (existingCarinfo != null) {
|
||||
existingCarinfo.setCarContent(car.getCarContent());
|
||||
existingCarinfo.setCarPhoto(car.getCarPhoto());
|
||||
this.carShowMapper.update(existingCarinfo);
|
||||
return new ApiResponse((Object)null, 200, "车辆信息更新成功");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 404, "车辆不存在");
|
||||
}
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
return new ApiResponse(e.getMessage(), 500, "更新车辆信息发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/getCarsInParking"})
|
||||
public ApiResponse getCarsInParking(@RequestParam Integer parking_id) {
|
||||
if (parking_id == null) {
|
||||
return new ApiResponse((Object)null, 400, "停车场ID不能为空");
|
||||
} else {
|
||||
try {
|
||||
List<Car> result = this.carShowMapper.findCarsByParkingId(parking_id);
|
||||
return result.isEmpty() ? new ApiResponse((Object)null, 404, "车辆列表为空") : new ApiResponse(result, 200, "获取停车场列表成功");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
return new ApiResponse(e.getMessage(), 500, "服务器错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class CityController {
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
public CityController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/cityPicker"})
|
||||
public ResponseEntity<Object> getCity(@RequestParam MultiValueMap<String, String> formData) {
|
||||
String type = (String)formData.getFirst("type");
|
||||
if (type == null) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("请求中缺少 'type' 字段");
|
||||
} else {
|
||||
switch (type) {
|
||||
case "province":
|
||||
return this.getProvince();
|
||||
case "city":
|
||||
String provinceCode = (String)formData.getFirst("province_code");
|
||||
if (provinceCode == null) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("请求中缺少 'province_code' 字段");
|
||||
}
|
||||
|
||||
return this.getCity(provinceCode);
|
||||
case "area":
|
||||
String cityCode = (String)formData.getFirst("city_code");
|
||||
if (cityCode == null) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("请求中缺少 'city_code' 字段");
|
||||
}
|
||||
|
||||
return this.getArea(cityCode);
|
||||
default:
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("请求中的 'type' 字段无效");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ResponseEntity<Object> getProvince() {
|
||||
try {
|
||||
List<Map<String, Object>> result = this.jdbcTemplate.queryForList("SELECT * FROM `province`");
|
||||
return result.isEmpty() ? ResponseEntity.status(HttpStatus.NOT_FOUND).body("未找到省份数据") : ResponseEntity.ok(new ApiResponse(result, 200, "获取成功"));
|
||||
} catch (DataAccessException var2) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("获取省份数据时出错");
|
||||
}
|
||||
}
|
||||
|
||||
private ResponseEntity<Object> getCity(String provinceCode) {
|
||||
try {
|
||||
String sql = "SELECT * FROM `city` WHERE city_code LIKE ?";
|
||||
String provinceCodePrefix = provinceCode.substring(0, 2) + "%";
|
||||
List<Map<String, Object>> result = this.jdbcTemplate.queryForList(sql, new Object[]{provinceCodePrefix});
|
||||
return result.isEmpty() ? ResponseEntity.status(HttpStatus.NOT_FOUND).body("未找到所提供省份代码的城市数据") : ResponseEntity.ok(new ApiResponse(result, 200, "获取成功"));
|
||||
} catch (DataAccessException var5) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("获取城市数据时出错");
|
||||
}
|
||||
}
|
||||
|
||||
private ResponseEntity<Object> getArea(String cityCode) {
|
||||
try {
|
||||
String sql = "SELECT * FROM `area` WHERE area_code LIKE ?";
|
||||
String cityCodePrefix = cityCode.substring(0, 4) + "%";
|
||||
List<Map<String, Object>> result = this.jdbcTemplate.queryForList(sql, new Object[]{cityCodePrefix});
|
||||
if (result.isEmpty()) {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("未找到所提供城市代码的区县数据");
|
||||
} else {
|
||||
result.forEach((row) -> {
|
||||
String areaName = (String)row.get("area_name");
|
||||
row.put("area_name", areaName.trim());
|
||||
});
|
||||
return ResponseEntity.ok(new ApiResponse(result, 200, "获取成功"));
|
||||
}
|
||||
} catch (DataAccessException var5) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("获取区县数据时出错");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.entity.Comment;
|
||||
import com.luozhihui.project.mapper.CommentMapper;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class CommentController {
|
||||
@Resource
|
||||
CommentMapper commentMapper;
|
||||
|
||||
public CommentController() {
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/comment"})
|
||||
public ApiResponse postComment(Comment comment) {
|
||||
this.commentMapper.save(comment);
|
||||
return new ApiResponse((Object)null, 200, "发布成功");
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/AllComment"})
|
||||
public ApiResponse AllComment() {
|
||||
try {
|
||||
List<Comment> comment = this.commentMapper.FindAllComment();
|
||||
return comment != null ? new ApiResponse(comment, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到");
|
||||
} catch (Exception var2) {
|
||||
Exception e = var2;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.entity.Category;
|
||||
import com.luozhihui.project.entity.Post;
|
||||
import com.luozhihui.project.entity.Reply;
|
||||
import com.luozhihui.project.mapper.PostMapper;
|
||||
import com.luozhihui.project.mapper.ReplyMapper;
|
||||
import com.luozhihui.project.mapper.CategoryMapper;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api/forum"})
|
||||
@CrossOrigin
|
||||
public class ForumController {
|
||||
@Resource
|
||||
PostMapper postMapper;
|
||||
@Resource
|
||||
CategoryMapper categoryMapper;
|
||||
@Resource
|
||||
ReplyMapper replyMapper;
|
||||
|
||||
public ForumController() {
|
||||
}
|
||||
|
||||
@GetMapping({"/categories"})
|
||||
public ApiResponse listCategories() {
|
||||
try {
|
||||
List<Category> categories = this.categoryMapper.findAllCategories();
|
||||
return new ApiResponse(categories, 200, "获取分类成功");
|
||||
} catch (Exception var2) {
|
||||
return new ApiResponse((Object)null, 500, "服务器错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@GetMapping({"/posts"})
|
||||
public ApiResponse listPosts(@RequestParam(required = false) Long categoryId, @RequestParam(required = false) String searchText, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int size) {
|
||||
try {
|
||||
int offset = (page - 1) * size;
|
||||
List<Post> posts = this.postMapper.selectPostList(categoryId, searchText, offset, size);
|
||||
int total = this.postMapper.countPosts(categoryId, searchText);
|
||||
System.out.println(posts);
|
||||
System.out.println(total);
|
||||
Map<String, Object> result = new HashMap();
|
||||
result.put("records", posts);
|
||||
result.put("total", total);
|
||||
result.put("size", size);
|
||||
result.put("current", page);
|
||||
return new ApiResponse(result, 200, "获取帖子列表成功");
|
||||
} catch (Exception var9) {
|
||||
return new ApiResponse((Object)null, 500, "服务器错误");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/posts/{id}"})
|
||||
public ApiResponse getPost(@PathVariable Long id) {
|
||||
try {
|
||||
Post post = this.postMapper.selectById(id);
|
||||
if (post == null) {
|
||||
return new ApiResponse((Object)null, 404, "帖子不存在");
|
||||
} else {
|
||||
post.setViewCount(post.getViewCount() + 1);
|
||||
this.postMapper.updateById(post);
|
||||
return new ApiResponse(post, 200, "获取帖子成功");
|
||||
}
|
||||
} catch (Exception var3) {
|
||||
return new ApiResponse((Object)null, 500, "服务器错误");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/post"})
|
||||
public ApiResponse createPost(@RequestParam String title, @RequestParam String content, @RequestParam Integer categoryId, @RequestParam Integer userId) {
|
||||
try {
|
||||
Post post = new Post();
|
||||
post.setTitle(title);
|
||||
post.setContent(content);
|
||||
post.setCategoryId(String.valueOf((long)categoryId));
|
||||
post.setUserId(String.valueOf((long)userId));
|
||||
post.setViewCount(Integer.valueOf(String.valueOf(0)));
|
||||
post.setLikeCount(Integer.valueOf(String.valueOf(0)));
|
||||
post.setReplyCount(Integer.valueOf(String.valueOf(0)));
|
||||
post.setStatus(String.valueOf(1));
|
||||
int result = this.postMapper.insert(post);
|
||||
return result > 0 ? new ApiResponse(post.getId(), 200, "创建帖子成功") : new ApiResponse((Object)null, 500, "创建帖子失败");
|
||||
} catch (Exception var7) {
|
||||
return new ApiResponse((Object)null, 500, "服务器错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@DeleteMapping({"/delePost/{id}"})
|
||||
public ApiResponse deletePost(@PathVariable Long id) {
|
||||
try {
|
||||
int result = this.postMapper.deletePost(id);
|
||||
return result > 0 ? new ApiResponse((Object)null, 200, "删除成功") : new ApiResponse((Object)null, 500, "删除失败");
|
||||
} catch (Exception var3) {
|
||||
return new ApiResponse((Object)null, 500, "服务器错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@GetMapping({"/posts/{postId}/replies"})
|
||||
public ApiResponse listReplies(@PathVariable Long postId) {
|
||||
System.out.println(postId);
|
||||
|
||||
try {
|
||||
List<Reply> replies = this.replyMapper.selectRepliesByPostId(postId);
|
||||
return new ApiResponse(replies, 200, "获取回复成功");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
return new ApiResponse(e, 500, "服务器错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/posts/{postId}/repliesed"})
|
||||
public ApiResponse createReply(@PathVariable Long postId, @RequestParam("userId") Long userId, @RequestParam("content") String content) {
|
||||
try {
|
||||
Reply reply = new Reply();
|
||||
reply.setPostId(postId);
|
||||
reply.setContent(content);
|
||||
reply.setUserId(userId);
|
||||
reply.setStatus(String.valueOf(1));
|
||||
System.out.println(postId);
|
||||
System.out.println(content);
|
||||
System.out.println(userId);
|
||||
int result = this.replyMapper.insertReply(reply);
|
||||
return result > 0 ? new ApiResponse(reply, 200, "回复成功") : new ApiResponse((Object)null, 500, "回复失败");
|
||||
} catch (Exception var6) {
|
||||
Exception e = var6;
|
||||
return new ApiResponse(e, 500, "服务器错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping({"/replies/{id}"})
|
||||
public ApiResponse updateReply(@PathVariable Long id, @RequestBody Reply reply) {
|
||||
try {
|
||||
reply.setId(id);
|
||||
int result = this.replyMapper.updateReply(reply);
|
||||
return result > 0 ? new ApiResponse(reply, 200, "修改成功") : new ApiResponse((Object)null, 500, "修改失败");
|
||||
} catch (Exception var4) {
|
||||
return new ApiResponse((Object)null, 500, "服务器错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@DeleteMapping({"/replies/{id}"})
|
||||
public ApiResponse deleteReply(@PathVariable Long id) {
|
||||
try {
|
||||
int result = this.replyMapper.deleteReply(id);
|
||||
return result > 0 ? new ApiResponse((Object)null, 200, "删除成功") : new ApiResponse((Object)null, 500, "删除失败");
|
||||
} catch (Exception var3) {
|
||||
return new ApiResponse((Object)null, 500, "服务器错误");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Controller
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class GetCountController {
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
public GetCountController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/getcount"})
|
||||
@ResponseBody
|
||||
public Map<String, Object> getCount() {
|
||||
final Map<String, Object> data = new HashMap();
|
||||
|
||||
try {
|
||||
Double totalMoney = (Double)this.jdbcTemplate.queryForObject("SELECT SUM(OrderMoney) AS total_money FROM `order` where OrderStatus = 1", Double.class);
|
||||
data.put("total_money", totalMoney != null ? totalMoney : 0.0);
|
||||
Map<String, Object> orderResult = this.jdbcTemplate.queryForMap("SELECT COUNT(OrderMoney) AS total_orders, SUM(OrderMoney) AS total_moneys FROM `order`");
|
||||
data.put("total_orders", orderResult.get("total_orders"));
|
||||
data.put("total_moneys", orderResult.get("total_moneys"));
|
||||
Map<String, Object> todaySuccessResult = this.jdbcTemplate.queryForMap("SELECT COUNT(OrderMoney) AS today_amount, SUM(OrderMoney) AS today_total_money FROM `order` WHERE InTime >= CURDATE() AND OrderStatus = 1");
|
||||
data.put("today_amount", todaySuccessResult.get("today_amount"));
|
||||
data.put("today_total_money", todaySuccessResult.get("today_total_money"));
|
||||
Map<String, Object> todayFailResult = this.jdbcTemplate.queryForMap("SELECT COUNT(OrderMoney) AS today2_amount , SUM(OrderMoney) AS today2_total_money FROM `order` WHERE InTime >= CURDATE() AND OrderStatus = 0");
|
||||
data.put("today2_amount", todayFailResult.get("today2_amount"));
|
||||
data.put("today2_total_money", todayFailResult.get("today2_total_money"));
|
||||
Map<String, Object> yesterdaySuccessResult = this.jdbcTemplate.queryForMap("SELECT COUNT(OrderMoney) AS yes_amount, SUM(OrderMoney) AS yesday_total_money FROM `order` WHERE InTime >= CURDATE() - INTERVAL 1 DAY AND InTime < CURDATE() AND OrderStatus = 1");
|
||||
data.put("yes_amount", yesterdaySuccessResult.get("yes_amount"));
|
||||
data.put("yesday_total_money", yesterdaySuccessResult.get("yesday_total_money"));
|
||||
Map<String, Object> yesterdayFailResult = this.jdbcTemplate.queryForMap("SELECT COUNT(OrderMoney) AS yes2_amount FROM `order` WHERE InTime >= CURDATE() - INTERVAL 1 DAY AND InTime < CURDATE() AND OrderStatus = 0");
|
||||
data.put("yes2_amount", yesterdayFailResult.get("yes2_amount"));
|
||||
Double todayTotalDay = (Double)this.jdbcTemplate.queryForObject("SELECT SUM(OrderMoney) AS today_total_day FROM `order` WHERE InTime >= CURDATE() AND OrderStatus = 1 AND Mode = 1", Double.class);
|
||||
data.put("today_total_day", todayTotalDay != null ? todayTotalDay : 0.0);
|
||||
Double todayTotalHour = (Double)this.jdbcTemplate.queryForObject("SELECT SUM(OrderMoney) AS today_total_hour FROM `order` WHERE InTime >= CURDATE() AND OrderStatus = 1 AND Mode = 0", Double.class);
|
||||
data.put("today_total_hour", todayTotalHour != null ? todayTotalHour : 0.0);
|
||||
Double totalUser = (Double)this.jdbcTemplate.queryForObject("SELECT COUNT(UserId) AS total_user FROM `user` ", Double.class);
|
||||
data.put("total_user", totalUser != null ? totalUser : 0.0);
|
||||
Double totalCar = (Double)this.jdbcTemplate.queryForObject("SELECT COUNT(CarId) AS total_car FROM `car` ", Double.class);
|
||||
data.put("total_car", totalCar != null ? totalCar : 0.0);
|
||||
return new HashMap<String, Object>() {
|
||||
{
|
||||
this.put("status", 1);
|
||||
this.put("message", "获取成功!");
|
||||
this.put("data", data);
|
||||
}
|
||||
};
|
||||
} catch (Exception var12) {
|
||||
final Exception e = var12;
|
||||
e.printStackTrace();
|
||||
return new HashMap<String, Object>() {
|
||||
{
|
||||
this.put("status", 200);
|
||||
this.put("message", e.getMessage());
|
||||
this.put("data", (Object)null);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.common.totalResponse;
|
||||
import com.luozhihui.project.entity.Mode;
|
||||
import com.luozhihui.project.mapper.ModeMapper;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class ModeController {
|
||||
@Resource
|
||||
ModeMapper modeMapper;
|
||||
|
||||
public ModeController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/AllModepage"})
|
||||
public totalResponse AllBrand(@RequestParam int pageNumber, @RequestParam int pageSize) {
|
||||
try {
|
||||
List<Mode> mode = this.modeMapper.FindAllModepage((pageNumber - 1) * pageSize, pageSize);
|
||||
int total = this.modeMapper.countMode();
|
||||
return mode != null ? new totalResponse(mode, 200, "查询成功", total) : new totalResponse((Object)null, 404, "未找到该套餐", (Integer)null);
|
||||
} catch (Exception var5) {
|
||||
Exception e = var5;
|
||||
e.printStackTrace();
|
||||
return new totalResponse(e.getMessage(), 500, "服务器内部错误", (Integer)null);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/AllMode"})
|
||||
public ApiResponse AllBrandpage() {
|
||||
try {
|
||||
List<Mode> mode = this.modeMapper.FindAllMode();
|
||||
return mode != null ? new ApiResponse(mode, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到套餐");
|
||||
} catch (Exception var2) {
|
||||
Exception e = var2;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse(e.getMessage(), 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/FindModeById"})
|
||||
public ApiResponse FindBrandById(@RequestParam("id") Long id) {
|
||||
try {
|
||||
Mode mode = (Mode)this.modeMapper.FindModedById(String.valueOf(id));
|
||||
return mode != null ? new ApiResponse(mode, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到品牌信息");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@GetMapping({"/getPid"})
|
||||
public ApiResponse FindModeByParkingId(@RequestParam("parking_id") Long parkingId) {
|
||||
try {
|
||||
List<Mode> modes = this.modeMapper.FindModedByParkingId(String.valueOf(parkingId));
|
||||
System.out.println(modes);
|
||||
return modes != null && !modes.isEmpty() ? new ApiResponse(modes, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到品牌信息");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/AddMode"})
|
||||
public ApiResponse AddBrand(@RequestBody Mode mode) {
|
||||
try {
|
||||
this.modeMapper.addMode(mode);
|
||||
return new ApiResponse((Object)null, 200, "添加成功");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse(e.getMessage(), 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/delete_mode"})
|
||||
public ApiResponse delete_brand(@RequestBody Map<String, Object> requestBody) {
|
||||
try {
|
||||
String carIdsParam = (String)requestBody.get("ids");
|
||||
List<String> carIdStrings = Arrays.asList(carIdsParam.split(","));
|
||||
List<Long> carIds = (List)carIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
|
||||
int deletedCount = 0;
|
||||
Iterator var6 = carIds.iterator();
|
||||
|
||||
while(var6.hasNext()) {
|
||||
Long carId = (Long)var6.next();
|
||||
boolean isDeleted = this.modeMapper.DeleteModeById(String.valueOf(carId));
|
||||
if (isDeleted) {
|
||||
++deletedCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (deletedCount == carIds.size()) {
|
||||
return new ApiResponse((Object)null, 200, "删除成功");
|
||||
} else if (deletedCount == 0) {
|
||||
return new ApiResponse((Object)null, 404, "未找到信息");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 207, "部分删除成功");
|
||||
}
|
||||
} catch (Exception var9) {
|
||||
Exception e = var9;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/upmodeinfo"})
|
||||
public ApiResponse updateCar(@RequestBody Mode mode) {
|
||||
System.out.println(mode.getModeId());
|
||||
System.out.println("-------------------------------");
|
||||
|
||||
try {
|
||||
Mode existingBrandinfo = this.modeMapper.ModeId(mode.getModeId());
|
||||
System.out.println(existingBrandinfo);
|
||||
System.out.println(mode.getModeId());
|
||||
if (existingBrandinfo != null) {
|
||||
existingBrandinfo.setBetMoney(mode.getBetMoney());
|
||||
existingBrandinfo.setDescription(mode.getDescription());
|
||||
existingBrandinfo.setDayMoney(mode.getDayMoney());
|
||||
existingBrandinfo.setHourMoney(mode.getHourMoney());
|
||||
existingBrandinfo.setModeId(mode.getModeId());
|
||||
existingBrandinfo.setMonthMoney(mode.getMonthMoney());
|
||||
existingBrandinfo.setParking_id(mode.getParking_id());
|
||||
existingBrandinfo.setModeName(mode.getModeName());
|
||||
existingBrandinfo.setModeImg(mode.getModeImg());
|
||||
existingBrandinfo.setModeNum(mode.getModeNum());
|
||||
this.modeMapper.update(existingBrandinfo);
|
||||
return new ApiResponse((Object)null, 200, "品牌信息更新成功");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 404, "品牌不存在");
|
||||
}
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
return new ApiResponse(e.getMessage(), 500, "更新品牌信息发生异常");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
public class OrderMoneyController {
|
||||
public OrderMoneyController() {
|
||||
}
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.common.totalResponse;
|
||||
import com.luozhihui.project.entity.Order;
|
||||
import com.luozhihui.project.mapper.OrderShowMapper;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class OrderShowController {
|
||||
@Resource
|
||||
OrderShowMapper orderShowMapper;
|
||||
|
||||
public OrderShowController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/AllOrder"})
|
||||
public ApiResponse AllCar() {
|
||||
try {
|
||||
List<Order> order = this.orderShowMapper.FindAllOrder();
|
||||
return order != null ? new ApiResponse(order, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到订单");
|
||||
} catch (Exception var2) {
|
||||
Exception e = var2;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/getorder"})
|
||||
public ApiResponse OrderTotal() {
|
||||
try {
|
||||
List<Order> order = this.orderShowMapper.GetOrder();
|
||||
return order != null ? new ApiResponse(order, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到车辆");
|
||||
} catch (Exception var2) {
|
||||
Exception e = var2;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/delete_order"})
|
||||
public ApiResponse delete_order(@RequestBody Map<String, Object> requestBody) {
|
||||
try {
|
||||
String orderIdsParam = (String)requestBody.get("orderIds");
|
||||
List<String> orderIdStrings = Arrays.asList(orderIdsParam.split(","));
|
||||
List<Long> orderIds = (List)orderIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
|
||||
int deletedCount = 0;
|
||||
Iterator var6 = orderIds.iterator();
|
||||
|
||||
while(var6.hasNext()) {
|
||||
Long orderId = (Long)var6.next();
|
||||
boolean isDeleted = this.orderShowMapper.DeleteOrderById(String.valueOf(orderId));
|
||||
if (isDeleted) {
|
||||
++deletedCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (deletedCount == orderIds.size()) {
|
||||
return new ApiResponse((Object)null, 200, "删除成功");
|
||||
} else if (deletedCount == 0) {
|
||||
return new ApiResponse((Object)null, 404, "未找到订单信息");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 207, "部分订单删除成功");
|
||||
}
|
||||
} catch (Exception var9) {
|
||||
Exception e = var9;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/FindOrderById"})
|
||||
public totalResponse findOrderById(@RequestParam Integer userId, @RequestParam int pageNumber, @RequestParam int pageSize) {
|
||||
try {
|
||||
if (userId == null) {
|
||||
return new totalResponse((Object)null, 400, "订单信息不完整", (Integer)null);
|
||||
} else {
|
||||
List<Order> orders = this.orderShowMapper.findOrdersByUserId(userId, (pageNumber - 1) * pageSize, pageSize);
|
||||
int total = this.orderShowMapper.countOrdersByUserId(String.valueOf(userId));
|
||||
if (orders != null && !orders.isEmpty()) {
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
Iterator var7 = orders.iterator();
|
||||
|
||||
while(var7.hasNext()) {
|
||||
Order o = (Order)var7.next();
|
||||
LocalDateTime outTime;
|
||||
if (o.getInTime() != null) {
|
||||
outTime = o.getInTime().atZone(zoneId).toLocalDateTime();
|
||||
o.setInTime(outTime);
|
||||
}
|
||||
|
||||
if (o.getOutTime() != null) {
|
||||
outTime = o.getOutTime().atZone(zoneId).toLocalDateTime();
|
||||
o.setOutTime(outTime);
|
||||
}
|
||||
}
|
||||
|
||||
return new totalResponse(orders, 200, "查询成功", total);
|
||||
} else {
|
||||
return new totalResponse((Object)null, 404, "未找到订单", (Integer)null);
|
||||
}
|
||||
}
|
||||
} catch (Exception var10) {
|
||||
Exception e = var10;
|
||||
e.printStackTrace();
|
||||
return new totalResponse((Object)null, 500, "服务器内部错误", (Integer)null);
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/uporderinfo"})
|
||||
public ApiResponse updateOrder(@RequestBody Order order) {
|
||||
try {
|
||||
int orderId = Integer.parseInt(order.getOrderId());
|
||||
System.out.println(orderId);
|
||||
Order existingOrderinfo = this.orderShowMapper.OrderId(orderId);
|
||||
System.out.println(existingOrderinfo);
|
||||
if (existingOrderinfo != null) {
|
||||
existingOrderinfo.setOrderMoney(order.getOrderMoney());
|
||||
existingOrderinfo.setOrderStatus(order.getOrderStatus());
|
||||
this.orderShowMapper.update(existingOrderinfo);
|
||||
return new ApiResponse((Object)null, 200, "订单信息更新成功");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 404, "订单不存在");
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
Exception e = var4;
|
||||
return new ApiResponse(e.getMessage(), 500, "更新车辆信息发生异常");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.entity.Pact;
|
||||
import com.luozhihui.project.mapper.PactShowMapper;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class PactShowController {
|
||||
@Resource
|
||||
PactShowMapper pactShowMapper;
|
||||
|
||||
public PactShowController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/AllPact"})
|
||||
public ApiResponse AllCar() {
|
||||
try {
|
||||
List<Pact> pact = this.pactShowMapper.FindAllPact();
|
||||
return pact != null ? new ApiResponse(pact, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到合同信息");
|
||||
} catch (Exception var2) {
|
||||
Exception e = var2;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/FindPactById"})
|
||||
public ApiResponse FindCarById(Pact pact) {
|
||||
try {
|
||||
List<Pact> pacts = this.pactShowMapper.FindPactById(pact.getUserId());
|
||||
return pacts != null && !pacts.isEmpty() ? new ApiResponse(pacts, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到合同信息");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/FindPactByPactId"})
|
||||
public ApiResponse FindPactById(Pact pact) {
|
||||
try {
|
||||
List<Pact> pacts = this.pactShowMapper.FindPactByPactId(String.valueOf(pact.getPactId()));
|
||||
return pacts != null && !pacts.isEmpty() ? new ApiResponse(pacts, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到合同信息");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.entity.Parking;
|
||||
import com.luozhihui.project.mapper.ParkingMapper;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
public class ParkingController {
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
@Resource
|
||||
ParkingMapper parkingMapper;
|
||||
|
||||
public ParkingController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/webParking"})
|
||||
@CrossOrigin
|
||||
public ApiResponse webParking() {
|
||||
String sql = "SELECT `parking`.id, parkingName, coord, COUNT(`car`.`parking_id`) as carsNumber FROM `parking`, `car` WHERE parking.enable = 1 GROUP BY parking.id";
|
||||
List<Map<String, Object>> result = this.jdbcTemplate.queryForList(sql);
|
||||
if (result.isEmpty()) {
|
||||
return new ApiResponse((Object)null, 404, "停车场为空");
|
||||
} else {
|
||||
Iterator var3 = result.iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
Map<String, Object> row = (Map)var3.next();
|
||||
String parkingId = row.get("id").toString();
|
||||
String countSql = "SELECT COUNT(parking_id) as carsNumber FROM car WHERE parking_id = ?";
|
||||
int carsNumber = (Integer)this.jdbcTemplate.queryForObject(countSql, Integer.class, new Object[]{parkingId});
|
||||
row.put("carsNumber", carsNumber);
|
||||
}
|
||||
|
||||
return new ApiResponse(result, 200, "停车场获取成功");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/AllParking"})
|
||||
public ApiResponse AllParking() {
|
||||
try {
|
||||
List<Parking> parking = this.parkingMapper.FindAllParking();
|
||||
return parking != null ? new ApiResponse(parking, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到停车场");
|
||||
} catch (Exception var2) {
|
||||
Exception e = var2;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse(e.getMessage(), 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/FindParkingById"})
|
||||
public ApiResponse FindParkingById(@RequestParam("id") Long id) {
|
||||
try {
|
||||
Parking parking = (Parking)this.parkingMapper.FindParkingById(String.valueOf(id));
|
||||
return parking != null ? new ApiResponse(parking, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到停车场信息");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/AddParking"})
|
||||
public ApiResponse AddBrand(@RequestBody Parking parking) {
|
||||
try {
|
||||
this.parkingMapper.addParking(parking);
|
||||
return new ApiResponse((Object)null, 200, "停车场添加成功");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse(e.getMessage(), 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/delete_parking"})
|
||||
public ApiResponse delete_parking(@RequestBody Map<String, Object> requestBody) {
|
||||
try {
|
||||
String carIdsParam = (String)requestBody.get("ids");
|
||||
List<String> carIdStrings = Arrays.asList(carIdsParam.split(","));
|
||||
List<Long> carIds = (List)carIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
|
||||
int deletedCount = 0;
|
||||
Iterator var6 = carIds.iterator();
|
||||
|
||||
while(var6.hasNext()) {
|
||||
Long carId = (Long)var6.next();
|
||||
boolean isDeleted = this.parkingMapper.DeleteParkingById(String.valueOf(carId));
|
||||
if (isDeleted) {
|
||||
++deletedCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (deletedCount == carIds.size()) {
|
||||
return new ApiResponse((Object)null, 200, "删除成功");
|
||||
} else if (deletedCount == 0) {
|
||||
return new ApiResponse((Object)null, 404, "未找到信息");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 207, "部分删除成功");
|
||||
}
|
||||
} catch (Exception var9) {
|
||||
Exception e = var9;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/upparkinginfo"})
|
||||
public ApiResponse updateCar(@RequestBody Parking parking) {
|
||||
System.out.println(parking.getId());
|
||||
System.out.println("-------------------------------");
|
||||
|
||||
try {
|
||||
Parking existingParkinginfo = this.parkingMapper.ParkingId(parking.getId());
|
||||
System.out.println(existingParkinginfo);
|
||||
if (existingParkinginfo != null) {
|
||||
existingParkinginfo.setAddress(parking.getAddress());
|
||||
existingParkinginfo.setCarsNumber(parking.getCarsNumber());
|
||||
existingParkinginfo.setCoord(parking.getCoord());
|
||||
existingParkinginfo.setEnable(parking.getEnable());
|
||||
existingParkinginfo.setType(parking.getType());
|
||||
existingParkinginfo.setParkingName(parking.getParkingName());
|
||||
this.parkingMapper.update(existingParkinginfo);
|
||||
return new ApiResponse((Object)null, 200, "停车场信息更新成功");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 404, "品牌不存在");
|
||||
}
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
return new ApiResponse(e.getMessage(), 500, "更新信息发生异常");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.common.SmsBaoConfig;
|
||||
import com.luozhihui.project.entity.Phone;
|
||||
import com.luozhihui.project.mapper.PhoneMapper;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Random;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping({"/api"})
|
||||
public class PhoneSendCodeController {
|
||||
@Resource
|
||||
PhoneMapper phoneMapper;
|
||||
@Autowired
|
||||
private SmsBaoConfig smsBaoConfig;
|
||||
|
||||
public PhoneSendCodeController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/sendCode"})
|
||||
public ResponseEntity<ApiResponse> sendCode(@RequestParam String Phone) {
|
||||
if (!this.isValidPhoneNumber(Phone)) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ApiResponse((Object)null, HttpStatus.BAD_REQUEST.value(), "不合法的数字"));
|
||||
} else {
|
||||
String randomCode = this.generateRandomCode();
|
||||
boolean sendStatus = this.sendSms(Phone, randomCode);
|
||||
return sendStatus ? ResponseEntity.ok(new ApiResponse((Object)null, HttpStatus.OK.value(), "验证码发送成功")) : ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ApiResponse((Object)null, HttpStatus.INTERNAL_SERVER_ERROR.value(), "验证码发送失败"));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidPhoneNumber(String Phone) {
|
||||
return Phone != null && Phone.length() == 11 && Phone.matches("\\d+");
|
||||
}
|
||||
|
||||
private String generateRandomCode() {
|
||||
Random random = new Random();
|
||||
int code = random.nextInt(9000) + 1000;
|
||||
return String.valueOf(code);
|
||||
}
|
||||
|
||||
private boolean sendSms(String Phone, String code) {
|
||||
try {
|
||||
String username = this.smsBaoConfig.getUsername();
|
||||
String password = this.smsBaoConfig.getPassword();
|
||||
String content = "【曙光网络】您的验证码为" + code + "在30分钟内有效。";
|
||||
String smsBaoUrl = "http://api.smsbao.com/sms";
|
||||
String httpArg = "u=" + username + "&p=" + this.md5(password) + "&m=" + Phone + "&c=" + this.encodeUrlString(content, "UTF-8");
|
||||
String result = this.request(smsBaoUrl, httpArg);
|
||||
if (result != null && result.equals("0")) {
|
||||
this.saveVerificationCode(Phone, code);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception var9) {
|
||||
Exception e = var9;
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private String request(String smsBaoUrl, String httpArg) {
|
||||
BufferedReader reader = null;
|
||||
String result = null;
|
||||
StringBuffer sbf = new StringBuffer();
|
||||
smsBaoUrl = smsBaoUrl + "?" + httpArg;
|
||||
|
||||
try {
|
||||
URL url = new URL(smsBaoUrl);
|
||||
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.connect();
|
||||
InputStream is = connection.getInputStream();
|
||||
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
String strRead = reader.readLine();
|
||||
if (strRead != null) {
|
||||
sbf.append(strRead);
|
||||
|
||||
while((strRead = reader.readLine()) != null) {
|
||||
sbf.append("\n");
|
||||
sbf.append(strRead);
|
||||
}
|
||||
}
|
||||
|
||||
reader.close();
|
||||
result = sbf.toString();
|
||||
} catch (Exception var10) {
|
||||
Exception e = var10;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private String md5(String password) {
|
||||
StringBuffer buf = null;
|
||||
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(password.getBytes());
|
||||
byte[] b = md.digest();
|
||||
buf = new StringBuffer("");
|
||||
|
||||
for(int offset = 0; offset < b.length; ++offset) {
|
||||
int i = b[offset];
|
||||
if (i < 0) {
|
||||
i += 256;
|
||||
}
|
||||
|
||||
if (i < 16) {
|
||||
buf.append("0");
|
||||
}
|
||||
|
||||
buf.append(Integer.toHexString(i));
|
||||
}
|
||||
} catch (NoSuchAlgorithmException var7) {
|
||||
NoSuchAlgorithmException e = var7;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private String encodeUrlString(String content, String charset) {
|
||||
String strret = null;
|
||||
if (content == null) {
|
||||
return content;
|
||||
} else {
|
||||
try {
|
||||
strret = URLEncoder.encode(content, charset);
|
||||
} catch (UnsupportedEncodingException var5) {
|
||||
UnsupportedEncodingException e = var5;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return strret;
|
||||
}
|
||||
}
|
||||
|
||||
private void saveVerificationCode(String Phone, String code) {
|
||||
Phone phone = new Phone();
|
||||
phone.setPhone(Phone);
|
||||
phone.setCode(code);
|
||||
this.phoneMapper.save(phone);
|
||||
}
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.entity.Repair;
|
||||
import com.luozhihui.project.mapper.RepairShowMapper;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class RepairShowController {
|
||||
@Resource
|
||||
RepairShowMapper repairShowMapper;
|
||||
|
||||
public RepairShowController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/AllRepair"})
|
||||
public ApiResponse AllCar() {
|
||||
try {
|
||||
List<Repair> repair = this.repairShowMapper.FindAllRepair();
|
||||
return repair != null ? new ApiResponse(repair, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到车辆");
|
||||
} catch (Exception var2) {
|
||||
Exception e = var2;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/AddRepair"})
|
||||
public ApiResponse addRepair(@RequestBody Repair repair) {
|
||||
try {
|
||||
this.repairShowMapper.addRepair(repair);
|
||||
this.repairShowMapper.updateCarStatusToRepair(repair.getCarId());
|
||||
return new ApiResponse((Object)null, 200, "维修信息添加成功");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/delete_repair"})
|
||||
public ApiResponse delete_repairs(@RequestBody Map<String, Object> requestBody) {
|
||||
try {
|
||||
String repairIdsInt = (String)requestBody.get("repairIds");
|
||||
String repairIdsParam = repairIdsInt;
|
||||
List<String> repairIdStrings = Arrays.asList(repairIdsParam.split(","));
|
||||
List<Long> repairIds = (List)repairIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
|
||||
int deletedCount = 0;
|
||||
Iterator var7 = repairIds.iterator();
|
||||
|
||||
while(var7.hasNext()) {
|
||||
Long repairId = (Long)var7.next();
|
||||
boolean isDeleted = this.repairShowMapper.DeleteRepairById(String.valueOf(repairId));
|
||||
if (isDeleted) {
|
||||
++deletedCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (deletedCount == repairIds.size()) {
|
||||
return new ApiResponse((Object)null, 200, "删除成功");
|
||||
} else if (deletedCount == 0) {
|
||||
return new ApiResponse((Object)null, 404, "未找到维修信息");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 207, "部分维修信息删除成功");
|
||||
}
|
||||
} catch (Exception var10) {
|
||||
Exception e = var10;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse(e.getMessage(), 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/uprepair"})
|
||||
public ApiResponse updateCar(@RequestBody Repair repair) {
|
||||
try {
|
||||
int repairId = repair.getRepairId();
|
||||
System.out.println(repairId);
|
||||
Repair existingRepairinfo = this.repairShowMapper.FindRepairById(String.valueOf(repairId));
|
||||
System.out.println(existingRepairinfo);
|
||||
if (existingRepairinfo != null) {
|
||||
existingRepairinfo.setRepairMoney(repair.getRepairMoney());
|
||||
existingRepairinfo.setRepairReason(repair.getRepairReason());
|
||||
existingRepairinfo.setRepairStatus(repair.getRepairStatus());
|
||||
this.repairShowMapper.update(existingRepairinfo);
|
||||
if (repair.getRepairStatus() == 1) {
|
||||
this.repairShowMapper.updateCarStatusToAvailable(repair.getCarId());
|
||||
System.out.println("-----------------");
|
||||
System.out.println(repair.getRepairStatus());
|
||||
System.out.println(repair.getRepairStatus());
|
||||
System.out.println(repair.getRepairStatus());
|
||||
System.out.println(repair.getRepairStatus());
|
||||
}
|
||||
|
||||
if (repair.getRepairStatus() == 0) {
|
||||
this.repairShowMapper.updateCarStatusToRepair(repair.getCarId());
|
||||
System.out.println("0000000000000000000");
|
||||
System.out.println(repair.getRepairStatus());
|
||||
System.out.println(repair.getRepairStatus());
|
||||
System.out.println(repair.getRepairStatus());
|
||||
System.out.println(repair.getRepairStatus());
|
||||
}
|
||||
|
||||
return new ApiResponse((Object)null, 200, "维修信息更新成功");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 404, "车辆不存在");
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
Exception e = var4;
|
||||
return new ApiResponse(e.getMessage(), 500, "更新车辆信息发生异常");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.entity.User;
|
||||
import com.luozhihui.project.mapper.UserInfoMapper;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class UserInfoController {
|
||||
@Resource
|
||||
UserInfoMapper userInfoMapper;
|
||||
|
||||
public UserInfoController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/upuserinfo"})
|
||||
public ApiResponse updateUser(User user) {
|
||||
User existingUserinfo = this.userInfoMapper.findById(Integer.valueOf(user.getUserId()));
|
||||
if (existingUserinfo != null) {
|
||||
existingUserinfo.setPhone(user.getPhone());
|
||||
existingUserinfo.setUserName(user.getUserName());
|
||||
existingUserinfo.setPassWord(user.getPassWord());
|
||||
existingUserinfo.setIdCard(user.getIdCard());
|
||||
existingUserinfo.setDriverLicense(user.getDriverLicense());
|
||||
this.userInfoMapper.update(existingUserinfo);
|
||||
return new ApiResponse((Object)null, 200, "用户信息更新成功");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 404, "用户不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/RealUser"})
|
||||
public ApiResponse RealUser(User user) {
|
||||
User existingUserinfo = this.userInfoMapper.findById(Integer.valueOf(user.getUserId()));
|
||||
if (existingUserinfo != null) {
|
||||
existingUserinfo.setPhone(user.getPhone());
|
||||
existingUserinfo.setUserName(user.getUserName());
|
||||
existingUserinfo.setIdCard(user.getIdCard());
|
||||
existingUserinfo.setDriverLicense(user.getDriverLicense());
|
||||
existingUserinfo.setAvatar(user.getAvatar());
|
||||
this.userInfoMapper.update(existingUserinfo);
|
||||
return new ApiResponse((Object)null, 200, "用户实名成功");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 404, "用户不存在");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.LoginResponse;
|
||||
import com.luozhihui.project.entity.User;
|
||||
import com.luozhihui.project.mapper.UserLoginMapper;
|
||||
import com.luozhihui.project.util.JwtUtil;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class UserLoginController {
|
||||
@Resource
|
||||
UserLoginMapper userLoginMapper;
|
||||
|
||||
public UserLoginController() {
|
||||
}
|
||||
|
||||
@PostMapping({"/login"})
|
||||
public LoginResponse login(@RequestParam("Phone") String Phone, @RequestParam("PassWord") String PassWord) {
|
||||
List<User> userList = this.userLoginMapper.findByPhone(Phone);
|
||||
System.out.println(userList);
|
||||
if (userList.isEmpty()) {
|
||||
return new LoginResponse((Object)null, (Object)null, 500, "用户不存在");
|
||||
} else {
|
||||
User user = (User)userList.get(0);
|
||||
if (user.getPassWord().equals(PassWord)) {
|
||||
JwtUtil jwtUtil = new JwtUtil();
|
||||
String token = JwtUtil.createToken(((User)userList.get(0)).getPhone());
|
||||
return new LoginResponse(token, user.getUserId(), 200, "登录成功");
|
||||
} else {
|
||||
return new LoginResponse((Object)null, (Object)null, 500, "账号或密码错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.entity.User;
|
||||
import com.luozhihui.project.mapper.PhoneMapper;
|
||||
import com.luozhihui.project.mapper.UserRegMapper;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class UserRegController {
|
||||
@Resource
|
||||
UserRegMapper userRegMapper;
|
||||
@Resource
|
||||
PhoneMapper phoneMapper;
|
||||
|
||||
public UserRegController() {
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/user_register"})
|
||||
public ApiResponse UserReg(User user, String code, @RequestHeader(name = "Content-Type",required = false) String contentType) {
|
||||
if (this.isPhoneRegistered(user.getPhone())) {
|
||||
return new ApiResponse((Object)null, 400, "该手机号已被注册");
|
||||
} else {
|
||||
List<String> codes = this.phoneMapper.findByCode(user.getPhone());
|
||||
if (codes != null && !codes.isEmpty()) {
|
||||
String storedCode = (String)codes.get(0);
|
||||
String userInputCode = user.getCode();
|
||||
if (this.codeMatches(userInputCode, storedCode)) {
|
||||
this.userRegMapper.save(user);
|
||||
this.deleteCode(user.getPhone());
|
||||
return new ApiResponse((Object)null, 200, "注册成功");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 400, "验证码不匹配");
|
||||
}
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 400, "注册失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean codeMatches(String userInputCode, String storedCode) {
|
||||
return userInputCode != null && storedCode != null ? userInputCode.equals(storedCode) : false;
|
||||
}
|
||||
|
||||
private boolean isPhoneRegistered(String phone) {
|
||||
if (phone == null) {
|
||||
return false;
|
||||
} else {
|
||||
User existingUser = this.userRegMapper.findByPhone(phone);
|
||||
return existingUser != null;
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteCode(String phone) {
|
||||
if (phone != null) {
|
||||
this.phoneMapper.deleteCode(phone);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.controller;
|
||||
|
||||
import com.luozhihui.project.common.ApiResponse;
|
||||
import com.luozhihui.project.entity.User;
|
||||
import com.luozhihui.project.mapper.UserShowMapper;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api"})
|
||||
@CrossOrigin
|
||||
public class UserShowController {
|
||||
@Resource
|
||||
UserShowMapper userShowMapper;
|
||||
|
||||
public UserShowController() {
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/AllUser"})
|
||||
public ApiResponse AllCar() {
|
||||
try {
|
||||
List<User> user = this.userShowMapper.FindAllUser();
|
||||
return user != null ? new ApiResponse(user, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到");
|
||||
} catch (Exception var2) {
|
||||
Exception e = var2;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/FindUserById"})
|
||||
public ApiResponse FindUserById(User user) {
|
||||
try {
|
||||
List<User> users = this.userShowMapper.FindUserById(user.getUserId());
|
||||
return users != null && !users.isEmpty() ? new ApiResponse(users, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到用户信息");
|
||||
} catch (Exception var3) {
|
||||
Exception e = var3;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/delete_user"})
|
||||
public ApiResponse delete_user(@RequestBody Map<String, Object> requestBody) {
|
||||
try {
|
||||
String userIdsParam = (String)requestBody.get("userIds");
|
||||
List<String> userIdStrings = Arrays.asList(userIdsParam.split(","));
|
||||
List<Long> userIds = (List)userIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
|
||||
int deletedCount = 0;
|
||||
Iterator var6 = userIds.iterator();
|
||||
|
||||
while(var6.hasNext()) {
|
||||
Long userId = (Long)var6.next();
|
||||
boolean isDeleted = this.userShowMapper.DeleteUserById(String.valueOf(userId));
|
||||
if (isDeleted) {
|
||||
++deletedCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (deletedCount == userIds.size()) {
|
||||
return new ApiResponse((Object)null, 200, "删除成功");
|
||||
} else if (deletedCount == 0) {
|
||||
return new ApiResponse((Object)null, 404, "未找到用户信息");
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 207, "部分用户删除成功");
|
||||
}
|
||||
} catch (Exception var9) {
|
||||
Exception e = var9;
|
||||
e.printStackTrace();
|
||||
return new ApiResponse((Object)null, 500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@PostMapping({"/add_user"})
|
||||
public ApiResponse addUser(@RequestBody User user) {
|
||||
try {
|
||||
if (user != null && this.isValidUser(user)) {
|
||||
if (this.isUserExists(user)) {
|
||||
return new ApiResponse((Object)null, 409, "用户已存在");
|
||||
} else {
|
||||
this.userShowMapper.adduser(user);
|
||||
return new ApiResponse((Object)null, 200, "用户添加成功");
|
||||
}
|
||||
} else {
|
||||
return new ApiResponse((Object)null, 400, "无效的用户数据");
|
||||
}
|
||||
} catch (Exception var3) {
|
||||
return new ApiResponse((Object)null, 500, "内部服务器错误");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidUser(User user) {
|
||||
return user != null;
|
||||
}
|
||||
|
||||
private boolean isUserExists(User user) {
|
||||
try {
|
||||
User existingUser = (User)this.userShowMapper.FindUserByuserName(user.getUserName());
|
||||
return existingUser != null;
|
||||
} catch (Exception var3) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
48
src/main/java/com/luozhihui/project/entity/Admin.java
Normal file
48
src/main/java/com/luozhihui/project/entity/Admin.java
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
public class Admin {
|
||||
private Integer AdminId;
|
||||
private String AdminName;
|
||||
private String AdminPassWord;
|
||||
private String AdminUser;
|
||||
|
||||
public Admin() {
|
||||
}
|
||||
|
||||
public Integer getAdminId() {
|
||||
return this.AdminId;
|
||||
}
|
||||
|
||||
public void setAdminId(Integer adminId) {
|
||||
this.AdminId = adminId;
|
||||
}
|
||||
|
||||
public String getAdminName() {
|
||||
return this.AdminName;
|
||||
}
|
||||
|
||||
public void setAdminName(String adminName) {
|
||||
this.AdminName = adminName;
|
||||
}
|
||||
|
||||
public String getAdminPassWord() {
|
||||
return this.AdminPassWord;
|
||||
}
|
||||
|
||||
public void setAdminPassWord(String adminPassWord) {
|
||||
this.AdminPassWord = adminPassWord;
|
||||
}
|
||||
|
||||
public String getAdminUser() {
|
||||
return this.AdminUser;
|
||||
}
|
||||
|
||||
public void setAdminUser(String adminUser) {
|
||||
this.AdminUser = adminUser;
|
||||
}
|
||||
}
|
57
src/main/java/com/luozhihui/project/entity/Brand.java
Normal file
57
src/main/java/com/luozhihui/project/entity/Brand.java
Normal file
@ -0,0 +1,57 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
public class Brand {
|
||||
private String id;
|
||||
private String brand_name_ch;
|
||||
private String brand_name_en;
|
||||
private String brand_logo;
|
||||
private Integer status;
|
||||
|
||||
public Brand() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = String.valueOf(id);
|
||||
}
|
||||
|
||||
public String getBrand_name_ch() {
|
||||
return this.brand_name_ch;
|
||||
}
|
||||
|
||||
public void setBrand_name_ch(String brand_name_ch) {
|
||||
this.brand_name_ch = brand_name_ch;
|
||||
}
|
||||
|
||||
public String getBrand_name_en() {
|
||||
return this.brand_name_en;
|
||||
}
|
||||
|
||||
public void setBrand_name_en(String brand_name_en) {
|
||||
this.brand_name_en = brand_name_en;
|
||||
}
|
||||
|
||||
public String getBrand_logo() {
|
||||
return this.brand_logo;
|
||||
}
|
||||
|
||||
public void setBrand_logo(String brand_logo) {
|
||||
this.brand_logo = brand_logo;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
75
src/main/java/com/luozhihui/project/entity/Car.java
Normal file
75
src/main/java/com/luozhihui/project/entity/Car.java
Normal file
@ -0,0 +1,75 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
public class Car {
|
||||
private Integer CarId;
|
||||
private String CarContent;
|
||||
private String CarPhoto;
|
||||
private String parking_id;
|
||||
private String CarStatus;
|
||||
private String CarNumber;
|
||||
private String parkingName;
|
||||
|
||||
public Car() {
|
||||
}
|
||||
|
||||
public String getParkingName() {
|
||||
return this.parkingName;
|
||||
}
|
||||
|
||||
public void setParkingName(String parkingName) {
|
||||
this.parkingName = parkingName;
|
||||
}
|
||||
|
||||
public String getCarNumber() {
|
||||
return this.CarNumber;
|
||||
}
|
||||
|
||||
public void setCarNumber(String carNumber) {
|
||||
this.CarNumber = carNumber;
|
||||
}
|
||||
|
||||
public String getParking_id() {
|
||||
return this.parking_id;
|
||||
}
|
||||
|
||||
public void setParking_id(String parking_id) {
|
||||
this.parking_id = parking_id;
|
||||
}
|
||||
|
||||
public String getCarId() {
|
||||
return String.valueOf(this.CarId);
|
||||
}
|
||||
|
||||
public void setCarId(Integer carId) {
|
||||
this.CarId = carId;
|
||||
}
|
||||
|
||||
public String getCarContent() {
|
||||
return this.CarContent;
|
||||
}
|
||||
|
||||
public void setCarContent(String carContent) {
|
||||
this.CarContent = carContent;
|
||||
}
|
||||
|
||||
public String getCarPhoto() {
|
||||
return this.CarPhoto;
|
||||
}
|
||||
|
||||
public void setCarPhoto(String carPhoto) {
|
||||
this.CarPhoto = carPhoto;
|
||||
}
|
||||
|
||||
public String getCarStatus() {
|
||||
return this.CarStatus;
|
||||
}
|
||||
|
||||
public void setCarStatus(String carStatus) {
|
||||
this.CarStatus = carStatus;
|
||||
}
|
||||
}
|
75
src/main/java/com/luozhihui/project/entity/Category.java
Normal file
75
src/main/java/com/luozhihui/project/entity/Category.java
Normal file
@ -0,0 +1,75 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
public class Category {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String description;
|
||||
private Integer sort;
|
||||
private Integer status;
|
||||
private String createTime;
|
||||
private String updateTime;
|
||||
|
||||
public Category() {
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return this.sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return this.updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
93
src/main/java/com/luozhihui/project/entity/Comment.java
Normal file
93
src/main/java/com/luozhihui/project/entity/Comment.java
Normal file
@ -0,0 +1,93 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
public class Comment {
|
||||
private int CommentId;
|
||||
private String text;
|
||||
private String pub_date;
|
||||
private String UserName;
|
||||
private int CarId;
|
||||
private int UserId;
|
||||
private String CarContent;
|
||||
private String CarNumber;
|
||||
private int parking_id;
|
||||
|
||||
public Comment() {
|
||||
}
|
||||
|
||||
public int getParking_id() {
|
||||
return this.parking_id;
|
||||
}
|
||||
|
||||
public void setParking_id(int parking_id) {
|
||||
this.parking_id = parking_id;
|
||||
}
|
||||
|
||||
public String getCarContent() {
|
||||
return this.CarContent;
|
||||
}
|
||||
|
||||
public void setCarContent(String carContent) {
|
||||
this.CarContent = carContent;
|
||||
}
|
||||
|
||||
public String getCarNumber() {
|
||||
return this.CarNumber;
|
||||
}
|
||||
|
||||
public void setCarNumber(String carNumber) {
|
||||
this.CarNumber = carNumber;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return this.UserName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.UserName = userName;
|
||||
}
|
||||
|
||||
public int getCommentId() {
|
||||
return this.CommentId;
|
||||
}
|
||||
|
||||
public void setCommentId(int commentId) {
|
||||
this.CommentId = commentId;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getPub_date() {
|
||||
return this.pub_date;
|
||||
}
|
||||
|
||||
public void setPub_date(String pub_date) {
|
||||
this.pub_date = pub_date;
|
||||
}
|
||||
|
||||
public int getCarId() {
|
||||
return this.CarId;
|
||||
}
|
||||
|
||||
public void setCarId(int carId) {
|
||||
this.CarId = carId;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return this.UserId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.UserId = userId;
|
||||
}
|
||||
}
|
129
src/main/java/com/luozhihui/project/entity/Mode.java
Normal file
129
src/main/java/com/luozhihui/project/entity/Mode.java
Normal file
@ -0,0 +1,129 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
public class Mode {
|
||||
private int ModeId;
|
||||
private String BetMoney;
|
||||
private String DayMoney;
|
||||
private String HourMoney;
|
||||
private String MonthMoney;
|
||||
private String Description;
|
||||
private String ModeStatus;
|
||||
private String parking_id;
|
||||
private String ModeName;
|
||||
private String ModeImg;
|
||||
private String parkingName;
|
||||
private String ModeNum;
|
||||
private String type;
|
||||
|
||||
public Mode() {
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getModeId() {
|
||||
return this.ModeId;
|
||||
}
|
||||
|
||||
public void setModeId(int modeId) {
|
||||
this.ModeId = modeId;
|
||||
}
|
||||
|
||||
public String getBetMoney() {
|
||||
return this.BetMoney;
|
||||
}
|
||||
|
||||
public void setBetMoney(String betMoney) {
|
||||
this.BetMoney = betMoney;
|
||||
}
|
||||
|
||||
public String getDayMoney() {
|
||||
return this.DayMoney;
|
||||
}
|
||||
|
||||
public void setDayMoney(String dayMoney) {
|
||||
this.DayMoney = dayMoney;
|
||||
}
|
||||
|
||||
public String getHourMoney() {
|
||||
return this.HourMoney;
|
||||
}
|
||||
|
||||
public void setHourMoney(String hourMoney) {
|
||||
this.HourMoney = hourMoney;
|
||||
}
|
||||
|
||||
public String getMonthMoney() {
|
||||
return this.MonthMoney;
|
||||
}
|
||||
|
||||
public void setMonthMoney(String monthMoney) {
|
||||
this.MonthMoney = monthMoney;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.Description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.Description = description;
|
||||
}
|
||||
|
||||
public String getModeStatus() {
|
||||
return this.ModeStatus;
|
||||
}
|
||||
|
||||
public void setModeStatus(String modeStatus) {
|
||||
this.ModeStatus = modeStatus;
|
||||
}
|
||||
|
||||
public String getParking_id() {
|
||||
return this.parking_id;
|
||||
}
|
||||
|
||||
public void setParking_id(String parking_id) {
|
||||
this.parking_id = parking_id;
|
||||
}
|
||||
|
||||
public String getModeName() {
|
||||
return this.ModeName;
|
||||
}
|
||||
|
||||
public void setModeName(String modeName) {
|
||||
this.ModeName = modeName;
|
||||
}
|
||||
|
||||
public String getModeImg() {
|
||||
return this.ModeImg;
|
||||
}
|
||||
|
||||
public void setModeImg(String modeImg) {
|
||||
this.ModeImg = modeImg;
|
||||
}
|
||||
|
||||
public String getParkingName() {
|
||||
return this.parkingName;
|
||||
}
|
||||
|
||||
public void setParkingName(String parkingName) {
|
||||
this.parkingName = parkingName;
|
||||
}
|
||||
|
||||
public String getModeNum() {
|
||||
return this.ModeNum;
|
||||
}
|
||||
|
||||
public void setModeNum(String modeNum) {
|
||||
this.ModeNum = modeNum;
|
||||
}
|
||||
}
|
203
src/main/java/com/luozhihui/project/entity/Order.java
Normal file
203
src/main/java/com/luozhihui/project/entity/Order.java
Normal file
@ -0,0 +1,203 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class Order {
|
||||
private String OrderId;
|
||||
private Integer UserId;
|
||||
private Integer CarId;
|
||||
private Double OrderMoney;
|
||||
private String OutPicture;
|
||||
private String InPicture;
|
||||
private String carContent;
|
||||
private LocalDateTime inTime;
|
||||
private LocalDateTime outTime;
|
||||
private Integer Mode;
|
||||
private Integer ModeId;
|
||||
private Integer OrderStatus;
|
||||
private String UserName;
|
||||
private String CarDayMoney;
|
||||
private String CarHoursMoney;
|
||||
private String CarNumber;
|
||||
private String parking_id;
|
||||
private String parkingName;
|
||||
private String ModeName;
|
||||
private String DayMoney;
|
||||
private String HourMoney;
|
||||
|
||||
public Order() {
|
||||
}
|
||||
|
||||
public Integer getModeId() {
|
||||
return this.ModeId;
|
||||
}
|
||||
|
||||
public String getCarNumber() {
|
||||
return this.CarNumber;
|
||||
}
|
||||
|
||||
public String getDayMoney() {
|
||||
return this.DayMoney;
|
||||
}
|
||||
|
||||
public void setDayMoney(String dayMoney) {
|
||||
this.DayMoney = dayMoney;
|
||||
}
|
||||
|
||||
public String getHourMoney() {
|
||||
return this.HourMoney;
|
||||
}
|
||||
|
||||
public void setHourMoney(String hourMoney) {
|
||||
this.HourMoney = hourMoney;
|
||||
}
|
||||
|
||||
public String getCarContent() {
|
||||
return this.carContent;
|
||||
}
|
||||
|
||||
public void setCarContent(String carContent) {
|
||||
this.carContent = carContent;
|
||||
}
|
||||
|
||||
public void setCarNumber(String carNumber) {
|
||||
this.CarNumber = carNumber;
|
||||
}
|
||||
|
||||
public String getModeName() {
|
||||
return this.ModeName;
|
||||
}
|
||||
|
||||
public void setModeName(String modeName) {
|
||||
this.ModeName = modeName;
|
||||
}
|
||||
|
||||
public String getParkingName() {
|
||||
return this.parkingName;
|
||||
}
|
||||
|
||||
public void setParkingName(String parkingName) {
|
||||
this.parkingName = parkingName;
|
||||
}
|
||||
|
||||
public void setModeId(Integer modeId) {
|
||||
this.ModeId = modeId;
|
||||
}
|
||||
|
||||
public String getParking_id() {
|
||||
return this.parking_id;
|
||||
}
|
||||
|
||||
public void setParking_id(String parking_id) {
|
||||
this.parking_id = parking_id;
|
||||
}
|
||||
|
||||
public String getCarDayMoney() {
|
||||
return this.CarDayMoney;
|
||||
}
|
||||
|
||||
public void setCarDayMoney(String carDayMoney) {
|
||||
this.CarDayMoney = carDayMoney;
|
||||
}
|
||||
|
||||
public String getCarHoursMoney() {
|
||||
return this.CarHoursMoney;
|
||||
}
|
||||
|
||||
public void setCarHoursMoney(String carHoursMoney) {
|
||||
this.CarHoursMoney = carHoursMoney;
|
||||
}
|
||||
|
||||
public LocalDateTime getInTime() {
|
||||
return this.inTime;
|
||||
}
|
||||
|
||||
public void setInTime(LocalDateTime inTime) {
|
||||
this.inTime = inTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getOutTime() {
|
||||
return this.outTime;
|
||||
}
|
||||
|
||||
public void setOutTime(LocalDateTime outTime) {
|
||||
this.outTime = outTime;
|
||||
}
|
||||
|
||||
public Integer getMode() {
|
||||
return this.Mode;
|
||||
}
|
||||
|
||||
public void setMode(Integer mode) {
|
||||
this.Mode = mode;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return this.OrderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.OrderId = orderId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return String.valueOf(this.UserId);
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.UserId = userId;
|
||||
}
|
||||
|
||||
public String getCarId() {
|
||||
return String.valueOf(this.CarId);
|
||||
}
|
||||
|
||||
public void setCarId(Integer carId) {
|
||||
this.CarId = carId;
|
||||
}
|
||||
|
||||
public Double getOrderMoney() {
|
||||
return this.OrderMoney;
|
||||
}
|
||||
|
||||
public void setOrderMoney(Double orderMoney) {
|
||||
this.OrderMoney = orderMoney;
|
||||
}
|
||||
|
||||
public String getOutPicture() {
|
||||
return this.OutPicture;
|
||||
}
|
||||
|
||||
public void setOutPicture(String outPicture) {
|
||||
this.OutPicture = outPicture;
|
||||
}
|
||||
|
||||
public String getInPicture() {
|
||||
return this.InPicture;
|
||||
}
|
||||
|
||||
public void setInPicture(String inPicture) {
|
||||
this.InPicture = inPicture;
|
||||
}
|
||||
|
||||
public Integer getOrderStatus() {
|
||||
return this.OrderStatus;
|
||||
}
|
||||
|
||||
public void setOrderStatus(Integer orderStatus) {
|
||||
this.OrderStatus = orderStatus;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return this.UserName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.UserName = userName;
|
||||
}
|
||||
}
|
95
src/main/java/com/luozhihui/project/entity/Pact.java
Normal file
95
src/main/java/com/luozhihui/project/entity/Pact.java
Normal file
@ -0,0 +1,95 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Pact {
|
||||
private Integer PactId;
|
||||
private Integer CarId;
|
||||
private Integer UserId;
|
||||
private Integer PactMoney;
|
||||
private String CarModel;
|
||||
private String UserName;
|
||||
private String CarLicense;
|
||||
private Date OutTime;
|
||||
private Date InTime;
|
||||
|
||||
public Pact() {
|
||||
}
|
||||
|
||||
public String getCarModel() {
|
||||
return this.CarModel;
|
||||
}
|
||||
|
||||
public void setCarModel(String carModel) {
|
||||
this.CarModel = carModel;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return this.UserName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.UserName = userName;
|
||||
}
|
||||
|
||||
public String getCarLicense() {
|
||||
return this.CarLicense;
|
||||
}
|
||||
|
||||
public void setCarLicense(String carLicense) {
|
||||
this.CarLicense = carLicense;
|
||||
}
|
||||
|
||||
public Integer getPactId() {
|
||||
return this.PactId;
|
||||
}
|
||||
|
||||
public void setPactId(Integer pactId) {
|
||||
this.PactId = pactId;
|
||||
}
|
||||
|
||||
public Integer getCarId() {
|
||||
return this.CarId;
|
||||
}
|
||||
|
||||
public void setCarId(Integer carId) {
|
||||
this.CarId = carId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return String.valueOf(this.UserId);
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.UserId = userId;
|
||||
}
|
||||
|
||||
public Integer getPactMoney() {
|
||||
return this.PactMoney;
|
||||
}
|
||||
|
||||
public void setPactMoney(Integer pactMoney) {
|
||||
this.PactMoney = pactMoney;
|
||||
}
|
||||
|
||||
public Date getOutTime() {
|
||||
return this.OutTime;
|
||||
}
|
||||
|
||||
public void setOutTime(Date outTime) {
|
||||
this.OutTime = outTime;
|
||||
}
|
||||
|
||||
public Date getInTime() {
|
||||
return this.InTime;
|
||||
}
|
||||
|
||||
public void setInTime(Date inTime) {
|
||||
this.InTime = inTime;
|
||||
}
|
||||
}
|
75
src/main/java/com/luozhihui/project/entity/Parking.java
Normal file
75
src/main/java/com/luozhihui/project/entity/Parking.java
Normal file
@ -0,0 +1,75 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
public class Parking {
|
||||
private Integer id;
|
||||
private String parkingName;
|
||||
private String address;
|
||||
private Integer type;
|
||||
private Integer carsNumber;
|
||||
private String enable;
|
||||
private String coord;
|
||||
|
||||
public Parking() {
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getParkingName() {
|
||||
return this.parkingName;
|
||||
}
|
||||
|
||||
public void setParkingName(String parkingName) {
|
||||
this.parkingName = parkingName;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return this.address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getCarsNumber() {
|
||||
return this.carsNumber;
|
||||
}
|
||||
|
||||
public void setCarsNumber(Integer carsNumber) {
|
||||
this.carsNumber = carsNumber;
|
||||
}
|
||||
|
||||
public String getEnable() {
|
||||
return this.enable;
|
||||
}
|
||||
|
||||
public void setEnable(String enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public String getCoord() {
|
||||
return this.coord;
|
||||
}
|
||||
|
||||
public void setCoord(String coord) {
|
||||
this.coord = coord;
|
||||
}
|
||||
}
|
30
src/main/java/com/luozhihui/project/entity/Phone.java
Normal file
30
src/main/java/com/luozhihui/project/entity/Phone.java
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
public class Phone {
|
||||
private String phone;
|
||||
private String code;
|
||||
|
||||
public Phone() {
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return this.phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
131
src/main/java/com/luozhihui/project/entity/Post.java
Normal file
131
src/main/java/com/luozhihui/project/entity/Post.java
Normal file
@ -0,0 +1,131 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Post {
|
||||
private Integer id;
|
||||
private String title;
|
||||
private String content;
|
||||
private String userId;
|
||||
private String categoryId;
|
||||
private String status;
|
||||
private Integer viewCount;
|
||||
private Integer likeCount;
|
||||
private Integer replyCount;
|
||||
private String UserName;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private String categoryName;
|
||||
|
||||
public Post() {
|
||||
}
|
||||
|
||||
public String getCategoryName() {
|
||||
return this.categoryName;
|
||||
}
|
||||
|
||||
public void setCategoryName(String categoryName) {
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return this.UserName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.UserName = userName;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getCategoryId() {
|
||||
return this.categoryId;
|
||||
}
|
||||
|
||||
public void setCategoryId(String categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getViewCount() {
|
||||
return this.viewCount;
|
||||
}
|
||||
|
||||
public void setViewCount(Integer viewCount) {
|
||||
this.viewCount = viewCount;
|
||||
}
|
||||
|
||||
public Integer getLikeCount() {
|
||||
return this.likeCount;
|
||||
}
|
||||
|
||||
public void setLikeCount(Integer likeCount) {
|
||||
this.likeCount = likeCount;
|
||||
}
|
||||
|
||||
public Integer getReplyCount() {
|
||||
return this.replyCount;
|
||||
}
|
||||
|
||||
public void setReplyCount(Integer replyCount) {
|
||||
this.replyCount = replyCount;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return this.updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
183
src/main/java/com/luozhihui/project/entity/Repair.java
Normal file
183
src/main/java/com/luozhihui/project/entity/Repair.java
Normal file
@ -0,0 +1,183 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
public class Repair {
|
||||
private Integer RepairId;
|
||||
private Integer CarId;
|
||||
private String RepairReason;
|
||||
private Integer PactId;
|
||||
private Integer RepairMoney;
|
||||
private Integer RepairStatus;
|
||||
private String CarModel;
|
||||
private String CarLicense;
|
||||
private String CarContent;
|
||||
private String CarColour;
|
||||
private String CarPhoto;
|
||||
private String CarPosition;
|
||||
private String CarSecurityDeposit;
|
||||
private String CarDayMoney;
|
||||
private String CarHoursMoney;
|
||||
private String OutTime;
|
||||
private String InTime;
|
||||
private String Mode;
|
||||
private String CarStatus;
|
||||
|
||||
public Repair() {
|
||||
}
|
||||
|
||||
public Integer getRepairId() {
|
||||
return this.RepairId;
|
||||
}
|
||||
|
||||
public void setRepairId(Integer repairId) {
|
||||
this.RepairId = repairId;
|
||||
}
|
||||
|
||||
public Integer getCarId() {
|
||||
return this.CarId;
|
||||
}
|
||||
|
||||
public void setCarId(Integer carId) {
|
||||
this.CarId = carId;
|
||||
}
|
||||
|
||||
public String getRepairReason() {
|
||||
return this.RepairReason;
|
||||
}
|
||||
|
||||
public void setRepairReason(String repairReason) {
|
||||
this.RepairReason = repairReason;
|
||||
}
|
||||
|
||||
public Integer getPactId() {
|
||||
return this.PactId;
|
||||
}
|
||||
|
||||
public void setPactId(Integer pactId) {
|
||||
this.PactId = pactId;
|
||||
}
|
||||
|
||||
public Integer getRepairMoney() {
|
||||
return this.RepairMoney;
|
||||
}
|
||||
|
||||
public void setRepairMoney(Integer repairMoney) {
|
||||
this.RepairMoney = repairMoney;
|
||||
}
|
||||
|
||||
public Integer getRepairStatus() {
|
||||
return this.RepairStatus;
|
||||
}
|
||||
|
||||
public void setRepairStatus(Integer repairStatus) {
|
||||
this.RepairStatus = repairStatus;
|
||||
}
|
||||
|
||||
public String getCarModel() {
|
||||
return this.CarModel;
|
||||
}
|
||||
|
||||
public void setCarModel(String carModel) {
|
||||
this.CarModel = carModel;
|
||||
}
|
||||
|
||||
public String getCarLicense() {
|
||||
return this.CarLicense;
|
||||
}
|
||||
|
||||
public void setCarLicense(String carLicense) {
|
||||
this.CarLicense = carLicense;
|
||||
}
|
||||
|
||||
public String getCarContent() {
|
||||
return this.CarContent;
|
||||
}
|
||||
|
||||
public void setCarContent(String carContent) {
|
||||
this.CarContent = carContent;
|
||||
}
|
||||
|
||||
public String getCarColour() {
|
||||
return this.CarColour;
|
||||
}
|
||||
|
||||
public void setCarColour(String carColour) {
|
||||
this.CarColour = carColour;
|
||||
}
|
||||
|
||||
public String getCarPhoto() {
|
||||
return this.CarPhoto;
|
||||
}
|
||||
|
||||
public void setCarPhoto(String carPhoto) {
|
||||
this.CarPhoto = carPhoto;
|
||||
}
|
||||
|
||||
public String getCarPosition() {
|
||||
return this.CarPosition;
|
||||
}
|
||||
|
||||
public void setCarPosition(String carPosition) {
|
||||
this.CarPosition = carPosition;
|
||||
}
|
||||
|
||||
public String getCarSecurityDeposit() {
|
||||
return this.CarSecurityDeposit;
|
||||
}
|
||||
|
||||
public void setCarSecurityDeposit(String carSecurityDeposit) {
|
||||
this.CarSecurityDeposit = carSecurityDeposit;
|
||||
}
|
||||
|
||||
public String getCarDayMoney() {
|
||||
return this.CarDayMoney;
|
||||
}
|
||||
|
||||
public void setCarDayMoney(String carDayMoney) {
|
||||
this.CarDayMoney = carDayMoney;
|
||||
}
|
||||
|
||||
public String getCarHoursMoney() {
|
||||
return this.CarHoursMoney;
|
||||
}
|
||||
|
||||
public void setCarHoursMoney(String carHoursMoney) {
|
||||
this.CarHoursMoney = carHoursMoney;
|
||||
}
|
||||
|
||||
public String getOutTime() {
|
||||
return this.OutTime;
|
||||
}
|
||||
|
||||
public void setOutTime(String outTime) {
|
||||
this.OutTime = outTime;
|
||||
}
|
||||
|
||||
public String getInTime() {
|
||||
return this.InTime;
|
||||
}
|
||||
|
||||
public void setInTime(String inTime) {
|
||||
this.InTime = inTime;
|
||||
}
|
||||
|
||||
public String getMode() {
|
||||
return this.Mode;
|
||||
}
|
||||
|
||||
public void setMode(String mode) {
|
||||
this.Mode = mode;
|
||||
}
|
||||
|
||||
public String getCarStatus() {
|
||||
return this.CarStatus;
|
||||
}
|
||||
|
||||
public void setCarStatus(String carStatus) {
|
||||
this.CarStatus = carStatus;
|
||||
}
|
||||
}
|
113
src/main/java/com/luozhihui/project/entity/Reply.java
Normal file
113
src/main/java/com/luozhihui/project/entity/Reply.java
Normal file
@ -0,0 +1,113 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Reply {
|
||||
private Long id;
|
||||
private String content;
|
||||
private Long postId;
|
||||
private Long userId;
|
||||
private String parentId;
|
||||
private String status;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private String userName;
|
||||
private String avatar;
|
||||
private String authorAvatar;
|
||||
|
||||
public Reply() {
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Long getPostId() {
|
||||
return this.postId;
|
||||
}
|
||||
|
||||
public void setPostId(Long postId) {
|
||||
this.postId = postId;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return this.updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return this.userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getAuthorAvatar() {
|
||||
return this.authorAvatar;
|
||||
}
|
||||
|
||||
public void setAuthorAvatar(String authorAvatar) {
|
||||
this.authorAvatar = authorAvatar;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return this.avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
}
|
84
src/main/java/com/luozhihui/project/entity/User.java
Normal file
84
src/main/java/com/luozhihui/project/entity/User.java
Normal file
@ -0,0 +1,84 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.entity;
|
||||
|
||||
public class User {
|
||||
private Integer UserId;
|
||||
private String Phone;
|
||||
private String UserName;
|
||||
private String PassWord;
|
||||
private String IdCard;
|
||||
private String DriverLicense;
|
||||
private String code;
|
||||
private String avatar;
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return this.avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return String.valueOf(this.UserId);
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.UserId = userId;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return this.Phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.Phone = phone;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return this.UserName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.UserName = userName;
|
||||
}
|
||||
|
||||
public String getPassWord() {
|
||||
return this.PassWord;
|
||||
}
|
||||
|
||||
public void setPassWord(String passWord) {
|
||||
this.PassWord = passWord;
|
||||
}
|
||||
|
||||
public String getIdCard() {
|
||||
return this.IdCard;
|
||||
}
|
||||
|
||||
public void setIdCard(String idCard) {
|
||||
this.IdCard = idCard;
|
||||
}
|
||||
|
||||
public String getDriverLicense() {
|
||||
return this.DriverLicense;
|
||||
}
|
||||
|
||||
public void setDriverLicense(String driverLicense) {
|
||||
this.DriverLicense = driverLicense;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Admin;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
public interface AdminLoginMapper {
|
||||
@Select({"select * from `admin` where `AdminUser`=#{AdminUser}"})
|
||||
List<Admin> findByPhone(@Param("AdminUser") String AdminUser);
|
||||
}
|
42
src/main/java/com/luozhihui/project/mapper/BrandMapper.java
Normal file
42
src/main/java/com/luozhihui/project/mapper/BrandMapper.java
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Brand;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface BrandMapper {
|
||||
@Select({"select * from `brand` LIMIT #{pageNum}, #{pageSize}"})
|
||||
List<Brand> FindAllBrandpage(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize);
|
||||
|
||||
@Select({"select * from `brand` "})
|
||||
List<Brand> FindAllBrand();
|
||||
|
||||
@Select({"select * from `brand` where `id`=#{id}"})
|
||||
List<Brand> FindBrandById(String Id);
|
||||
|
||||
@Insert({"insert into `brand`(`brand_name_ch`,`brand_name_en`,`brand_logo`,`status`) VALUES(#{brand_name_ch},#{brand_name_en},#{brand_logo},#{status})"})
|
||||
@Transactional
|
||||
void addBrand(Brand brand);
|
||||
|
||||
@Delete({"delete from `brand` where `id`=#{id}"})
|
||||
boolean DeleteBrandById(String Id);
|
||||
|
||||
@Select({"select * from `brand` where `id`=#{id}"})
|
||||
Brand BrandId(Integer Id);
|
||||
|
||||
@Update({"UPDATE brand SET brand_name_ch = #{brand_name_ch}, brand_name_en = #{brand_name_en}, brand_logo = #{brand_logo}, status = #{status} where `id`=#{id}"})
|
||||
void update(Brand brand);
|
||||
|
||||
@Select({" SELECT COUNT(*) FROM `brand` "})
|
||||
int countBrand();
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Order;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface CarRentMapper {
|
||||
@Insert({"insert into `order`(`UserId`,`CarId`,`OrderMoney`,`OutPicture`,`OutTime`,`Mode`,`OrderStatus`,`modeId`,`parking_id`) VALUES (#{UserId},#{CarId},#{OrderMoney},#{OutPicture},NOW(),#{Mode},#{OrderStatus},#{modeId},#{parking_id})"})
|
||||
@Transactional
|
||||
void addorder(Order order);
|
||||
|
||||
@Update({"update `car` set `CarStatus` = 1 where `CarId` = #{CarId}"})
|
||||
void updateCarStatus(Integer carId);
|
||||
|
||||
@Update({"update `order` SET `OrderMoney`=#{OrderMoney},`InPicture`=#{InPicture},`InTime`=NOW() WHERE `OrderId` = #{OrderId} "})
|
||||
void carRented(Order order);
|
||||
|
||||
@Update({"update `order` set `OrderStatus` = 1 where `OrderId` = #{OrderId}"})
|
||||
void finishOrder(String orderId);
|
||||
|
||||
@Update({"update `car` set `CarStatus` = 0, `parking_id` = #{parking_id} where `CarId` = #{carId}"})
|
||||
void endCarStatus(@Param("carId") String carId, @Param("parking_id") String parkingId);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Car;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface CarShowMapper {
|
||||
@Select({"select car.*,`parking`.parkingName,`parking`.parkingName from `car` JOIN `parking` ON `car`.parking_id=`parking`.id"})
|
||||
List<Car> FindAllCar();
|
||||
|
||||
@Select({"select * from `car` where `CarId`=#{CarId}"})
|
||||
List<Car> FindCarById(String CarId);
|
||||
|
||||
@Insert({"insert into `car`(`CarContent`,`CarStatus`,`CarPhoto`,`parking_id`,`CarNumber`) VALUES(#{CarContent},#{CarStatus},#{CarPhoto},#{parking_id},#{CarNumber})"})
|
||||
@Transactional
|
||||
void addCar(Car car);
|
||||
|
||||
@Delete({"delete from `car` where `CarId`=#{CarId}"})
|
||||
boolean DeleteCarById(String CarId);
|
||||
|
||||
@Select({"select * from `car` where `CarId`=#{CarId}"})
|
||||
Car CarId(Integer CarId);
|
||||
|
||||
@Update({"UPDATE car SET CarContent = #{CarContent}, CarStatus = #{CarStatus}, CarPhoto = #{CarPhoto}, parking_id = #{parking_id}, CarNumber = #{CarNumber} where CarId = #{CarId}"})
|
||||
void update(Car car);
|
||||
|
||||
@Select({"SELECT `car`.* FROM `car` WHERE parking_id=#{parking_id}"})
|
||||
List<Car> findCarsByParkingId(Integer parking_id);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Category;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
@Mapper
|
||||
public interface CategoryMapper {
|
||||
@Select({"SELECT * FROM category WHERE status = 1 ORDER BY sort ASC"})
|
||||
List<Category> findAllCategories();
|
||||
|
||||
@Select({"SELECT * FROM category WHERE id = #{id}"})
|
||||
Category findById(@Param("id") Long id);
|
||||
|
||||
@Insert({"INSERT INTO category (name, description, sort, status, createTime, updateTime) VALUES (#{name}, #{description}, #{sort}, #{status}, NOW(), NOW())"})
|
||||
@Options(
|
||||
useGeneratedKeys = true,
|
||||
keyProperty = "id"
|
||||
)
|
||||
int insert(Category category);
|
||||
|
||||
@Update({"UPDATE category SET name = #{name}, description = #{description}, sort = #{sort}, status = #{status}, updateTime = NOW() WHERE id = #{id}"})
|
||||
int update(Category category);
|
||||
|
||||
@Update({"UPDATE category SET status = 0, updateTime = NOW() WHERE id = #{id}"})
|
||||
int deleteById(@Param("id") Long id);
|
||||
|
||||
@Select({"SELECT COUNT(*) FROM category WHERE name = #{name} AND status = 1"})
|
||||
int checkNameExists(@Param("name") String name);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Comment;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface CommentMapper {
|
||||
@Insert({"insert into `comments`(`UserName`,`text`,`CarId`,`UserId`,`pub_date`,`parking_id`) VALUES(#{UserName},#{text},#{CarId},#{UserId},NOW(),#{parking_id})"})
|
||||
@Transactional
|
||||
void save(Comment comment);
|
||||
|
||||
@Select({"SELECT comments.CommentId,comments.text,comments.pub_date,car.CarContent,car.CarNumber,user.UserName FROM `comments` JOIN `user` ON `user`.UserId = `comments`.UserId JOIN `car` ON `car`.CarId = `comments`.CarId JOIN `parking` ON `car`.CarId = `comments`.CarId"})
|
||||
List<Comment> FindAllComment();
|
||||
}
|
45
src/main/java/com/luozhihui/project/mapper/ModeMapper.java
Normal file
45
src/main/java/com/luozhihui/project/mapper/ModeMapper.java
Normal file
@ -0,0 +1,45 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Mode;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface ModeMapper {
|
||||
@Select({"select mode.*,p.parkingName from `mode` JOIN car.parking p on p.id = mode.parking_id LIMIT #{pageNum}, #{pageSize}"})
|
||||
List<Mode> FindAllModepage(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize);
|
||||
|
||||
@Select({"select mode.*,p.parkingName from `mode` JOIN car.parking p on p.id = mode.parking_id"})
|
||||
List<Mode> FindAllMode();
|
||||
|
||||
@Select({"select * from `mode` where `ModeId`=#{ModeId}"})
|
||||
List<Mode> FindModedById(String Id);
|
||||
|
||||
@Select({"select mode.*,p.parkingName,p.type from `mode` JOIN car.parking p on p.id=mode.parking_id where `parking_id`=#{parking_id}"})
|
||||
List<Mode> FindModedByParkingId(String parking_id);
|
||||
|
||||
@Insert({"insert into `mode` (`BetMoney`,`DayMoney`,`HourMoney`,`MonthMoney`,`Description`,`ModeStatus`,`parking_id`,`ModeName`,`ModeImg`,`ModeNum`) VALUES(#{BetMoney},#{DayMoney},#{HourMoney},#{MonthMoney},#{Description},#{ModeStatus},#{parking_id},#{ModeName},#{ModeImg},#{ModeNum})"})
|
||||
@Transactional
|
||||
void addMode(Mode mode);
|
||||
|
||||
@Delete({"delete from `mode` where `ModeId`=#{ModeId}"})
|
||||
boolean DeleteModeById(String Id);
|
||||
|
||||
@Select({"select * from `mode` where `ModeId`=#{ModeId}"})
|
||||
Mode ModeId(Integer ModeId);
|
||||
|
||||
@Update({"UPDATE mode SET BetMoney = #{BetMoney}, DayMoney = #{DayMoney}, HourMoney = #{HourMoney}, MonthMoney = #{MonthMoney},Description=#{Description},ModeStatus=#{ModeStatus},parking_id=#{parking_id},ModeName=#{ModeName},ModeImg=#{ModeImg},ModeNum=#{ModeNum} where `ModeId`=#{ModeId}"})
|
||||
void update(Mode mode);
|
||||
|
||||
@Select({" SELECT COUNT(*) FROM `mode`"})
|
||||
int countMode();
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Order;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
public interface OrderShowMapper {
|
||||
@Select({"SELECT `order`.*, `car`.CarContent, `car`.CarNumber, `user`.UserName ,`mode`.ModeName,`parking`.parkingName FROM `order` JOIN car ON `order`.CarId = `car`.CarId JOIN parking ON `order`.parking_id = `parking`.id JOIN mode ON `order`.modeId = `mode`.ModeId JOIN user ON `order`.UserId = `user`.UserId"})
|
||||
List<Order> FindAllOrder();
|
||||
|
||||
@Select({"SELECT `OrderId` , `OrderMoney` ,`Mode` , `OrderStatus`, `InTime`, `car`.CarContent ,`car`.CarNumber,`user`.UserName ,`parking`.parkingName FROM `order` JOIN `car` ON `car`.CarId=`order`.CarId JOIN `user` ON `user`.UserId=`order`.UserId JOIN `parking` ON `parking`.id=`order`.parking_id ORDER BY `OrderId` DESC LIMIT 16"})
|
||||
List<Order> GetOrder();
|
||||
|
||||
@Select({"SELECT `order`.*,`car`.CarContent,car.CarNumber, `mode`.ModeName,`user`.UserName,parking.parkingName,`mode`.DayMoney,`mode`.HourMoney FROM `order` JOIN `car` ON `car`.CarId=`order`.CarId JOIN `user` ON `user`.UserId=`order`.UserId JOIN `mode` ON `mode`.modeId=`order`.modeId JOIN `parking` ON `parking`.id=`order`.parking_id Where `order`.`UserId`=#{userId} ORDER BY `OrderId` LIMIT #{pageNum}, #{pageSize}"})
|
||||
List<Order> findOrdersByUserId(@Param("userId") Integer userId, @Param("pageNum") int pageNum, @Param("pageSize") int pageSize);
|
||||
|
||||
@Delete({"delete from `order` where `OrderId`=#{OrderId}"})
|
||||
boolean DeleteOrderById(String orderId);
|
||||
|
||||
@Select({"select * from `order` where `OrderId`=#{OrderId}"})
|
||||
Order OrderId(Integer OrderId);
|
||||
|
||||
@Update({"UPDATE `order` SET OrderMoney = #{OrderMoney}, OrderStatus = #{OrderStatus} where OrderId = #{OrderId}"})
|
||||
void update(Order order);
|
||||
|
||||
@Select({" SELECT COUNT(*) FROM `order` WHERE `userId` = #{userId}"})
|
||||
int countOrdersByUserId(String userId);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Pact;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
public interface PactShowMapper {
|
||||
@Select({"select * from `pact`"})
|
||||
List<Pact> FindAllPact();
|
||||
|
||||
@Select({"select * from `pact` where `UserId`=#{UserId}"})
|
||||
List<Pact> FindPactById(String OrderId);
|
||||
|
||||
@Select({"SELECT `pact`.`PactId` , `pact`.`CarId`,`pact`.`UserId`,`pact`.`PactMoney` ,`pact`.`OutTime` , `pact`.`InTime`, `user`.UserName,`car`.CarModel,`car`.CarLicense FROM `pact` JOIN `car` ON `car`.CarId=`pact`.CarId JOIN `user` ON `user`.UserId=`pact`.UserId Where `pact`.`PactId`=#{PactId} "})
|
||||
List<Pact> FindPactByPactId(String PactId);
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Brand;
|
||||
import com.luozhihui.project.entity.Parking;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface ParkingMapper {
|
||||
@Select({"select * from `parking`"})
|
||||
List<Parking> FindAllParking();
|
||||
|
||||
@Select({"select * from `parking` where `id`=#{id}"})
|
||||
List<Brand> FindParkingById(String Id);
|
||||
|
||||
@Insert({"insert into `parking`(`parkingName`,`address`,`type`,`carsNumber`,`enable`,`coord`) VALUES(#{parkingName},#{address},#{type},#{carsNumber},#{enable},#{coord})"})
|
||||
@Transactional
|
||||
void addParking(Parking parking);
|
||||
|
||||
@Delete({"delete from `parking` where `id`=#{id}"})
|
||||
boolean DeleteParkingById(String Id);
|
||||
|
||||
@Select({"select * from `parking` where `id`=#{id}"})
|
||||
Parking ParkingId(Integer Id);
|
||||
|
||||
@Update({"UPDATE `parking` SET parkingName = #{parkingName}, address = #{address}, type = #{type}, carsNumber = #{carsNumber}, enable = #{enable}, coord = #{coord} where id = #{id}"})
|
||||
void update(Parking parking);
|
||||
}
|
31
src/main/java/com/luozhihui/project/mapper/PhoneMapper.java
Normal file
31
src/main/java/com/luozhihui/project/mapper/PhoneMapper.java
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Phone;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Mapper
|
||||
public interface PhoneMapper {
|
||||
@Insert({"insert into `phone`(`phone`,`code`) VALUES(#{phone},#{code})"})
|
||||
@Transactional
|
||||
void save(Phone user);
|
||||
|
||||
@Select({"select * from `phone` where `phone` = #{phone}"})
|
||||
boolean findByPhone(String phone);
|
||||
|
||||
@Delete({"delete from `phone` where `phone`=#{phone}"})
|
||||
void deleteCode(String phone);
|
||||
|
||||
@Select({"select `code` from `phone` where `phone`=#{phone}"})
|
||||
List<String> findByCode(@Param("phone") String phone);
|
||||
}
|
41
src/main/java/com/luozhihui/project/mapper/PostMapper.java
Normal file
41
src/main/java/com/luozhihui/project/mapper/PostMapper.java
Normal file
@ -0,0 +1,41 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Post;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
@Mapper
|
||||
public interface PostMapper {
|
||||
@Select({"SELECT p.*, u.UserName, c.name AS categoryName FROM post p JOIN user u ON p.userId = u.UserId LEFT JOIN category c ON p.categoryId = c.id WHERE p.status = 1 AND (#{categoryId} IS NULL OR p.categoryId = #{categoryId}) AND (#{searchText} IS NULL OR p.title LIKE CONCAT('%', #{searchText}, '%')) ORDER BY p.createTime DESC LIMIT #{offset}, #{pageSize}"})
|
||||
List<Post> selectPostList(@Param("categoryId") Long categoryId, @Param("searchText") String searchText, @Param("offset") int offset, @Param("pageSize") int pageSize);
|
||||
|
||||
@Select({"SELECT COUNT(*) FROM post p WHERE p.status = 1 AND (#{categoryId} IS NULL OR p.categoryId = #{categoryId}) AND (#{searchText} IS NULL OR p.title LIKE CONCAT('%', #{searchText}, '%'))"})
|
||||
int countPosts(@Param("categoryId") Long categoryId, @Param("searchText") String searchText);
|
||||
|
||||
@Select({"SELECT p.*, c.name AS categoryName, u.userName FROM post p JOIN category c ON p.categoryId = c.id JOIN user u ON p.userId = u.UserId WHERE p.id = #{id} AND p.status = 1"})
|
||||
Post selectById(@Param("id") Long id);
|
||||
|
||||
@Update({" UPDATE post SET viewCount = #{viewCount}, likeCount = #{likeCount}, replyCount = #{replyCount}, updateTime = NOW() WHERE id = #{id}"})
|
||||
int updateById(Post post);
|
||||
|
||||
@Insert({" INSERT INTO post (title, content, userId, categoryId, status,viewCount, likeCount, replyCount, createTime, updateTime)VALUES (#{title}, #{content}, #{userId}, #{categoryId}, #{status},#{viewCount}, #{likeCount}, #{replyCount}, NOW(), NOW())"})
|
||||
@Options(
|
||||
useGeneratedKeys = true,
|
||||
keyProperty = "id"
|
||||
)
|
||||
int insert(Post post);
|
||||
|
||||
@Delete({"DELETE FROM post WHERE id = #{id}"})
|
||||
int deletePost(@Param("id") Long id);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Repair;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface RepairShowMapper {
|
||||
@Select({"select `repair`.*,`car`.* from `repair` INNER JOIN `car` ON `repair`.CarId=`car`.CarId"})
|
||||
List<Repair> FindAllRepair();
|
||||
|
||||
@Select({"select * from `repair` where RepairId = #{RepairId}"})
|
||||
Repair FindRepairById(String RepairId);
|
||||
|
||||
@Insert({"insert into `repair`(`CarId`,`RepairReason`,`RepairMoney`,`RepairStatus`) VALUES(#{CarId},#{RepairReason},#{RepairMoney},#{RepairStatus})"})
|
||||
@Transactional
|
||||
void addRepair(Repair repair);
|
||||
|
||||
@Delete({"delete from `repair` where `RepairId`=#{RepairId}"})
|
||||
boolean DeleteRepairById(String CarId);
|
||||
|
||||
@Update({"UPDATE repair SET RepairReason = #{RepairReason}, RepairMoney = #{RepairMoney}, RepairStatus = #{RepairStatus} where RepairId = #{RepairId}"})
|
||||
void update(Repair repair);
|
||||
|
||||
@Update({"UPDATE `car` SET carStatus = 2 WHERE carId = #{carId}"})
|
||||
void updateCarStatusToRepair(Integer carId);
|
||||
|
||||
@Update({"UPDATE `car` SET carStatus = 0 WHERE carId = #{carId}"})
|
||||
void updateCarStatusToAvailable(int carId);
|
||||
}
|
30
src/main/java/com/luozhihui/project/mapper/ReplyMapper.java
Normal file
30
src/main/java/com/luozhihui/project/mapper/ReplyMapper.java
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.Reply;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
@Mapper
|
||||
public interface ReplyMapper {
|
||||
@Select({"SELECT r.*, u.userName , u.avatar FROM reply r LEFT JOIN user u ON r.userId = u.UserId WHERE r.postId = #{postId} AND r.status = 1 ORDER BY r.createTime"})
|
||||
List<Reply> selectRepliesByPostId(Long postId);
|
||||
|
||||
@Insert({"INSERT INTO reply (content, postId, userId, parentId, status, createTime, updateTime) VALUES (#{content}, #{postId}, #{userId}, 1, #{status}, NOW(), NOW())"})
|
||||
int insertReply(Reply reply);
|
||||
|
||||
@Update({"UPDATE reply SET content = #{content}, updateTime = NOW() WHERE id = #{id}"})
|
||||
int updateReply(Reply reply);
|
||||
|
||||
@Delete({"DELETE FROM reply WHERE id = #{id}"})
|
||||
int deleteReply(@Param("id") Long id);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.User;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
public interface UserInfoMapper {
|
||||
@Select({"SELECT * FROM `user` WHERE UserId = #{user_id}"})
|
||||
User findById(Integer id);
|
||||
|
||||
@Update({"UPDATE user SET UserName = #{UserName},Phone = #{Phone}, PassWord = #{PassWord}, IdCard = #{IdCard},DriverLicense=#{DriverLicense},avatar=#{avatar} where UserId = #{UserId}"})
|
||||
void update(User user);
|
||||
|
||||
@Update({"UPDATE user SET UserName = #{UserName},Phone = #{Phone}, IdCard = #{IdCard},DriverLicense=#{DriverLicense} where UserId = #{UserId}"})
|
||||
void shiming(User user);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.User;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
public interface UserLoginMapper {
|
||||
@Select({"select * from `user` where `phone`=#{phone}"})
|
||||
List<User> findByPhone(@Param("phone") String phone);
|
||||
|
||||
@Select({"select * from `car` where `CarId`=#{CarId}"})
|
||||
List<User> FindUserById(Integer UserId);
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.User;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface UserRegMapper {
|
||||
@Insert({"insert into `user`(`Phone`,`UserName`,`PassWord`,`IdCard`,`DriverLicense`) VALUES(#{Phone},#{UserName},#{PassWord},#{IdCard},#{DriverLicense})"})
|
||||
@Transactional
|
||||
void save(User user);
|
||||
|
||||
@Select({"select `code` from `user` where `phone`=#{phone}"})
|
||||
List<String> findByCode(@Param("phone") String phone);
|
||||
|
||||
@Select({"select * from `user` where `phone`=#{phone}"})
|
||||
User findByPhone(@Param("phone") String phone);
|
||||
|
||||
void deleteCode(String phone);
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.mapper;
|
||||
|
||||
import com.luozhihui.project.entity.User;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface UserShowMapper {
|
||||
@Select({"select * from `user`"})
|
||||
List<User> FindAllUser();
|
||||
|
||||
@Select({"select * from `user` where `UserId`=#{UserId}"})
|
||||
List<User> FindUserById(String UserId);
|
||||
|
||||
@Select({"select * from `user` where `userName`=#{userName}"})
|
||||
List<User> FindUserByuserName(String userName);
|
||||
|
||||
@Delete({"delete from `user` where `UserId`=#{UserId}"})
|
||||
boolean DeleteUserById(String phone);
|
||||
|
||||
@Insert({"insert into `user`(`Phone`,`UserName`,`PassWord`,`IdCard`,`DriverLicense`) VALUES(#{Phone},#{UserName},#{PassWord},#{IdCard},#{DriverLicense})"})
|
||||
@Transactional
|
||||
void adduser(User user);
|
||||
}
|
83
src/main/java/com/luozhihui/project/util/JwtUtil.java
Normal file
83
src/main/java/com/luozhihui/project/util/JwtUtil.java
Normal file
@ -0,0 +1,83 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.luozhihui.project.util;
|
||||
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
import com.auth0.jwt.exceptions.TokenExpiredException;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import com.auth0.jwt.interfaces.JWTVerifier;
|
||||
import com.auth0.jwt.interfaces.Verification;
|
||||
import java.util.Date;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(
|
||||
prefix = "jwt"
|
||||
)
|
||||
public class JwtUtil {
|
||||
public static String header;
|
||||
public static String tokenPrefix;
|
||||
public static String secret;
|
||||
public static long expireTime;
|
||||
public static final String USER_LOGIN_TOKEN = "token";
|
||||
|
||||
public JwtUtil() {
|
||||
}
|
||||
|
||||
public void setHeader(String header) {
|
||||
JwtUtil.header = header;
|
||||
}
|
||||
|
||||
public void setTokenPrefix(String tokenPrefix) {
|
||||
JwtUtil.tokenPrefix = tokenPrefix;
|
||||
}
|
||||
|
||||
public void setSecret(String secret) {
|
||||
JwtUtil.secret = secret;
|
||||
}
|
||||
|
||||
public void setExpireTime(int expireTimeInt) {
|
||||
expireTime = (long)expireTimeInt;
|
||||
}
|
||||
|
||||
public static String createToken(String sub) {
|
||||
return tokenPrefix + JWT.create().withSubject(sub).withExpiresAt(new Date(System.currentTimeMillis() + expireTime)).sign(Algorithm.HMAC512(secret));
|
||||
}
|
||||
|
||||
public static String validateToken(String token) throws Exception {
|
||||
try {
|
||||
Verification verification = JWT.require(Algorithm.HMAC512(secret));
|
||||
JWTVerifier jwtVerifier = verification.build();
|
||||
String noPrefixToken = token.replace(tokenPrefix, "");
|
||||
DecodedJWT decodedJwt = jwtVerifier.verify(noPrefixToken);
|
||||
return decodedJwt != null ? decodedJwt.getSubject() : "";
|
||||
} catch (TokenExpiredException var5) {
|
||||
TokenExpiredException e = var5;
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
} catch (Exception var6) {
|
||||
Exception e = var6;
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNeedUpdate(String token) throws Exception {
|
||||
Date expiresAt = null;
|
||||
|
||||
try {
|
||||
expiresAt = JWT.require(Algorithm.HMAC512(secret)).build().verify(token.replace(tokenPrefix, "")).getExpiresAt();
|
||||
} catch (TokenExpiredException var3) {
|
||||
return true;
|
||||
} catch (Exception var4) {
|
||||
throw new Exception("token 验证失败");
|
||||
}
|
||||
|
||||
return expiresAt.getTime() - System.currentTimeMillis() < expireTime >> 1;
|
||||
}
|
||||
}
|
30
src/main/resources/application.properties
Normal file
30
src/main/resources/application.properties
Normal file
@ -0,0 +1,30 @@
|
||||
#spring boot??
|
||||
server.port=8898
|
||||
#??? 127.0.0.1?
|
||||
spring.datasource.url=jdbc:mysql://110.40.62.21:3306/car?serverTimezone=GMT%2B8&characterEncoding=utf-8&useSSL=false
|
||||
#????
|
||||
spring.datasource.username=car
|
||||
#?????
|
||||
spring.datasource.password=123456
|
||||
#JDBC
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
mybatis.mapper-locations=classpath:mapper/*.xml
|
||||
#MAIL??
|
||||
spring.mail.default-encoding= utf-8
|
||||
#mail.user= smtpdm.aliyun.com
|
||||
mail.user= shuguang@email.92wap.cn
|
||||
mail.password= LIUSHUguang520
|
||||
#smsbao.com?????
|
||||
smsbao.username=15829561090
|
||||
smsbao.password=13991564254
|
||||
# JWT ??
|
||||
# token ??
|
||||
jwt.header=Authorization
|
||||
# token ??
|
||||
jwt.tokenPrefix=Bearer
|
||||
# ????????
|
||||
jwt.secret=qwertyuiop1214156
|
||||
# token ????
|
||||
jwt.expireTime=2147483647
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.luozhihui.project;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class CarManagerApplicationTests {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user