forked from sd_delivery/delivery
commit
40fe74af25
43 changed files with 6412 additions and 0 deletions
@ -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/ |
Binary file not shown.
@ -0,0 +1,2 @@ |
|||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip |
||||
|
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar |
@ -0,0 +1,331 @@ |
|||||
|
#!/bin/sh |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
# Licensed to the Apache Software Foundation (ASF) under one |
||||
|
# or more contributor license agreements. See the NOTICE file |
||||
|
# distributed with this work for additional information |
||||
|
# regarding copyright ownership. The ASF licenses this file |
||||
|
# to you under the Apache License, Version 2.0 (the |
||||
|
# "License"); you may not use this file except in compliance |
||||
|
# with the License. You may obtain a copy of the License at |
||||
|
# |
||||
|
# https://www.apache.org/licenses/LICENSE-2.0 |
||||
|
# |
||||
|
# Unless required by applicable law or agreed to in writing, |
||||
|
# software distributed under the License is distributed on an |
||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
|
# KIND, either express or implied. See the License for the |
||||
|
# specific language governing permissions and limitations |
||||
|
# under the License. |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
# ---------------------------------------------------------------------------- |
||||
|
# Maven Start Up Batch script |
||||
|
# |
||||
|
# Required ENV vars: |
||||
|
# ------------------ |
||||
|
# JAVA_HOME - location of a JDK home dir |
||||
|
# |
||||
|
# Optional ENV vars |
||||
|
# ----------------- |
||||
|
# M2_HOME - location of maven2's installed home dir |
||||
|
# MAVEN_OPTS - parameters passed to the Java VM when running Maven |
||||
|
# e.g. to debug Maven itself, use |
||||
|
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
||||
|
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
if [ -z "$MAVEN_SKIP_RC" ]; then |
||||
|
|
||||
|
if [ -f /usr/local/etc/mavenrc ]; then |
||||
|
. /usr/local/etc/mavenrc |
||||
|
fi |
||||
|
|
||||
|
if [ -f /etc/mavenrc ]; then |
||||
|
. /etc/mavenrc |
||||
|
fi |
||||
|
|
||||
|
if [ -f "$HOME/.mavenrc" ]; then |
||||
|
. "$HOME/.mavenrc" |
||||
|
fi |
||||
|
|
||||
|
fi |
||||
|
|
||||
|
# OS specific support. $var _must_ be set to either true or false. |
||||
|
cygwin=false |
||||
|
darwin=false |
||||
|
mingw=false |
||||
|
case "$(uname)" in |
||||
|
CYGWIN*) cygwin=true ;; |
||||
|
MINGW*) mingw=true ;; |
||||
|
Darwin*) |
||||
|
darwin=true |
||||
|
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home |
||||
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html |
||||
|
if [ -z "$JAVA_HOME" ]; then |
||||
|
if [ -x "/usr/libexec/java_home" ]; then |
||||
|
export JAVA_HOME="$(/usr/libexec/java_home)" |
||||
|
else |
||||
|
export JAVA_HOME="/Library/Java/Home" |
||||
|
fi |
||||
|
fi |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
if [ -z "$JAVA_HOME" ]; then |
||||
|
if [ -r /etc/gentoo-release ]; then |
||||
|
JAVA_HOME=$(java-config --jre-home) |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$M2_HOME" ]; then |
||||
|
## resolve links - $0 may be a link to maven's home |
||||
|
PRG="$0" |
||||
|
|
||||
|
# need this for relative symlinks |
||||
|
while [ -h "$PRG" ]; do |
||||
|
ls=$(ls -ld "$PRG") |
||||
|
link=$(expr "$ls" : '.*-> \(.*\)$') |
||||
|
if expr "$link" : '/.*' >/dev/null; then |
||||
|
PRG="$link" |
||||
|
else |
||||
|
PRG="$(dirname "$PRG")/$link" |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
saveddir=$(pwd) |
||||
|
|
||||
|
M2_HOME=$(dirname "$PRG")/.. |
||||
|
|
||||
|
# make it fully qualified |
||||
|
M2_HOME=$(cd "$M2_HOME" && pwd) |
||||
|
|
||||
|
cd "$saveddir" |
||||
|
# echo Using m2 at $M2_HOME |
||||
|
fi |
||||
|
|
||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched |
||||
|
if $cygwin; then |
||||
|
[ -n "$M2_HOME" ] && |
||||
|
M2_HOME=$(cygpath --unix "$M2_HOME") |
||||
|
[ -n "$JAVA_HOME" ] && |
||||
|
JAVA_HOME=$(cygpath --unix "$JAVA_HOME") |
||||
|
[ -n "$CLASSPATH" ] && |
||||
|
CLASSPATH=$(cygpath --path --unix "$CLASSPATH") |
||||
|
fi |
||||
|
|
||||
|
# For Mingw, ensure paths are in UNIX format before anything is touched |
||||
|
if $mingw; then |
||||
|
[ -n "$M2_HOME" ] && |
||||
|
M2_HOME="$( ( |
||||
|
cd "$M2_HOME" |
||||
|
pwd |
||||
|
))" |
||||
|
[ -n "$JAVA_HOME" ] && |
||||
|
JAVA_HOME="$( ( |
||||
|
cd "$JAVA_HOME" |
||||
|
pwd |
||||
|
))" |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$JAVA_HOME" ]; then |
||||
|
javaExecutable="$(which javac)" |
||||
|
if [ -n "$javaExecutable" ] && ! [ "$(expr \"$javaExecutable\" : '\([^ ]*\)')" = "no" ]; then |
||||
|
# readlink(1) is not available as standard on Solaris 10. |
||||
|
readLink=$(which readlink) |
||||
|
if [ ! $(expr "$readLink" : '\([^ ]*\)') = "no" ]; then |
||||
|
if $darwin; then |
||||
|
javaHome="$(dirname \"$javaExecutable\")" |
||||
|
javaExecutable="$(cd \"$javaHome\" && pwd -P)/javac" |
||||
|
else |
||||
|
javaExecutable="$(readlink -f \"$javaExecutable\")" |
||||
|
fi |
||||
|
javaHome="$(dirname \"$javaExecutable\")" |
||||
|
javaHome=$(expr "$javaHome" : '\(.*\)/bin') |
||||
|
JAVA_HOME="$javaHome" |
||||
|
export JAVA_HOME |
||||
|
fi |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$JAVACMD" ]; then |
||||
|
if [ -n "$JAVA_HOME" ]; then |
||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ]; then |
||||
|
# IBM's JDK on AIX uses strange locations for the executables |
||||
|
JAVACMD="$JAVA_HOME/jre/sh/java" |
||||
|
else |
||||
|
JAVACMD="$JAVA_HOME/bin/java" |
||||
|
fi |
||||
|
else |
||||
|
JAVACMD="$( |
||||
|
\unset -f command |
||||
|
\command -v java |
||||
|
)" |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
if [ ! -x "$JAVACMD" ]; then |
||||
|
echo "Error: JAVA_HOME is not defined correctly." >&2 |
||||
|
echo " We cannot execute $JAVACMD" >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$JAVA_HOME" ]; then |
||||
|
echo "Warning: JAVA_HOME environment variable is not set." |
||||
|
fi |
||||
|
|
||||
|
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher |
||||
|
|
||||
|
# traverses directory structure from process work directory to filesystem root |
||||
|
# first directory with .mvn subdirectory is considered project base directory |
||||
|
find_maven_basedir() { |
||||
|
|
||||
|
if [ -z "$1" ]; then |
||||
|
echo "Path not specified to find_maven_basedir" |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
basedir="$1" |
||||
|
wdir="$1" |
||||
|
while [ "$wdir" != '/' ]; do |
||||
|
if [ -d "$wdir"/.mvn ]; then |
||||
|
basedir=$wdir |
||||
|
break |
||||
|
fi |
||||
|
# workaround for JBEAP-8937 (on Solaris 10/Sparc) |
||||
|
if [ -d "${wdir}" ]; then |
||||
|
wdir=$( |
||||
|
cd "$wdir/.." |
||||
|
pwd |
||||
|
) |
||||
|
fi |
||||
|
# end of workaround |
||||
|
done |
||||
|
echo "${basedir}" |
||||
|
} |
||||
|
|
||||
|
# concatenates all lines of a file |
||||
|
concat_lines() { |
||||
|
if [ -f "$1" ]; then |
||||
|
echo "$(tr -s '\n' ' ' <"$1")" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
BASE_DIR=$(find_maven_basedir "$(pwd)") |
||||
|
if [ -z "$BASE_DIR" ]; then |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
########################################################################################## |
||||
|
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
||||
|
# This allows using the maven wrapper in projects that prohibit checking in binary data. |
||||
|
########################################################################################## |
||||
|
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then |
||||
|
if [ "$MVNW_VERBOSE" = true ]; then |
||||
|
echo "Found .mvn/wrapper/maven-wrapper.jar" |
||||
|
fi |
||||
|
else |
||||
|
if [ "$MVNW_VERBOSE" = true ]; then |
||||
|
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." |
||||
|
fi |
||||
|
if [ -n "$MVNW_REPOURL" ]; then |
||||
|
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
||||
|
else |
||||
|
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
||||
|
fi |
||||
|
while IFS="=" read key value; do |
||||
|
case "$key" in wrapperUrl) |
||||
|
jarUrl="$value" |
||||
|
break |
||||
|
;; |
||||
|
esac |
||||
|
done <"$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" |
||||
|
if [ "$MVNW_VERBOSE" = true ]; then |
||||
|
echo "Downloading from: $jarUrl" |
||||
|
fi |
||||
|
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" |
||||
|
if $cygwin; then |
||||
|
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") |
||||
|
fi |
||||
|
|
||||
|
if command -v wget >/dev/null; then |
||||
|
if [ "$MVNW_VERBOSE" = true ]; then |
||||
|
echo "Found wget ... using wget" |
||||
|
fi |
||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
||||
|
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" |
||||
|
else |
||||
|
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" |
||||
|
fi |
||||
|
elif command -v curl >/dev/null; then |
||||
|
if [ "$MVNW_VERBOSE" = true ]; then |
||||
|
echo "Found curl ... using curl" |
||||
|
fi |
||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
||||
|
curl -o "$wrapperJarPath" "$jarUrl" -f |
||||
|
else |
||||
|
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f |
||||
|
fi |
||||
|
|
||||
|
else |
||||
|
if [ "$MVNW_VERBOSE" = true ]; then |
||||
|
echo "Falling back to using Java to download" |
||||
|
fi |
||||
|
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" |
||||
|
# For Cygwin, switch paths to Windows format before running javac |
||||
|
if $cygwin; then |
||||
|
javaClass=$(cygpath --path --windows "$javaClass") |
||||
|
fi |
||||
|
if [ -e "$javaClass" ]; then |
||||
|
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then |
||||
|
if [ "$MVNW_VERBOSE" = true ]; then |
||||
|
echo " - Compiling MavenWrapperDownloader.java ..." |
||||
|
fi |
||||
|
# Compiling the Java class |
||||
|
("$JAVA_HOME/bin/javac" "$javaClass") |
||||
|
fi |
||||
|
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then |
||||
|
# Running the downloader |
||||
|
if [ "$MVNW_VERBOSE" = true ]; then |
||||
|
echo " - Running MavenWrapperDownloader.java ..." |
||||
|
fi |
||||
|
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") |
||||
|
fi |
||||
|
fi |
||||
|
fi |
||||
|
fi |
||||
|
########################################################################################## |
||||
|
# End of extension |
||||
|
########################################################################################## |
||||
|
|
||||
|
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} |
||||
|
if [ "$MVNW_VERBOSE" = true ]; then |
||||
|
echo $MAVEN_PROJECTBASEDIR |
||||
|
fi |
||||
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" |
||||
|
|
||||
|
# For Cygwin, switch paths to Windows format before running java |
||||
|
if $cygwin; then |
||||
|
[ -n "$M2_HOME" ] && |
||||
|
M2_HOME=$(cygpath --path --windows "$M2_HOME") |
||||
|
[ -n "$JAVA_HOME" ] && |
||||
|
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") |
||||
|
[ -n "$CLASSPATH" ] && |
||||
|
CLASSPATH=$(cygpath --path --windows "$CLASSPATH") |
||||
|
[ -n "$MAVEN_PROJECTBASEDIR" ] && |
||||
|
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") |
||||
|
fi |
||||
|
|
||||
|
# Provide a "standardized" way to retrieve the CLI args that will |
||||
|
# work with both Windows and non-Windows executions. |
||||
|
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" |
||||
|
export MAVEN_CMD_LINE_ARGS |
||||
|
|
||||
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
||||
|
|
||||
|
exec "$JAVACMD" \ |
||||
|
$MAVEN_OPTS \ |
||||
|
$MAVEN_DEBUG_OPTS \ |
||||
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ |
||||
|
"-Dmaven.home=${M2_HOME}" \ |
||||
|
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ |
||||
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" |
@ -0,0 +1,188 @@ |
|||||
|
@REM ---------------------------------------------------------------------------- |
||||
|
@REM Licensed to the Apache Software Foundation (ASF) under one |
||||
|
@REM or more contributor license agreements. See the NOTICE file |
||||
|
@REM distributed with this work for additional information |
||||
|
@REM regarding copyright ownership. The ASF licenses this file |
||||
|
@REM to you under the Apache License, Version 2.0 (the |
||||
|
@REM "License"); you may not use this file except in compliance |
||||
|
@REM with the License. You may obtain a copy of the License at |
||||
|
@REM |
||||
|
@REM https://www.apache.org/licenses/LICENSE-2.0 |
||||
|
@REM |
||||
|
@REM Unless required by applicable law or agreed to in writing, |
||||
|
@REM software distributed under the License is distributed on an |
||||
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
|
@REM KIND, either express or implied. See the License for the |
||||
|
@REM specific language governing permissions and limitations |
||||
|
@REM under the License. |
||||
|
@REM ---------------------------------------------------------------------------- |
||||
|
|
||||
|
@REM ---------------------------------------------------------------------------- |
||||
|
@REM Maven Start Up Batch script |
||||
|
@REM |
||||
|
@REM Required ENV vars: |
||||
|
@REM JAVA_HOME - location of a JDK home dir |
||||
|
@REM |
||||
|
@REM Optional ENV vars |
||||
|
@REM M2_HOME - location of maven2's installed home dir |
||||
|
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands |
||||
|
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending |
||||
|
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven |
||||
|
@REM e.g. to debug Maven itself, use |
||||
|
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
||||
|
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
||||
|
@REM ---------------------------------------------------------------------------- |
||||
|
|
||||
|
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' |
||||
|
@echo off |
||||
|
@REM set title of command window |
||||
|
title %0 |
||||
|
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' |
||||
|
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% |
||||
|
|
||||
|
@REM set %HOME% to equivalent of $HOME |
||||
|
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") |
||||
|
|
||||
|
@REM Execute a user defined script before this one |
||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre |
||||
|
@REM check for pre script, once with legacy .bat ending and once with .cmd ending |
||||
|
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* |
||||
|
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* |
||||
|
:skipRcPre |
||||
|
|
||||
|
@setlocal |
||||
|
|
||||
|
set ERROR_CODE=0 |
||||
|
|
||||
|
@REM To isolate internal variables from possible post scripts, we use another setlocal |
||||
|
@setlocal |
||||
|
|
||||
|
@REM ==== START VALIDATION ==== |
||||
|
if not "%JAVA_HOME%" == "" goto OkJHome |
||||
|
|
||||
|
echo. |
||||
|
echo Error: JAVA_HOME not found in your environment. >&2 |
||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
||||
|
echo location of your Java installation. >&2 |
||||
|
echo. |
||||
|
goto error |
||||
|
|
||||
|
:OkJHome |
||||
|
if exist "%JAVA_HOME%\bin\java.exe" goto init |
||||
|
|
||||
|
echo. |
||||
|
echo Error: JAVA_HOME is set to an invalid directory. >&2 |
||||
|
echo JAVA_HOME = "%JAVA_HOME%" >&2 |
||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
||||
|
echo location of your Java installation. >&2 |
||||
|
echo. |
||||
|
goto error |
||||
|
|
||||
|
@REM ==== END VALIDATION ==== |
||||
|
|
||||
|
:init |
||||
|
|
||||
|
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". |
||||
|
@REM Fallback to current working directory if not found. |
||||
|
|
||||
|
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% |
||||
|
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir |
||||
|
|
||||
|
set EXEC_DIR=%CD% |
||||
|
set WDIR=%EXEC_DIR% |
||||
|
:findBaseDir |
||||
|
IF EXIST "%WDIR%"\.mvn goto baseDirFound |
||||
|
cd .. |
||||
|
IF "%WDIR%"=="%CD%" goto baseDirNotFound |
||||
|
set WDIR=%CD% |
||||
|
goto findBaseDir |
||||
|
|
||||
|
:baseDirFound |
||||
|
set MAVEN_PROJECTBASEDIR=%WDIR% |
||||
|
cd "%EXEC_DIR%" |
||||
|
goto endDetectBaseDir |
||||
|
|
||||
|
:baseDirNotFound |
||||
|
set MAVEN_PROJECTBASEDIR=%EXEC_DIR% |
||||
|
cd "%EXEC_DIR%" |
||||
|
|
||||
|
:endDetectBaseDir |
||||
|
|
||||
|
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig |
||||
|
|
||||
|
@setlocal EnableExtensions EnableDelayedExpansion |
||||
|
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a |
||||
|
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% |
||||
|
|
||||
|
:endReadAdditionalConfig |
||||
|
|
||||
|
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" |
||||
|
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" |
||||
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
||||
|
|
||||
|
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
||||
|
|
||||
|
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( |
||||
|
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B |
||||
|
) |
||||
|
|
||||
|
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
||||
|
@REM This allows using the maven wrapper in projects that prohibit checking in binary data. |
||||
|
if exist %WRAPPER_JAR% ( |
||||
|
if "%MVNW_VERBOSE%" == "true" ( |
||||
|
echo Found %WRAPPER_JAR% |
||||
|
) |
||||
|
) else ( |
||||
|
if not "%MVNW_REPOURL%" == "" ( |
||||
|
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
||||
|
) |
||||
|
if "%MVNW_VERBOSE%" == "true" ( |
||||
|
echo Couldn't find %WRAPPER_JAR%, downloading it ... |
||||
|
echo Downloading from: %DOWNLOAD_URL% |
||||
|
) |
||||
|
|
||||
|
powershell -Command "&{"^ |
||||
|
"$webclient = new-object System.Net.WebClient;"^ |
||||
|
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ |
||||
|
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ |
||||
|
"}"^ |
||||
|
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ |
||||
|
"}" |
||||
|
if "%MVNW_VERBOSE%" == "true" ( |
||||
|
echo Finished downloading %WRAPPER_JAR% |
||||
|
) |
||||
|
) |
||||
|
@REM End of extension |
||||
|
|
||||
|
@REM Provide a "standardized" way to retrieve the CLI args that will |
||||
|
@REM work with both Windows and non-Windows executions. |
||||
|
set MAVEN_CMD_LINE_ARGS=%* |
||||
|
|
||||
|
%MAVEN_JAVA_EXE% ^ |
||||
|
%JVM_CONFIG_MAVEN_PROPS% ^ |
||||
|
%MAVEN_OPTS% ^ |
||||
|
%MAVEN_DEBUG_OPTS% ^ |
||||
|
-classpath %WRAPPER_JAR% ^ |
||||
|
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ |
||||
|
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* |
||||
|
if ERRORLEVEL 1 goto error |
||||
|
goto end |
||||
|
|
||||
|
:error |
||||
|
set ERROR_CODE=1 |
||||
|
|
||||
|
:end |
||||
|
@endlocal & set ERROR_CODE=%ERROR_CODE% |
||||
|
|
||||
|
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost |
||||
|
@REM check for post script, once with legacy .bat ending and once with .cmd ending |
||||
|
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" |
||||
|
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" |
||||
|
:skipRcPost |
||||
|
|
||||
|
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' |
||||
|
if "%MAVEN_BATCH_PAUSE%"=="on" pause |
||||
|
|
||||
|
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% |
||||
|
|
||||
|
cmd /C exit /B %ERROR_CODE% |
@ -0,0 +1,286 @@ |
|||||
|
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<groupId>com.ccsens</groupId> |
||||
|
<artifactId>delivery</artifactId> |
||||
|
<version>1.0-SNAPSHOT</version> |
||||
|
|
||||
|
<properties> |
||||
|
<java.version>1.8</java.version> |
||||
|
</properties> |
||||
|
<parent> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-parent</artifactId> |
||||
|
<version>2.1.8.RELEASE</version> |
||||
|
<relativePath/> <!-- lookup parent from repository --> |
||||
|
</parent> |
||||
|
<dependencies> |
||||
|
|
||||
|
<!-- <dependency>--> |
||||
|
<!-- <groupId>com.ccsensptos</groupId>--> |
||||
|
<!-- <artifactId>util</artifactId>--> |
||||
|
<!-- <version>1.0-SNAPSHOT</version>--> |
||||
|
<!-- </dependency>--> |
||||
|
<dependency> |
||||
|
<groupId>com.ccsensptos</groupId> |
||||
|
<artifactId>wechatutil</artifactId> |
||||
|
<version>1.0-SNAPSHOT</version> |
||||
|
<scope>compile</scope> |
||||
|
<exclusions> |
||||
|
<exclusion> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-amqp</artifactId> |
||||
|
</exclusion> |
||||
|
<exclusion> |
||||
|
<groupId>com.ccsensptos</groupId> |
||||
|
<artifactId>cloudutil</artifactId> |
||||
|
</exclusion> |
||||
|
</exclusions> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.aspectj</groupId> |
||||
|
<artifactId>aspectjweaver</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- https://mvnrepository.com/artifact/io.netty/netty-all --> |
||||
|
<dependency> |
||||
|
<groupId>io.netty</groupId> |
||||
|
<artifactId>netty-all</artifactId> |
||||
|
<version>4.1.32.Final</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-data-redis</artifactId> |
||||
|
</dependency> |
||||
|
<!--spring 缓存--> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-cache</artifactId> |
||||
|
</dependency> |
||||
|
<!--多redis配置--> |
||||
|
<!--<dependency> |
||||
|
<groupId>redis.clients</groupId> |
||||
|
<artifactId>jedis</artifactId> |
||||
|
</dependency>--> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-jdbc</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
<exclusions> |
||||
|
<exclusion> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-tomcat</artifactId> |
||||
|
</exclusion> |
||||
|
</exclusions> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-jetty</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-configuration-processor</artifactId> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-test</artifactId> |
||||
|
<exclusions> <!--排除android-json,与腾讯短信接口qcloudsms冲突--> |
||||
|
<exclusion> |
||||
|
<groupId>com.vaadin.external.google</groupId> |
||||
|
<artifactId>android-json</artifactId> |
||||
|
</exclusion> |
||||
|
</exclusions> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-actuator</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- hutool-all --> |
||||
|
<dependency> |
||||
|
<groupId>cn.hutool</groupId> |
||||
|
<artifactId>hutool-all</artifactId> |
||||
|
<version>4.1.21</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!--Poi Excel --> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.poi</groupId> |
||||
|
<artifactId>poi</artifactId> |
||||
|
<version>3.17</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.poi</groupId> |
||||
|
<artifactId>poi-ooxml</artifactId> |
||||
|
<version>3.17</version> |
||||
|
</dependency> |
||||
|
<!--websocket--> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-websocket</artifactId> |
||||
|
</dependency> |
||||
|
<!-- spring RabbitMQ--> |
||||
|
<!--<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-amqp</artifactId> |
||||
|
</dependency>--> |
||||
|
<!-- spring MyBatis --> |
||||
|
<dependency> |
||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||
|
<artifactId>mybatis-spring-boot-starter</artifactId> |
||||
|
<version>1.1.1</version> |
||||
|
</dependency> |
||||
|
<!-- mybatis pagehelper包--> |
||||
|
<dependency> |
||||
|
<groupId>com.github.pagehelper</groupId> |
||||
|
<artifactId>pagehelper</artifactId> |
||||
|
<version>4.1.4</version> |
||||
|
</dependency> |
||||
|
<!-- MySQL数据库 --> |
||||
|
<dependency> |
||||
|
<groupId>mysql</groupId> |
||||
|
<artifactId>mysql-connector-java</artifactId> |
||||
|
</dependency> |
||||
|
<!--Durid数据源--> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba</groupId> |
||||
|
<artifactId>druid</artifactId> |
||||
|
<version>1.1.10</version> |
||||
|
</dependency> |
||||
|
<!--jjwt--> |
||||
|
<dependency> |
||||
|
<groupId>io.jsonwebtoken</groupId> |
||||
|
<artifactId>jjwt</artifactId> |
||||
|
<version>0.7.0</version> |
||||
|
</dependency> |
||||
|
|
||||
|
|
||||
|
<!--Jackson Xml--> |
||||
|
<dependency> |
||||
|
<groupId>com.fasterxml.jackson.dataformat</groupId> |
||||
|
<artifactId>jackson-dataformat-xml</artifactId> |
||||
|
<version>2.9.0</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- ehcache 缓存 --> |
||||
|
<!--<dependency> |
||||
|
<groupId>net.sf.ehcache</groupId> |
||||
|
<artifactId>ehcache</artifactId> |
||||
|
</dependency>--> |
||||
|
<!--Shiro --> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.shiro</groupId> |
||||
|
<artifactId>shiro-spring</artifactId> |
||||
|
<version>1.4.0</version> |
||||
|
</dependency> |
||||
|
<!-- shiro ehcache --> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.shiro</groupId> |
||||
|
<artifactId>shiro-ehcache</artifactId> |
||||
|
<version>1.4.0</version> |
||||
|
</dependency> |
||||
|
<!--HtmlCleaner--> |
||||
|
<dependency> |
||||
|
<groupId>net.sourceforge.htmlcleaner</groupId> |
||||
|
<artifactId>htmlcleaner</artifactId> |
||||
|
<version>2.22</version> |
||||
|
</dependency> |
||||
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.commons</groupId> |
||||
|
<artifactId>commons-lang3</artifactId> |
||||
|
<version>3.8.1</version> |
||||
|
</dependency> |
||||
|
|
||||
|
|
||||
|
<!--Swagger --> |
||||
|
<dependency> |
||||
|
<groupId>io.springfox</groupId> |
||||
|
<artifactId>springfox-swagger2</artifactId> |
||||
|
<version>2.9.2</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>io.springfox</groupId> |
||||
|
<artifactId>springfox-swagger-ui</artifactId> |
||||
|
<version>2.9.2</version> |
||||
|
</dependency> |
||||
|
<!--mybatis generator包--> |
||||
|
<dependency> |
||||
|
<groupId>org.mybatis.generator</groupId> |
||||
|
<artifactId>mybatis-generator-core</artifactId> |
||||
|
<version>1.3.7</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- https://mvnrepository.com/artifact/org.beanshell/bsh --> |
||||
|
<dependency> |
||||
|
<groupId>org.beanshell</groupId> |
||||
|
<artifactId>bsh</artifactId> |
||||
|
<version>2.0b5</version> |
||||
|
</dependency> |
||||
|
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.httpcomponents</groupId> |
||||
|
<artifactId>httpclient</artifactId> |
||||
|
<version>4.5.1</version> |
||||
|
</dependency> |
||||
|
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore --> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.httpcomponents</groupId> |
||||
|
<artifactId>httpcore</artifactId> |
||||
|
<version>4.4.3</version> |
||||
|
</dependency> |
||||
|
<!-- <!–腾讯短信–>--> |
||||
|
<!-- <dependency>--> |
||||
|
<!-- <groupId>com.github.qcloudsms</groupId>--> |
||||
|
<!-- <artifactId>qcloudsms</artifactId>--> |
||||
|
<!-- <version>1.0.5</version>--> |
||||
|
<!-- </dependency>--> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba</groupId> |
||||
|
<artifactId>fastjson</artifactId> |
||||
|
<version>1.2.62</version> |
||||
|
</dependency> |
||||
|
|
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.mybatis.generator</groupId> |
||||
|
<artifactId>mybatis-generator-maven-plugin</artifactId> |
||||
|
<version>1.3.7</version> |
||||
|
<configuration> |
||||
|
<configurationFile>${basedir}/src/main/resources/mbg.xml</configurationFile> |
||||
|
<overwrite>true</overwrite> |
||||
|
</configuration> |
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>mysql</groupId> |
||||
|
<artifactId>mysql-connector-java</artifactId> |
||||
|
<version>5.1.34</version> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
</project> |
@ -0,0 +1,23 @@ |
|||||
|
package com.ccsens.delivery; |
||||
|
|
||||
|
import org.mybatis.spring.annotation.MapperScan; |
||||
|
import org.springframework.boot.SpringApplication; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
import org.springframework.boot.web.servlet.ServletComponentScan; |
||||
|
import org.springframework.cache.annotation.EnableCaching; |
||||
|
import org.springframework.context.annotation.ComponentScan; |
||||
|
import org.springframework.scheduling.annotation.EnableAsync; |
||||
|
|
||||
|
@MapperScan(basePackages = {"com.ccsens.delivery.persist.*"}) |
||||
|
@ServletComponentScan |
||||
|
@EnableCaching |
||||
|
@EnableAsync |
||||
|
@SpringBootApplication |
||||
|
@ComponentScan(basePackages = {"com.ccsens"}) |
||||
|
public class DeliveryApplication { |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
SpringApplication.run(DeliveryApplication.class, args); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.ccsens.delivery.annotation; |
||||
|
|
||||
|
import java.lang.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @description: 用于标识方法需要登录,获取userId |
||||
|
* 如果未登录,直接返回用户未登录 |
||||
|
* @author: wuHuiJuan |
||||
|
* @create: 2019/12/09 09:48 |
||||
|
*/ |
||||
|
@Documented |
||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||
|
@Target(ElementType.METHOD) |
||||
|
public @interface MustLogin { |
||||
|
/** |
||||
|
* -1 不处理 |
||||
|
* 0: 数组 |
||||
|
* 1:List |
||||
|
* 2:Set |
||||
|
* 3: Map |
||||
|
* */ |
||||
|
byte type() default -1; |
||||
|
|
||||
|
} |
@ -0,0 +1,113 @@ |
|||||
|
package com.ccsens.delivery.api; |
||||
|
|
||||
|
import cn.hutool.extra.servlet.ServletUtil; |
||||
|
import com.ccsens.delivery.annotation.MustLogin; |
||||
|
import com.ccsens.delivery.bean.dto.UserDto; |
||||
|
import com.ccsens.delivery.bean.vo.UserVo; |
||||
|
import com.ccsens.delivery.service.IUserService; |
||||
|
import com.ccsens.util.JsonResponse; |
||||
|
import com.ccsens.util.WebConstant; |
||||
|
import com.ccsens.util.bean.dto.QueryDto; |
||||
|
import io.jsonwebtoken.Claims; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiImplicitParams; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import io.swagger.annotations.ApiParam; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
@Api(tags = "user" , description = "用户信息相关接口") |
||||
|
@RestController |
||||
|
@RequestMapping("/users") |
||||
|
@Slf4j |
||||
|
public class UserController { |
||||
|
@Resource |
||||
|
private IUserService userService; |
||||
|
|
||||
|
@ApiOperation(value = "登录", notes = "") |
||||
|
@RequestMapping(value = "/signin", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
||||
|
public JsonResponse<UserVo.TokenBean> userSignin(HttpServletRequest request, @ApiParam @Validated @RequestBody UserDto.SigninDto params) throws Exception{ |
||||
|
log.info("登录:{}",params); |
||||
|
UserVo.TokenBean tokenBean = userService.userSignin(params,request.getHeader("deviceId"), ServletUtil.getClientIP(request)); |
||||
|
log.info("返回用户信息"); |
||||
|
return JsonResponse.newInstance().ok(tokenBean,tokenBean.getToken(),tokenBean.getRefreshToken()); |
||||
|
} |
||||
|
|
||||
|
// @ApiOperation(value = "根据token换取用户信息", notes = "")
|
||||
|
// @RequestMapping(value = "/businessToken", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
||||
|
// public JsonResponse<UserVo.TokenToUserId> userByBusinessToken(HttpServletRequest request, @ApiParam @Validated @RequestBody UserDto.BusinessToken params) throws Exception{
|
||||
|
// log.info("根据token换取用户信息:{}",params);
|
||||
|
// UserVo.TokenToUserId userInfo = userService.userByBusinessToken(request.getHeader("accessToken"),params);
|
||||
|
// log.info("返回用户信息");
|
||||
|
// return JsonResponse.newInstance().ok(userInfo);
|
||||
|
// }
|
||||
|
|
||||
|
@ApiOperation(value = "/发送验证码", notes = "") |
||||
|
@RequestMapping(value = "/smscode", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) |
||||
|
public JsonResponse<UserVo.SmsCode> getSmsCode(@ApiParam @RequestParam String phone, |
||||
|
@RequestParam(required = true) String verificationCodeId, String verificationCodeValue) throws Exception { |
||||
|
log.info("发送验证码,手机号:{},图形验证码id:{},值:{}",phone,verificationCodeId,verificationCodeValue); |
||||
|
UserVo.SmsCode smsCodeVo = userService.getSignInSmsCode(phone,verificationCodeId,verificationCodeValue); |
||||
|
return JsonResponse.newInstance().ok(smsCodeVo); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation(value = "图片验证码") |
||||
|
@ApiImplicitParams({ |
||||
|
}) |
||||
|
@RequestMapping(value = "/code", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) |
||||
|
public JsonResponse<UserVo.VerificationCode> vertifyCode() throws Exception { |
||||
|
UserVo.VerificationCode vertifyCode = userService.getVertifyCode(); |
||||
|
return JsonResponse.newInstance().ok(vertifyCode); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation(value = "根据refreshToken重新获取token",notes = "") |
||||
|
@ApiImplicitParams({ |
||||
|
}) |
||||
|
@RequestMapping(value = "refreshToken",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) |
||||
|
public JsonResponse<UserVo.TokenBean> getTokenByRefreshToken(@RequestParam(required = true) String refreshToken) throws Exception { |
||||
|
log.info("根据refreshToken重新获取token:{}",refreshToken); |
||||
|
UserVo.TokenBean tokenBean = userService.getTokenByRefreshToken(refreshToken); |
||||
|
return JsonResponse.newInstance().ok(tokenBean,tokenBean.getToken(),tokenBean.getRefreshToken()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@ApiOperation(value = "根据token/deviceId获取用户信息",notes = "") |
||||
|
@ApiImplicitParams({ |
||||
|
}) |
||||
|
@RequestMapping(value = "token",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) |
||||
|
public JsonResponse<UserVo.TokenToUserId> getUserByToken(@ApiParam @Validated @RequestBody UserDto.UserInfoByToken params) throws Exception { |
||||
|
log.info("MustLogin根据token查找用户信息:{}",params); |
||||
|
UserVo.TokenToUserId tokenToUserId = userService.getUserByToken(params); |
||||
|
return JsonResponse.newInstance().ok(tokenToUserId); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation(value = "通过手机号获取userId",notes = "") |
||||
|
@ApiImplicitParams({ |
||||
|
}) |
||||
|
@RequestMapping(value = "userIdByPhone",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) |
||||
|
public JsonResponse<List<Long>> getUserIdByPhone(@ApiParam @Validated @RequestBody List<String> phoneList) throws Exception { |
||||
|
log.info("通过手机号获取userId:{}",phoneList); |
||||
|
List<String> userIdList = userService.getUserIdByPhone(phoneList); |
||||
|
return JsonResponse.newInstance().ok(userIdList); |
||||
|
} |
||||
|
|
||||
|
@MustLogin |
||||
|
@ApiOperation(value = "/修改用户信息", notes = "") |
||||
|
@ApiImplicitParams({ |
||||
|
}) |
||||
|
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
||||
|
public JsonResponse<UserVo.TokenBean> updateUserInfo(@ApiParam @RequestBody QueryDto<UserDto.WxInfo> params) throws Exception { |
||||
|
log.info("修改用户信息,{}",params); |
||||
|
UserVo.TokenBean tokenBean = userService.updateUserInfo(params.getUserId(), params.getParam()); |
||||
|
return JsonResponse.newInstance().ok(tokenBean); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,119 @@ |
|||||
|
package com.ccsens.delivery.aspect; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.ccsens.delivery.annotation.MustLogin; |
||||
|
import com.ccsens.delivery.bean.dto.UserDto; |
||||
|
import com.ccsens.delivery.bean.vo.UserVo; |
||||
|
import com.ccsens.delivery.service.IUserService; |
||||
|
import com.ccsens.util.CodeEnum; |
||||
|
import com.ccsens.util.JsonResponse; |
||||
|
import com.ccsens.util.WebConstant; |
||||
|
import com.ccsens.util.bean.dto.QueryDto; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.Signature; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
import org.aspectj.lang.annotation.Pointcut; |
||||
|
import org.aspectj.lang.reflect.MethodSignature; |
||||
|
import org.springframework.core.annotation.Order; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||
|
import org.springframework.web.context.request.ServletRequestAttributes; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.lang.reflect.Array; |
||||
|
import java.lang.reflect.Method; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: wuHuiJuan |
||||
|
* @create: 2019/12/09 09:54 |
||||
|
*/ |
||||
|
@Order(0) |
||||
|
@Slf4j |
||||
|
@Aspect |
||||
|
@Component |
||||
|
public class MustLoginAspect { |
||||
|
@Resource |
||||
|
private IUserService userService; |
||||
|
|
||||
|
@Pointcut("@annotation(com.ccsens.delivery.annotation.MustLogin)") |
||||
|
public void loginAdvice(){} |
||||
|
|
||||
|
@Around("loginAdvice()") |
||||
|
public Object around(ProceedingJoinPoint pjp) throws Throwable { |
||||
|
|
||||
|
HttpServletRequest request = ((ServletRequestAttributes) |
||||
|
RequestContextHolder.getRequestAttributes()).getRequest(); |
||||
|
|
||||
|
final String authHeader = request.getHeader(WebConstant.HEADER_KEY_TOKEN); |
||||
|
|
||||
|
Object[] args = pjp.getArgs(); |
||||
|
QueryDto dto = args == null || args.length < 1 ? null : (QueryDto) args[0]; |
||||
|
|
||||
|
//获取userId
|
||||
|
Long userId = null; |
||||
|
if(StrUtil.isNotEmpty(authHeader)){ |
||||
|
log.info("MustLogin————token:{}", authHeader); |
||||
|
//通过token查找用户信息
|
||||
|
//TODO 根据token获取用户信息
|
||||
|
UserVo.TokenToUserId userByToken = userService.getUserByToken(new UserDto.UserInfoByToken(authHeader)); |
||||
|
if(ObjectUtil.isNull(userByToken)){ |
||||
|
return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN); |
||||
|
} |
||||
|
userId = userByToken.getId(); |
||||
|
} |
||||
|
Signature signature = pjp.getSignature(); |
||||
|
MethodSignature methodSignature = (MethodSignature) signature; |
||||
|
Method targetMethod = methodSignature.getMethod(); |
||||
|
|
||||
|
MustLogin mustLoginAnnotation = targetMethod.getAnnotation(MustLogin.class); |
||||
|
fillSpecial(dto, mustLoginAnnotation); |
||||
|
|
||||
|
//必须登录,未登录直接返回未登录相关信息
|
||||
|
if (ObjectUtil.isNull(userId)) { |
||||
|
return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN); |
||||
|
} |
||||
|
|
||||
|
if (dto != null) { |
||||
|
dto.setUserId(userId); |
||||
|
} |
||||
|
|
||||
|
Object result = pjp.proceed(); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
private void fillSpecial(QueryDto dto, MustLogin mustLoginAnnotation) { |
||||
|
if (mustLoginAnnotation == null) { |
||||
|
return; |
||||
|
} |
||||
|
if (dto != null && mustLoginAnnotation.type() > -1) { |
||||
|
switch (mustLoginAnnotation.type()) { |
||||
|
case 0: |
||||
|
Object obj = dto.getParam(); |
||||
|
if (obj!= null && !obj.getClass().isArray()) { |
||||
|
Class<?> aClass = dto.getParam().getClass(); |
||||
|
Object o = Array.newInstance(aClass, 1); |
||||
|
Array.set(o, 0, dto.getParam()); |
||||
|
dto.setParam(o); |
||||
|
} |
||||
|
break; |
||||
|
case 1: |
||||
|
Object obj1 = dto.getParam(); |
||||
|
if (obj1!= null && !(obj1 instanceof List)) { |
||||
|
ArrayList arrayList = new ArrayList(); |
||||
|
arrayList.add(dto.getParam()); |
||||
|
dto.setParam(arrayList); |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,98 @@ |
|||||
|
package com.ccsens.delivery.bean.dto; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class UserDto { |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("登录") |
||||
|
public static class SigninDto{ |
||||
|
@ApiModelProperty("登录客户端:0-H5,1-小程序") |
||||
|
@NotNull(message = "客户端类型异常") |
||||
|
private Integer client; |
||||
|
@ApiModelProperty("登录类型:0-wxmp(小程序),1-phone(手机),2-email(邮箱),3-accounts(账号),4-OAUTH2_Wx(微信),5-Wx_H5(网页微信),6-OAUTH2_WeiBo, 7-Wx_Enterprise(企业微信),8-公众号登录(关注公众号)") |
||||
|
@NotNull(message = "登录类型异常") |
||||
|
private Integer type; |
||||
|
@ApiModelProperty("登录信息") |
||||
|
@NotNull(message = "登录信息不能为空") |
||||
|
private SigninData data; |
||||
|
} |
||||
|
@Data |
||||
|
@ApiModel("登录信息") |
||||
|
public static class SigninData{ |
||||
|
@ApiModelProperty("用户标识|用户名|手机号") |
||||
|
private String identifier; |
||||
|
@ApiModelProperty("用户凭据|密码|验证码") |
||||
|
private String credential; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("业务根据token获取用户信息") |
||||
|
public static class BusinessToken{ |
||||
|
@ApiModelProperty("token") |
||||
|
private String token; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("通过token获取用户信息") |
||||
|
public static class UserInfoByToken{ |
||||
|
@ApiModelProperty("token") |
||||
|
private String token; |
||||
|
@ApiModelProperty("设备id") |
||||
|
private String deviceId; |
||||
|
@ApiModelProperty("ip地址") |
||||
|
private String clientIp; |
||||
|
@ApiModelProperty("客户端类型 0-H5 1-App") |
||||
|
private Byte clientType; |
||||
|
|
||||
|
public UserInfoByToken() { |
||||
|
} |
||||
|
|
||||
|
public UserInfoByToken(String token) { |
||||
|
this.token = token; |
||||
|
} |
||||
|
|
||||
|
public UserInfoByToken(String token, String deviceId, String clientIp, byte clientType) { |
||||
|
this.token = token; |
||||
|
this.deviceId = deviceId; |
||||
|
this.clientIp = clientIp; |
||||
|
this.clientType = clientType; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("公众号的设备id") |
||||
|
public static class Official{ |
||||
|
@ApiModelProperty("设备id") |
||||
|
private String appId; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel |
||||
|
public static class WxInfo{ |
||||
|
@ApiModelProperty("微信名") |
||||
|
private String nickname; |
||||
|
@ApiModelProperty("微信头像") |
||||
|
private String headImgUrl; |
||||
|
@ApiModelProperty("性别") |
||||
|
private Byte sex; |
||||
|
@ApiModelProperty("省") |
||||
|
private String province; |
||||
|
@ApiModelProperty("市") |
||||
|
private String city; |
||||
|
@ApiModelProperty("国家") |
||||
|
private String country; |
||||
|
@ApiModelProperty("语言") |
||||
|
private String language; |
||||
|
} |
||||
|
} |
@ -0,0 +1,128 @@ |
|||||
|
package com.ccsens.delivery.bean.po; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
public class SysAuth implements Serializable { |
||||
|
private Long id; |
||||
|
|
||||
|
private Long userId; |
||||
|
|
||||
|
private Byte identifyType; |
||||
|
|
||||
|
private String identifier; |
||||
|
|
||||
|
private String credential; |
||||
|
|
||||
|
private String salt; |
||||
|
|
||||
|
private Long operator; |
||||
|
|
||||
|
private Date createdAt; |
||||
|
|
||||
|
private Date updatedAt; |
||||
|
|
||||
|
private Byte recStatus; |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
public Long getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(Long id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public Long getUserId() { |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
public void setUserId(Long userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
|
||||
|
public Byte getIdentifyType() { |
||||
|
return identifyType; |
||||
|
} |
||||
|
|
||||
|
public void setIdentifyType(Byte identifyType) { |
||||
|
this.identifyType = identifyType; |
||||
|
} |
||||
|
|
||||
|
public String getIdentifier() { |
||||
|
return identifier; |
||||
|
} |
||||
|
|
||||
|
public void setIdentifier(String identifier) { |
||||
|
this.identifier = identifier == null ? null : identifier.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getCredential() { |
||||
|
return credential; |
||||
|
} |
||||
|
|
||||
|
public void setCredential(String credential) { |
||||
|
this.credential = credential == null ? null : credential.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getSalt() { |
||||
|
return salt; |
||||
|
} |
||||
|
|
||||
|
public void setSalt(String salt) { |
||||
|
this.salt = salt == null ? null : salt.trim(); |
||||
|
} |
||||
|
|
||||
|
public Long getOperator() { |
||||
|
return operator; |
||||
|
} |
||||
|
|
||||
|
public void setOperator(Long operator) { |
||||
|
this.operator = operator; |
||||
|
} |
||||
|
|
||||
|
public Date getCreatedAt() { |
||||
|
return createdAt; |
||||
|
} |
||||
|
|
||||
|
public void setCreatedAt(Date createdAt) { |
||||
|
this.createdAt = createdAt; |
||||
|
} |
||||
|
|
||||
|
public Date getUpdatedAt() { |
||||
|
return updatedAt; |
||||
|
} |
||||
|
|
||||
|
public void setUpdatedAt(Date updatedAt) { |
||||
|
this.updatedAt = updatedAt; |
||||
|
} |
||||
|
|
||||
|
public Byte getRecStatus() { |
||||
|
return recStatus; |
||||
|
} |
||||
|
|
||||
|
public void setRecStatus(Byte recStatus) { |
||||
|
this.recStatus = recStatus; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
StringBuilder sb = new StringBuilder(); |
||||
|
sb.append(getClass().getSimpleName()); |
||||
|
sb.append(" ["); |
||||
|
sb.append("Hash = ").append(hashCode()); |
||||
|
sb.append(", id=").append(id); |
||||
|
sb.append(", userId=").append(userId); |
||||
|
sb.append(", identifyType=").append(identifyType); |
||||
|
sb.append(", identifier=").append(identifier); |
||||
|
sb.append(", credential=").append(credential); |
||||
|
sb.append(", salt=").append(salt); |
||||
|
sb.append(", operator=").append(operator); |
||||
|
sb.append(", createdAt=").append(createdAt); |
||||
|
sb.append(", updatedAt=").append(updatedAt); |
||||
|
sb.append(", recStatus=").append(recStatus); |
||||
|
sb.append("]"); |
||||
|
return sb.toString(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,831 @@ |
|||||
|
package com.ccsens.delivery.bean.po; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public class SysAuthExample { |
||||
|
protected String orderByClause; |
||||
|
|
||||
|
protected boolean distinct; |
||||
|
|
||||
|
protected List<Criteria> oredCriteria; |
||||
|
|
||||
|
public SysAuthExample() { |
||||
|
oredCriteria = new ArrayList<Criteria>(); |
||||
|
} |
||||
|
|
||||
|
public void setOrderByClause(String orderByClause) { |
||||
|
this.orderByClause = orderByClause; |
||||
|
} |
||||
|
|
||||
|
public String getOrderByClause() { |
||||
|
return orderByClause; |
||||
|
} |
||||
|
|
||||
|
public void setDistinct(boolean distinct) { |
||||
|
this.distinct = distinct; |
||||
|
} |
||||
|
|
||||
|
public boolean isDistinct() { |
||||
|
return distinct; |
||||
|
} |
||||
|
|
||||
|
public List<Criteria> getOredCriteria() { |
||||
|
return oredCriteria; |
||||
|
} |
||||
|
|
||||
|
public void or(Criteria criteria) { |
||||
|
oredCriteria.add(criteria); |
||||
|
} |
||||
|
|
||||
|
public Criteria or() { |
||||
|
Criteria criteria = createCriteriaInternal(); |
||||
|
oredCriteria.add(criteria); |
||||
|
return criteria; |
||||
|
} |
||||
|
|
||||
|
public Criteria createCriteria() { |
||||
|
Criteria criteria = createCriteriaInternal(); |
||||
|
if (oredCriteria.size() == 0) { |
||||
|
oredCriteria.add(criteria); |
||||
|
} |
||||
|
return criteria; |
||||
|
} |
||||
|
|
||||
|
protected Criteria createCriteriaInternal() { |
||||
|
Criteria criteria = new Criteria(); |
||||
|
return criteria; |
||||
|
} |
||||
|
|
||||
|
public void clear() { |
||||
|
oredCriteria.clear(); |
||||
|
orderByClause = null; |
||||
|
distinct = false; |
||||
|
} |
||||
|
|
||||
|
protected abstract static class GeneratedCriteria { |
||||
|
protected List<Criterion> criteria; |
||||
|
|
||||
|
protected GeneratedCriteria() { |
||||
|
super(); |
||||
|
criteria = new ArrayList<Criterion>(); |
||||
|
} |
||||
|
|
||||
|
public boolean isValid() { |
||||
|
return criteria.size() > 0; |
||||
|
} |
||||
|
|
||||
|
public List<Criterion> getAllCriteria() { |
||||
|
return criteria; |
||||
|
} |
||||
|
|
||||
|
public List<Criterion> getCriteria() { |
||||
|
return criteria; |
||||
|
} |
||||
|
|
||||
|
protected void addCriterion(String condition) { |
||||
|
if (condition == null) { |
||||
|
throw new RuntimeException("Value for condition cannot be null"); |
||||
|
} |
||||
|
criteria.add(new Criterion(condition)); |
||||
|
} |
||||
|
|
||||
|
protected void addCriterion(String condition, Object value, String property) { |
||||
|
if (value == null) { |
||||
|
throw new RuntimeException("Value for " + property + " cannot be null"); |
||||
|
} |
||||
|
criteria.add(new Criterion(condition, value)); |
||||
|
} |
||||
|
|
||||
|
protected void addCriterion(String condition, Object value1, Object value2, String property) { |
||||
|
if (value1 == null || value2 == null) { |
||||
|
throw new RuntimeException("Between values for " + property + " cannot be null"); |
||||
|
} |
||||
|
criteria.add(new Criterion(condition, value1, value2)); |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdIsNull() { |
||||
|
addCriterion("id is null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdIsNotNull() { |
||||
|
addCriterion("id is not null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdEqualTo(Long value) { |
||||
|
addCriterion("id =", value, "id"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdNotEqualTo(Long value) { |
||||
|
addCriterion("id <>", value, "id"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdGreaterThan(Long value) { |
||||
|
addCriterion("id >", value, "id"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdGreaterThanOrEqualTo(Long value) { |
||||
|
addCriterion("id >=", value, "id"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdLessThan(Long value) { |
||||
|
addCriterion("id <", value, "id"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdLessThanOrEqualTo(Long value) { |
||||
|
addCriterion("id <=", value, "id"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdIn(List<Long> values) { |
||||
|
addCriterion("id in", values, "id"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdNotIn(List<Long> values) { |
||||
|
addCriterion("id not in", values, "id"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdBetween(Long value1, Long value2) { |
||||
|
addCriterion("id between", value1, value2, "id"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdNotBetween(Long value1, Long value2) { |
||||
|
addCriterion("id not between", value1, value2, "id"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdIsNull() { |
||||
|
addCriterion("user_id is null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdIsNotNull() { |
||||
|
addCriterion("user_id is not null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdEqualTo(Long value) { |
||||
|
addCriterion("user_id =", value, "userId"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdNotEqualTo(Long value) { |
||||
|
addCriterion("user_id <>", value, "userId"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdGreaterThan(Long value) { |
||||
|
addCriterion("user_id >", value, "userId"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdGreaterThanOrEqualTo(Long value) { |
||||
|
addCriterion("user_id >=", value, "userId"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdLessThan(Long value) { |
||||
|
addCriterion("user_id <", value, "userId"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdLessThanOrEqualTo(Long value) { |
||||
|
addCriterion("user_id <=", value, "userId"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdIn(List<Long> values) { |
||||
|
addCriterion("user_id in", values, "userId"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdNotIn(List<Long> values) { |
||||
|
addCriterion("user_id not in", values, "userId"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdBetween(Long value1, Long value2) { |
||||
|
addCriterion("user_id between", value1, value2, "userId"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUserIdNotBetween(Long value1, Long value2) { |
||||
|
addCriterion("user_id not between", value1, value2, "userId"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeIsNull() { |
||||
|
addCriterion("identify_type is null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeIsNotNull() { |
||||
|
addCriterion("identify_type is not null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeEqualTo(Byte value) { |
||||
|
addCriterion("identify_type =", value, "identifyType"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeNotEqualTo(Byte value) { |
||||
|
addCriterion("identify_type <>", value, "identifyType"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeGreaterThan(Byte value) { |
||||
|
addCriterion("identify_type >", value, "identifyType"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeGreaterThanOrEqualTo(Byte value) { |
||||
|
addCriterion("identify_type >=", value, "identifyType"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeLessThan(Byte value) { |
||||
|
addCriterion("identify_type <", value, "identifyType"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeLessThanOrEqualTo(Byte value) { |
||||
|
addCriterion("identify_type <=", value, "identifyType"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeIn(List<Byte> values) { |
||||
|
addCriterion("identify_type in", values, "identifyType"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeNotIn(List<Byte> values) { |
||||
|
addCriterion("identify_type not in", values, "identifyType"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeBetween(Byte value1, Byte value2) { |
||||
|
addCriterion("identify_type between", value1, value2, "identifyType"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifyTypeNotBetween(Byte value1, Byte value2) { |
||||
|
addCriterion("identify_type not between", value1, value2, "identifyType"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierIsNull() { |
||||
|
addCriterion("identifier is null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierIsNotNull() { |
||||
|
addCriterion("identifier is not null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierEqualTo(String value) { |
||||
|
addCriterion("identifier =", value, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierNotEqualTo(String value) { |
||||
|
addCriterion("identifier <>", value, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierGreaterThan(String value) { |
||||
|
addCriterion("identifier >", value, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierGreaterThanOrEqualTo(String value) { |
||||
|
addCriterion("identifier >=", value, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierLessThan(String value) { |
||||
|
addCriterion("identifier <", value, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierLessThanOrEqualTo(String value) { |
||||
|
addCriterion("identifier <=", value, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierLike(String value) { |
||||
|
addCriterion("identifier like", value, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierNotLike(String value) { |
||||
|
addCriterion("identifier not like", value, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierIn(List<String> values) { |
||||
|
addCriterion("identifier in", values, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierNotIn(List<String> values) { |
||||
|
addCriterion("identifier not in", values, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierBetween(String value1, String value2) { |
||||
|
addCriterion("identifier between", value1, value2, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andIdentifierNotBetween(String value1, String value2) { |
||||
|
addCriterion("identifier not between", value1, value2, "identifier"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialIsNull() { |
||||
|
addCriterion("credential is null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialIsNotNull() { |
||||
|
addCriterion("credential is not null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialEqualTo(String value) { |
||||
|
addCriterion("credential =", value, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialNotEqualTo(String value) { |
||||
|
addCriterion("credential <>", value, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialGreaterThan(String value) { |
||||
|
addCriterion("credential >", value, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialGreaterThanOrEqualTo(String value) { |
||||
|
addCriterion("credential >=", value, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialLessThan(String value) { |
||||
|
addCriterion("credential <", value, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialLessThanOrEqualTo(String value) { |
||||
|
addCriterion("credential <=", value, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialLike(String value) { |
||||
|
addCriterion("credential like", value, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialNotLike(String value) { |
||||
|
addCriterion("credential not like", value, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialIn(List<String> values) { |
||||
|
addCriterion("credential in", values, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialNotIn(List<String> values) { |
||||
|
addCriterion("credential not in", values, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialBetween(String value1, String value2) { |
||||
|
addCriterion("credential between", value1, value2, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCredentialNotBetween(String value1, String value2) { |
||||
|
addCriterion("credential not between", value1, value2, "credential"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltIsNull() { |
||||
|
addCriterion("salt is null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltIsNotNull() { |
||||
|
addCriterion("salt is not null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltEqualTo(String value) { |
||||
|
addCriterion("salt =", value, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltNotEqualTo(String value) { |
||||
|
addCriterion("salt <>", value, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltGreaterThan(String value) { |
||||
|
addCriterion("salt >", value, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltGreaterThanOrEqualTo(String value) { |
||||
|
addCriterion("salt >=", value, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltLessThan(String value) { |
||||
|
addCriterion("salt <", value, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltLessThanOrEqualTo(String value) { |
||||
|
addCriterion("salt <=", value, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltLike(String value) { |
||||
|
addCriterion("salt like", value, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltNotLike(String value) { |
||||
|
addCriterion("salt not like", value, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltIn(List<String> values) { |
||||
|
addCriterion("salt in", values, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltNotIn(List<String> values) { |
||||
|
addCriterion("salt not in", values, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltBetween(String value1, String value2) { |
||||
|
addCriterion("salt between", value1, value2, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andSaltNotBetween(String value1, String value2) { |
||||
|
addCriterion("salt not between", value1, value2, "salt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorIsNull() { |
||||
|
addCriterion("operator is null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorIsNotNull() { |
||||
|
addCriterion("operator is not null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorEqualTo(Long value) { |
||||
|
addCriterion("operator =", value, "operator"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorNotEqualTo(Long value) { |
||||
|
addCriterion("operator <>", value, "operator"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorGreaterThan(Long value) { |
||||
|
addCriterion("operator >", value, "operator"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorGreaterThanOrEqualTo(Long value) { |
||||
|
addCriterion("operator >=", value, "operator"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorLessThan(Long value) { |
||||
|
addCriterion("operator <", value, "operator"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorLessThanOrEqualTo(Long value) { |
||||
|
addCriterion("operator <=", value, "operator"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorIn(List<Long> values) { |
||||
|
addCriterion("operator in", values, "operator"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorNotIn(List<Long> values) { |
||||
|
addCriterion("operator not in", values, "operator"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorBetween(Long value1, Long value2) { |
||||
|
addCriterion("operator between", value1, value2, "operator"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andOperatorNotBetween(Long value1, Long value2) { |
||||
|
addCriterion("operator not between", value1, value2, "operator"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtIsNull() { |
||||
|
addCriterion("created_at is null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtIsNotNull() { |
||||
|
addCriterion("created_at is not null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtEqualTo(Date value) { |
||||
|
addCriterion("created_at =", value, "createdAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtNotEqualTo(Date value) { |
||||
|
addCriterion("created_at <>", value, "createdAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtGreaterThan(Date value) { |
||||
|
addCriterion("created_at >", value, "createdAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { |
||||
|
addCriterion("created_at >=", value, "createdAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtLessThan(Date value) { |
||||
|
addCriterion("created_at <", value, "createdAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtLessThanOrEqualTo(Date value) { |
||||
|
addCriterion("created_at <=", value, "createdAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtIn(List<Date> values) { |
||||
|
addCriterion("created_at in", values, "createdAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtNotIn(List<Date> values) { |
||||
|
addCriterion("created_at not in", values, "createdAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtBetween(Date value1, Date value2) { |
||||
|
addCriterion("created_at between", value1, value2, "createdAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCreatedAtNotBetween(Date value1, Date value2) { |
||||
|
addCriterion("created_at not between", value1, value2, "createdAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtIsNull() { |
||||
|
addCriterion("updated_at is null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtIsNotNull() { |
||||
|
addCriterion("updated_at is not null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtEqualTo(Date value) { |
||||
|
addCriterion("updated_at =", value, "updatedAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtNotEqualTo(Date value) { |
||||
|
addCriterion("updated_at <>", value, "updatedAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtGreaterThan(Date value) { |
||||
|
addCriterion("updated_at >", value, "updatedAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { |
||||
|
addCriterion("updated_at >=", value, "updatedAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtLessThan(Date value) { |
||||
|
addCriterion("updated_at <", value, "updatedAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { |
||||
|
addCriterion("updated_at <=", value, "updatedAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtIn(List<Date> values) { |
||||
|
addCriterion("updated_at in", values, "updatedAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtNotIn(List<Date> values) { |
||||
|
addCriterion("updated_at not in", values, "updatedAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtBetween(Date value1, Date value2) { |
||||
|
addCriterion("updated_at between", value1, value2, "updatedAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { |
||||
|
addCriterion("updated_at not between", value1, value2, "updatedAt"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusIsNull() { |
||||
|
addCriterion("rec_status is null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusIsNotNull() { |
||||
|
addCriterion("rec_status is not null"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusEqualTo(Byte value) { |
||||
|
addCriterion("rec_status =", value, "recStatus"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusNotEqualTo(Byte value) { |
||||
|
addCriterion("rec_status <>", value, "recStatus"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusGreaterThan(Byte value) { |
||||
|
addCriterion("rec_status >", value, "recStatus"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { |
||||
|
addCriterion("rec_status >=", value, "recStatus"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusLessThan(Byte value) { |
||||
|
addCriterion("rec_status <", value, "recStatus"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusLessThanOrEqualTo(Byte value) { |
||||
|
addCriterion("rec_status <=", value, "recStatus"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusIn(List<Byte> values) { |
||||
|
addCriterion("rec_status in", values, "recStatus"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusNotIn(List<Byte> values) { |
||||
|
addCriterion("rec_status not in", values, "recStatus"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusBetween(Byte value1, Byte value2) { |
||||
|
addCriterion("rec_status between", value1, value2, "recStatus"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { |
||||
|
addCriterion("rec_status not between", value1, value2, "recStatus"); |
||||
|
return (Criteria) this; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static class Criteria extends GeneratedCriteria { |
||||
|
|
||||
|
protected Criteria() { |
||||
|
super(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static class Criterion { |
||||
|
private String condition; |
||||
|
|
||||
|
private Object value; |
||||
|
|
||||
|
private Object secondValue; |
||||
|
|
||||
|
private boolean noValue; |
||||
|
|
||||
|
private boolean singleValue; |
||||
|
|
||||
|
private boolean betweenValue; |
||||
|
|
||||
|
private boolean listValue; |
||||
|
|
||||
|
private String typeHandler; |
||||
|
|
||||
|
public String getCondition() { |
||||
|
return condition; |
||||
|
} |
||||
|
|
||||
|
public Object getValue() { |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public Object getSecondValue() { |
||||
|
return secondValue; |
||||
|
} |
||||
|
|
||||
|
public boolean isNoValue() { |
||||
|
return noValue; |
||||
|
} |
||||
|
|
||||
|
public boolean isSingleValue() { |
||||
|
return singleValue; |
||||
|
} |
||||
|
|
||||
|
public boolean isBetweenValue() { |
||||
|
return betweenValue; |
||||
|
} |
||||
|
|
||||
|
public boolean isListValue() { |
||||
|
return listValue; |
||||
|
} |
||||
|
|
||||
|
public String getTypeHandler() { |
||||
|
return typeHandler; |
||||
|
} |
||||
|
|
||||
|
protected Criterion(String condition) { |
||||
|
super(); |
||||
|
this.condition = condition; |
||||
|
this.typeHandler = null; |
||||
|
this.noValue = true; |
||||
|
} |
||||
|
|
||||
|
protected Criterion(String condition, Object value, String typeHandler) { |
||||
|
super(); |
||||
|
this.condition = condition; |
||||
|
this.value = value; |
||||
|
this.typeHandler = typeHandler; |
||||
|
if (value instanceof List<?>) { |
||||
|
this.listValue = true; |
||||
|
} else { |
||||
|
this.singleValue = true; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected Criterion(String condition, Object value) { |
||||
|
this(condition, value, null); |
||||
|
} |
||||
|
|
||||
|
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { |
||||
|
super(); |
||||
|
this.condition = condition; |
||||
|
this.value = value; |
||||
|
this.secondValue = secondValue; |
||||
|
this.typeHandler = typeHandler; |
||||
|
this.betweenValue = true; |
||||
|
} |
||||
|
|
||||
|
protected Criterion(String condition, Object value, Object secondValue) { |
||||
|
this(condition, value, secondValue, null); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,194 @@ |
|||||
|
package com.ccsens.delivery.bean.po; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
public class SysUser implements Serializable { |
||||
|
private Long id; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private Byte gender; |
||||
|
|
||||
|
private String avatarUrl; |
||||
|
|
||||
|
private String country; |
||||
|
|
||||
|
private String province; |
||||
|
|
||||
|
private String city; |
||||
|
|
||||
|
private String phone; |
||||
|
|
||||
|
private String idCard; |
||||
|
|
||||
|
private Byte power; |
||||
|
|
||||
|
private String deviceId; |
||||
|
|
||||
|
private Byte authType; |
||||
|
|
||||
|
private Long operator; |
||||
|
|
||||
|
private Date createdAt; |
||||
|
|
||||
|
private Date updatedAt; |
||||
|
|
||||
|
private Byte recStatus; |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
public Long getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(Long id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name == null ? null : name.trim(); |
||||
|
} |
||||
|
|
||||
|
public Byte getGender() { |
||||
|
return gender; |
||||
|
} |
||||
|
|
||||
|
public void setGender(Byte gender) { |
||||
|
this.gender = gender; |
||||
|
} |
||||
|
|
||||
|
public String getAvatarUrl() { |
||||
|
return avatarUrl; |
||||
|
} |
||||
|
|
||||
|
public void setAvatarUrl(String avatarUrl) { |
||||
|
this.avatarUrl = avatarUrl == null ? null : avatarUrl.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getCountry() { |
||||
|
return country; |
||||
|
} |
||||
|
|
||||
|
public void setCountry(String country) { |
||||
|
this.country = country == null ? null : country.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getProvince() { |
||||
|
return province; |
||||
|
} |
||||
|
|
||||
|
public void setProvince(String province) { |
||||
|
this.province = province == null ? null : province.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getCity() { |
||||
|
return city; |
||||
|
} |
||||
|
|
||||
|
public void setCity(String city) { |
||||
|
this.city = city == null ? null : city.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getPhone() { |
||||
|
return phone; |
||||
|
} |
||||
|
|
||||
|
public void setPhone(String phone) { |
||||
|
this.phone = phone == null ? null : phone.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getIdCard() { |
||||
|
return idCard; |
||||
|
} |
||||
|
|
||||
|
public void setIdCard(String idCard) { |
||||
|
this.idCard = idCard == null ? null : idCard.trim(); |
||||
|
} |
||||
|
|
||||
|
public Byte getPower() { |
||||
|
return power; |
||||
|
} |
||||
|
|
||||
|
public void setPower(Byte power) { |
||||
|
this.power = power; |
||||
|
} |
||||
|
|
||||
|
public String getDeviceId() { |
||||
|
return deviceId; |
||||
|
} |
||||
|
|
||||
|
public void setDeviceId(String deviceId) { |
||||
|
this.deviceId = deviceId == null ? null : deviceId.trim(); |
||||
|
} |
||||
|
|
||||
|
public Byte getAuthType() { |
||||
|
return authType; |
||||
|
} |
||||
|
|
||||
|
public void setAuthType(Byte authType) { |
||||
|
this.authType = authType; |
||||
|
} |
||||
|
|
||||
|
public Long getOperator() { |
||||
|
return operator; |
||||
|
} |
||||
|
|
||||
|
public void setOperator(Long operator) { |
||||
|
this.operator = operator; |
||||
|
} |
||||
|
|
||||
|
public Date getCreatedAt() { |
||||
|
return createdAt; |
||||
|
} |
||||
|
|
||||
|
public void setCreatedAt(Date createdAt) { |
||||
|
this.createdAt = createdAt; |
||||
|
} |
||||
|
|
||||
|
public Date getUpdatedAt() { |
||||
|
return updatedAt; |
||||
|
} |
||||
|
|
||||
|
public void setUpdatedAt(Date updatedAt) { |
||||
|
this.updatedAt = updatedAt; |
||||
|
} |
||||
|
|
||||
|
public Byte getRecStatus() { |
||||
|
return recStatus; |
||||
|
} |
||||
|
|
||||
|
public void setRecStatus(Byte recStatus) { |
||||
|
this.recStatus = recStatus; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
StringBuilder sb = new StringBuilder(); |
||||
|
sb.append(getClass().getSimpleName()); |
||||
|
sb.append(" ["); |
||||
|
sb.append("Hash = ").append(hashCode()); |
||||
|
sb.append(", id=").append(id); |
||||
|
sb.append(", name=").append(name); |
||||
|
sb.append(", gender=").append(gender); |
||||
|
sb.append(", avatarUrl=").append(avatarUrl); |
||||
|
sb.append(", country=").append(country); |
||||
|
sb.append(", province=").append(province); |
||||
|
sb.append(", city=").append(city); |
||||
|
sb.append(", phone=").append(phone); |
||||
|
sb.append(", idCard=").append(idCard); |
||||
|
sb.append(", power=").append(power); |
||||
|
sb.append(", deviceId=").append(deviceId); |
||||
|
sb.append(", authType=").append(authType); |
||||
|
sb.append(", operator=").append(operator); |
||||
|
sb.append(", createdAt=").append(createdAt); |
||||
|
sb.append(", updatedAt=").append(updatedAt); |
||||
|
sb.append(", recStatus=").append(recStatus); |
||||
|
sb.append("]"); |
||||
|
return sb.toString(); |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,123 @@ |
|||||
|
package com.ccsens.delivery.bean.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class UserVo { |
||||
|
@Data |
||||
|
@ApiModel("登录后返回用户和token信息") |
||||
|
public static class TokenBean { |
||||
|
@ApiModelProperty("用户id") |
||||
|
private Long id; |
||||
|
@ApiModelProperty("手机号") |
||||
|
private String phone; |
||||
|
@ApiModelProperty("昵称") |
||||
|
private String name; |
||||
|
@ApiModelProperty("头像") |
||||
|
private String avatarUrl; |
||||
|
@ApiModelProperty("token") |
||||
|
private String token; |
||||
|
@ApiModelProperty("刷新token") |
||||
|
private String refreshToken; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("业务请求用户信息") |
||||
|
public static class BusinessUserInfo { |
||||
|
@ApiModelProperty("用户id") |
||||
|
private Long id; |
||||
|
@ApiModelProperty("手机号") |
||||
|
private String phone; |
||||
|
@ApiModelProperty("认证状态") |
||||
|
private String type; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
public static class UserSign{ |
||||
|
private Long userId; |
||||
|
private Long authId; |
||||
|
private String phone; |
||||
|
private String avatarUrl; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("获取手机验证码") |
||||
|
public static class SmsCode{ |
||||
|
@ApiModelProperty("手机号") |
||||
|
private String phone; |
||||
|
@ApiModelProperty("有效时间(秒)") |
||||
|
private Integer expiredInSeconds; |
||||
|
@JsonIgnore |
||||
|
private String smsCode; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("返回图片验证码") |
||||
|
public static class VerificationCode{ |
||||
|
@ApiModelProperty("图片验证码Id") |
||||
|
private String verificationCodeId; |
||||
|
@ApiModelProperty("图片的Base64字符串") |
||||
|
private String imageBase64; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("根据token获取用户信息") |
||||
|
public static class TokenToUserId{ |
||||
|
@ApiModelProperty("用户id") |
||||
|
private Long id; |
||||
|
@ApiModelProperty("用户名") |
||||
|
private String userName; |
||||
|
@ApiModelProperty("头像") |
||||
|
private String avatarUrl; |
||||
|
@ApiModelProperty("手机号") |
||||
|
private String phone; |
||||
|
@ApiModelProperty("用户类型 0未认证 1已认证") |
||||
|
private byte authType; |
||||
|
@ApiModelProperty("token") |
||||
|
private String token; |
||||
|
@ApiModelProperty("刷新token") |
||||
|
private String refreshToken; |
||||
|
@ApiModelProperty("性别 偶数--女 奇数--男") |
||||
|
private byte gender; |
||||
|
@ApiModelProperty("国家") |
||||
|
private String country; |
||||
|
@ApiModelProperty("省份") |
||||
|
private String province; |
||||
|
@ApiModelProperty("城市") |
||||
|
private String city; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("生成关注公众号二维码") |
||||
|
public static class AttentionOfficial{ |
||||
|
@ApiModelProperty("二维码路径") |
||||
|
private String qrCodeUrl; |
||||
|
@ApiModelProperty("eventKey") |
||||
|
private String eventKey; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("用户是否关注公众号") |
||||
|
public static class UserOfficial{ |
||||
|
@ApiModelProperty("用户id") |
||||
|
private Long userId; |
||||
|
@ApiModelProperty("openId") |
||||
|
private String openId; |
||||
|
@ApiModelProperty("是否关注公众号 0未关注 1已关注") |
||||
|
private byte status; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("用户在公众号里的openId") |
||||
|
public static class UserOpenId{ |
||||
|
@ApiModelProperty("openId") |
||||
|
private String openId; |
||||
|
} |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package com.ccsens.delivery.config; |
||||
|
|
||||
|
import com.ccsens.delivery.intercept.MybatisInterceptor; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import org.springframework.web.cors.CorsConfiguration; |
||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
||||
|
import org.springframework.web.filter.CorsFilter; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: wuHuiJuan |
||||
|
* @create: 2019/12/03 18:01 |
||||
|
*/ |
||||
|
@Configuration |
||||
|
public class BeanConfig { |
||||
|
/** |
||||
|
* 注册拦截器 |
||||
|
*/ |
||||
|
@Bean |
||||
|
public MybatisInterceptor mybatisInterceptor() { |
||||
|
MybatisInterceptor interceptor = new MybatisInterceptor(); |
||||
|
return interceptor; |
||||
|
} |
||||
|
private CorsConfiguration buildConfig() { |
||||
|
CorsConfiguration corsConfiguration = new CorsConfiguration(); |
||||
|
corsConfiguration.addAllowedOrigin("*"); |
||||
|
corsConfiguration.addAllowedHeader("*"); |
||||
|
corsConfiguration.addAllowedMethod("*"); |
||||
|
// 预检请求的有效期,单位为秒。
|
||||
|
corsConfiguration.setMaxAge(3600L); |
||||
|
// 是否支持安全证书(必需参数)
|
||||
|
corsConfiguration.setAllowCredentials(true); |
||||
|
return corsConfiguration; |
||||
|
} |
||||
|
|
||||
|
@Bean |
||||
|
public CorsFilter corsFilter() { |
||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
||||
|
source.registerCorsConfiguration("/**", buildConfig()); |
||||
|
return new CorsFilter(source); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,141 @@ |
|||||
|
package com.ccsens.delivery.config; |
||||
|
|
||||
|
|
||||
|
import cn.hutool.core.lang.Snowflake; |
||||
|
import cn.hutool.core.util.IdUtil; |
||||
|
import com.ccsens.util.PropUtil; |
||||
|
import com.ccsens.util.config.DruidProps; |
||||
|
import com.fasterxml.jackson.databind.DeserializationFeature; |
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
import com.fasterxml.jackson.databind.module.SimpleModule; |
||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import org.springframework.http.MediaType; |
||||
|
import org.springframework.http.converter.HttpMessageConverter; |
||||
|
import org.springframework.http.converter.StringHttpMessageConverter; |
||||
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
||||
|
import org.springframework.web.servlet.config.annotation.*; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.sql.DataSource; |
||||
|
import java.nio.charset.Charset; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.TimeZone; |
||||
|
|
||||
|
/** |
||||
|
* @author whj |
||||
|
*/ |
||||
|
@Configuration |
||||
|
public class SpringConfig implements WebMvcConfigurer { |
||||
|
@Resource |
||||
|
private DruidProps druidPropsUtil; |
||||
|
@Value("${spring.snowflake.workerId}") |
||||
|
private String workerId; |
||||
|
@Value("${spring.snowflake.dataCenterId}") |
||||
|
private String dataCenterId; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 配置Converter |
||||
|
* @return |
||||
|
*/ |
||||
|
@Bean |
||||
|
public HttpMessageConverter<String> responseStringConverter() { |
||||
|
return new StringHttpMessageConverter( |
||||
|
Charset.forName("UTF-8")); |
||||
|
} |
||||
|
|
||||
|
@Bean |
||||
|
public HttpMessageConverter<Object> responseJsonConverter(){ |
||||
|
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); |
||||
|
List<MediaType> mediaTypeList = new ArrayList<>(); |
||||
|
mediaTypeList.add(MediaType.TEXT_HTML); |
||||
|
mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8); |
||||
|
converter.setSupportedMediaTypes(mediaTypeList); |
||||
|
|
||||
|
ObjectMapper objectMapper = new ObjectMapper(); |
||||
|
SimpleModule simpleModule = new SimpleModule(); |
||||
|
simpleModule.addSerializer(Long.class, ToStringSerializer.instance); |
||||
|
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); |
||||
|
objectMapper.registerModule(simpleModule); |
||||
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
||||
|
objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8")); |
||||
|
converter.setObjectMapper(objectMapper); |
||||
|
|
||||
|
return converter; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
||||
|
converters.add(responseStringConverter()); |
||||
|
converters.add(responseJsonConverter()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { |
||||
|
configurer.favorPathExtension(false); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void addCorsMappings(CorsRegistry registry) { |
||||
|
registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") |
||||
|
// 允许提交请求的方法,*表示全部允许
|
||||
|
.allowedMethods("*") |
||||
|
// #允许向该服务器提交请求的URI,*表示全部允许
|
||||
|
.allowedOrigins("*") |
||||
|
// 允许cookies跨域
|
||||
|
.allowCredentials(true) |
||||
|
// #允许访问的头信息,*表示全部
|
||||
|
.allowedHeaders("*") |
||||
|
// 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了
|
||||
|
.maxAge(18000L); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 配置静态资源 |
||||
|
*/ |
||||
|
@Override |
||||
|
public void addResourceHandlers(ResourceHandlerRegistry registry) { |
||||
|
registry.addResourceHandler("swagger-ui.html") |
||||
|
.addResourceLocations("classpath:/META-INF/resources/"); |
||||
|
registry.addResourceHandler("/webjars/**") |
||||
|
.addResourceLocations("classpath:/META-INF/resources/webjars/"); |
||||
|
|
||||
|
registry.addResourceHandler("/uploads/**") |
||||
|
// .addResourceLocations("file:D:/datang_soft/project/uploads/");
|
||||
|
.addResourceLocations("file:" + PropUtil.path); |
||||
|
|
||||
|
registry.addResourceHandler("/static/**") |
||||
|
.addResourceLocations("classpath:/static/"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 配置拦截器 |
||||
|
* @param registry 拦截器 |
||||
|
*/ |
||||
|
@Override |
||||
|
public void addInterceptors(InterceptorRegistry registry) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 配置数据源(单数据源) |
||||
|
*/ |
||||
|
@Bean |
||||
|
public DataSource dataSource(){ |
||||
|
return druidPropsUtil.createDruidDataSource(); |
||||
|
} |
||||
|
|
||||
|
@Bean |
||||
|
public Snowflake snowflake(){ |
||||
|
return IdUtil.createSnowflake(Long.parseLong(workerId),Long.parseLong(dataCenterId)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package com.ccsens.delivery.config; |
||||
|
|
||||
|
import com.ccsens.util.WebConstant; |
||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import springfox.documentation.builders.ParameterBuilder; |
||||
|
import springfox.documentation.builders.RequestHandlerSelectors; |
||||
|
import springfox.documentation.schema.ModelRef; |
||||
|
import springfox.documentation.service.ApiInfo; |
||||
|
import springfox.documentation.service.Parameter; |
||||
|
import springfox.documentation.spi.DocumentationType; |
||||
|
import springfox.documentation.spring.web.plugins.Docket; |
||||
|
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author whj |
||||
|
*/ |
||||
|
@Configuration |
||||
|
@EnableSwagger2 |
||||
|
@ConditionalOnExpression("${swagger.enable}") |
||||
|
public class SwaggerConfigure { |
||||
|
@Bean |
||||
|
public Docket customDocket() { |
||||
|
//
|
||||
|
return new Docket(DocumentationType.SWAGGER_2) |
||||
|
.apiInfo(apiInfo()) |
||||
|
.select() |
||||
|
.apis(RequestHandlerSelectors |
||||
|
.basePackage("com.ccsens.delivery.api")) |
||||
|
.build() |
||||
|
.globalOperationParameters(setHeaderToken()); |
||||
|
} |
||||
|
|
||||
|
private ApiInfo apiInfo() { |
||||
|
return new ApiInfo("Swagger Delivery", |
||||
|
"This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", |
||||
|
"1.0.0", |
||||
|
"http://swagger.io/terms/", |
||||
|
"wu", |
||||
|
"Apache 2.0", |
||||
|
"http://www.apache.org/licenses/LICENSE-2.0.html" |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
private List<Parameter> setHeaderToken() { |
||||
|
ParameterBuilder tokenPar = new ParameterBuilder(); |
||||
|
List<Parameter> pars = new ArrayList<>(); |
||||
|
tokenPar.name(WebConstant.HEADER_KEY_TOKEN).description("token") |
||||
|
.defaultValue(WebConstant.HEADER_KEY_TOKEN_PREFIX) |
||||
|
.modelRef(new ModelRef("string")).parameterType("header").required(false).build(); |
||||
|
pars.add(tokenPar.build()); |
||||
|
return pars; |
||||
|
} |
||||
|
} |
@ -0,0 +1,159 @@ |
|||||
|
package com.ccsens.delivery.intercept; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||
|
import com.ccsens.util.WebConstant; |
||||
|
import org.apache.ibatis.executor.Executor; |
||||
|
import org.apache.ibatis.mapping.BoundSql; |
||||
|
import org.apache.ibatis.mapping.MappedStatement; |
||||
|
import org.apache.ibatis.mapping.ResultMap; |
||||
|
import org.apache.ibatis.mapping.SqlSource; |
||||
|
import org.apache.ibatis.plugin.*; |
||||
|
import org.apache.ibatis.reflection.DefaultReflectorFactory; |
||||
|
import org.apache.ibatis.reflection.MetaObject; |
||||
|
import org.apache.ibatis.reflection.factory.DefaultObjectFactory; |
||||
|
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory; |
||||
|
import org.apache.ibatis.session.ResultHandler; |
||||
|
import org.apache.ibatis.session.RowBounds; |
||||
|
|
||||
|
import java.lang.reflect.InvocationTargetException; |
||||
|
import java.lang.reflect.Method; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Properties; |
||||
|
|
||||
|
/** |
||||
|
* @description: 查询添加rec_status = 0 |
||||
|
* @author: wuHuiJuan |
||||
|
* @create: 2019/12/11 10:58 |
||||
|
*/ |
||||
|
@Intercepts({ |
||||
|
@Signature( |
||||
|
type = Executor.class, |
||||
|
method = "query", |
||||
|
args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class} |
||||
|
) |
||||
|
}) |
||||
|
public class MybatisInterceptor implements Interceptor { |
||||
|
@Override |
||||
|
public Object intercept(Invocation invocation) throws Throwable { |
||||
|
|
||||
|
|
||||
|
String selectByExample = "selectByExample"; |
||||
|
String countByExample = "countByExample"; |
||||
|
String countByExample2 = "selectByExample_COUNT"; |
||||
|
String selectByPrimaryKey = "selectByPrimaryKey"; |
||||
|
|
||||
|
Object[] args = invocation.getArgs(); |
||||
|
MappedStatement statement = (MappedStatement) args[0]; |
||||
|
if (statement.getId().endsWith(selectByExample) |
||||
|
|| statement.getId().endsWith(countByExample) |
||||
|
|| statement.getId().endsWith(countByExample2)) { |
||||
|
//XXXExample
|
||||
|
Object example = args[1]; |
||||
|
|
||||
|
addCondition(statement, example); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} else if (statement.getId().endsWith(selectByPrimaryKey)) { |
||||
|
BoundSql boundSql = statement.getBoundSql(args[1]); |
||||
|
String sql = boundSql.getSql() + " and rec_status = 0"; |
||||
|
MappedStatement newStatement = newMappedStatement(statement, new BoundSqlSqlSource(boundSql)); |
||||
|
MetaObject msObject = MetaObject.forObject(newStatement, new DefaultObjectFactory(), new DefaultObjectWrapperFactory(),new DefaultReflectorFactory()); |
||||
|
msObject.setValue("sqlSource.boundSql.sql", sql); |
||||
|
args[0] = newStatement; |
||||
|
} |
||||
|
|
||||
|
return invocation.proceed(); |
||||
|
} |
||||
|
|
||||
|
private void addCondition(MappedStatement statement, Object example) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException { |
||||
|
if (example instanceof Map) { |
||||
|
example = ((Map) example).get("_ORIGINAL_PARAMETER_OBJECT"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
Method method = example.getClass().getMethod("getOredCriteria", null); |
||||
|
//获取到条件数组,第一个是Criteria
|
||||
|
List list = (List) method.invoke(example); |
||||
|
if (CollectionUtil.isEmpty(list)) { |
||||
|
Class clazz = ((ResultMap) statement.getResultMaps().get(0)).getType(); |
||||
|
String exampleName = clazz.getName() + "Example"; |
||||
|
Object paramExample = Class.forName(exampleName).newInstance(); |
||||
|
Method createCriteria = paramExample.getClass().getMethod("createCriteria"); |
||||
|
Object criteria = createCriteria.invoke(paramExample); |
||||
|
Method andIsDelEqualTo = criteria.getClass().getMethod("andRecStatusEqualTo", Byte.class); |
||||
|
andIsDelEqualTo.invoke(criteria, WebConstant.REC_STATUS.Normal.value); |
||||
|
list.add(criteria); |
||||
|
} else { |
||||
|
Object criteria = list.get(0); |
||||
|
Method getCriteria = criteria.getClass().getMethod("getCriteria"); |
||||
|
List params = (List) getCriteria.invoke(criteria); |
||||
|
boolean hasDel = false; |
||||
|
for (Object param : params) { |
||||
|
Method getCondition = param.getClass().getMethod("getCondition"); |
||||
|
Object condition = getCondition.invoke(param); |
||||
|
if ("rec_status =".equals(condition)) { |
||||
|
hasDel = true; |
||||
|
} |
||||
|
} |
||||
|
if (!hasDel) { |
||||
|
Method andIsDelEqualTo = criteria.getClass().getMethod("andRecStatusEqualTo", Byte.class); |
||||
|
andIsDelEqualTo.invoke(criteria, WebConstant.REC_STATUS.Normal.value); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object plugin(Object target) { |
||||
|
return Plugin.wrap(target, this); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void setProperties(Properties properties) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private MappedStatement newMappedStatement(MappedStatement ms, SqlSource newSqlSource) { |
||||
|
MappedStatement.Builder builder = |
||||
|
new MappedStatement.Builder(ms.getConfiguration(), ms.getId(), newSqlSource, ms.getSqlCommandType()); |
||||
|
builder.resource(ms.getResource()); |
||||
|
builder.fetchSize(ms.getFetchSize()); |
||||
|
builder.statementType(ms.getStatementType()); |
||||
|
builder.keyGenerator(ms.getKeyGenerator()); |
||||
|
if (ms.getKeyProperties() != null && ms.getKeyProperties().length != 0) { |
||||
|
StringBuilder keyProperties = new StringBuilder(); |
||||
|
for (String keyProperty : ms.getKeyProperties()) { |
||||
|
keyProperties.append(keyProperty).append(","); |
||||
|
} |
||||
|
keyProperties.delete(keyProperties.length() - 1, keyProperties.length()); |
||||
|
builder.keyProperty(keyProperties.toString()); |
||||
|
} |
||||
|
builder.timeout(ms.getTimeout()); |
||||
|
builder.parameterMap(ms.getParameterMap()); |
||||
|
builder.resultMaps(ms.getResultMaps()); |
||||
|
builder.resultSetType(ms.getResultSetType()); |
||||
|
builder.cache(ms.getCache()); |
||||
|
builder.flushCacheRequired(ms.isFlushCacheRequired()); |
||||
|
builder.useCache(ms.isUseCache()); |
||||
|
|
||||
|
return builder.build(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 定义一个内部辅助类,作用是包装sq
|
||||
|
class BoundSqlSqlSource implements SqlSource { |
||||
|
private BoundSql boundSql; |
||||
|
public BoundSqlSqlSource(BoundSql boundSql) { |
||||
|
this.boundSql = boundSql; |
||||
|
} |
||||
|
@Override |
||||
|
public BoundSql getBoundSql(Object parameterObject) { |
||||
|
return boundSql; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.ccsens.delivery.persist.dao; |
||||
|
|
||||
|
|
||||
|
import com.ccsens.delivery.bean.po.SysAuth; |
||||
|
import com.ccsens.delivery.persist.mapper.SysAuthMapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
public interface SysAuthDao extends SysAuthMapper { |
||||
|
|
||||
|
/** |
||||
|
* 根据手机号查看认证方式 |
||||
|
* @param phone 手机号 |
||||
|
* @return 返回认证信息 |
||||
|
*/ |
||||
|
SysAuth getByPhone(@Param("phone") String phone); |
||||
|
|
||||
|
/** |
||||
|
* 根据userId获取手机号 |
||||
|
* @param userId userId |
||||
|
* @return 返回手机号 |
||||
|
*/ |
||||
|
String getPhoneByUserId(@Param("userId") Long userId); |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
package com.ccsens.delivery.persist.dao; |
||||
|
|
||||
|
import com.ccsens.delivery.bean.po.SysUser; |
||||
|
import com.ccsens.delivery.bean.vo.UserVo; |
||||
|
import com.ccsens.delivery.persist.mapper.SysUserMapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
public interface SysUserDao extends SysUserMapper { |
||||
|
/** |
||||
|
* 通过设备id获取关联的临时用户 |
||||
|
* @param deviceId 设备id |
||||
|
* @return 返回用户信息 |
||||
|
*/ |
||||
|
SysUser getVisitorUser(@Param("deviceId") String deviceId); |
||||
|
|
||||
|
/** |
||||
|
* 通过手机号获取userId |
||||
|
* @param phoneList 手机号列表 |
||||
|
* @return userId列表 |
||||
|
*/ |
||||
|
List<String> getUserIdByPhone(@Param("phoneList") List<String> phoneList); |
||||
|
|
||||
|
/** |
||||
|
* 根据identifier获取用户信息 |
||||
|
* @param identifyType 认证类型 |
||||
|
* @param identifier 用户标识 |
||||
|
* @return 返回用户信息 |
||||
|
*/ |
||||
|
UserVo.UserSign getUserByIdentifier(@Param("identifyType") int identifyType, @Param("identifier") String identifier); |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.ccsens.delivery.persist.mapper; |
||||
|
|
||||
|
import com.ccsens.delivery.bean.po.SysAuth; |
||||
|
import com.ccsens.delivery.bean.po.SysAuthExample; |
||||
|
import java.util.List; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
public interface SysAuthMapper { |
||||
|
long countByExample(SysAuthExample example); |
||||
|
|
||||
|
int deleteByExample(SysAuthExample example); |
||||
|
|
||||
|
int deleteByPrimaryKey(Long id); |
||||
|
|
||||
|
int insert(SysAuth record); |
||||
|
|
||||
|
int insertSelective(SysAuth record); |
||||
|
|
||||
|
List<SysAuth> selectByExample(SysAuthExample example); |
||||
|
|
||||
|
SysAuth selectByPrimaryKey(Long id); |
||||
|
|
||||
|
int updateByExampleSelective(@Param("record") SysAuth record, @Param("example") SysAuthExample example); |
||||
|
|
||||
|
int updateByExample(@Param("record") SysAuth record, @Param("example") SysAuthExample example); |
||||
|
|
||||
|
int updateByPrimaryKeySelective(SysAuth record); |
||||
|
|
||||
|
int updateByPrimaryKey(SysAuth record); |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.ccsens.delivery.persist.mapper; |
||||
|
|
||||
|
import com.ccsens.delivery.bean.po.SysUser; |
||||
|
import com.ccsens.delivery.bean.po.SysUserExample; |
||||
|
import java.util.List; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
public interface SysUserMapper { |
||||
|
long countByExample(SysUserExample example); |
||||
|
|
||||
|
int deleteByExample(SysUserExample example); |
||||
|
|
||||
|
int deleteByPrimaryKey(Long id); |
||||
|
|
||||
|
int insert(SysUser record); |
||||
|
|
||||
|
int insertSelective(SysUser record); |
||||
|
|
||||
|
List<SysUser> selectByExample(SysUserExample example); |
||||
|
|
||||
|
SysUser selectByPrimaryKey(Long id); |
||||
|
|
||||
|
int updateByExampleSelective(@Param("record") SysUser record, @Param("example") SysUserExample example); |
||||
|
|
||||
|
int updateByExample(@Param("record") SysUser record, @Param("example") SysUserExample example); |
||||
|
|
||||
|
int updateByPrimaryKeySelective(SysUser record); |
||||
|
|
||||
|
int updateByPrimaryKey(SysUser record); |
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
package com.ccsens.delivery.service; |
||||
|
|
||||
|
|
||||
|
|
||||
|
import com.ccsens.delivery.bean.dto.UserDto; |
||||
|
import com.ccsens.delivery.bean.vo.UserVo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
public interface IUserService { |
||||
|
/** |
||||
|
* 用户登录 |
||||
|
* @param params 登录信息 |
||||
|
* @param deviceId 设备id |
||||
|
* @return 返回token |
||||
|
*/ |
||||
|
UserVo.TokenBean userSignin(UserDto.SigninDto params, String deviceId, String clientIp) throws Exception; |
||||
|
|
||||
|
// /**
|
||||
|
// * 业务根据token获取用户信息
|
||||
|
// * @param params 业务app和token
|
||||
|
// * @return 返回用户信息
|
||||
|
// */
|
||||
|
// UserVo.TokenToUserId userByBusinessToken(String accessToken, UserDto.BusinessToken params);
|
||||
|
|
||||
|
/** |
||||
|
* 获取手机验证码 |
||||
|
* @param phone 手机号 |
||||
|
* @param verificationCodeId 图形验证码id |
||||
|
* @param verificationCodeValue 图形验证码值 |
||||
|
* @return 返回手机号和有效期 |
||||
|
*/ |
||||
|
UserVo.SmsCode getSignInSmsCode(String phone, String verificationCodeId, String verificationCodeValue) throws Exception; |
||||
|
|
||||
|
/** |
||||
|
* 获取图片验证码 |
||||
|
* @return 返回base64图片 |
||||
|
*/ |
||||
|
UserVo.VerificationCode getVertifyCode(); |
||||
|
|
||||
|
/** |
||||
|
* 根据token或deviceId获取用户信息 |
||||
|
* @param params token等信息 |
||||
|
* @return 返回用户信息 |
||||
|
*/ |
||||
|
UserVo.TokenToUserId getUserByToken(UserDto.UserInfoByToken params); |
||||
|
|
||||
|
/** |
||||
|
* 生成token |
||||
|
*/ |
||||
|
UserVo.TokenBean generateToken(Long userId, Object authId); |
||||
|
|
||||
|
/** |
||||
|
* 根据refresh获取token |
||||
|
* @param refreshToken 刷新token |
||||
|
* @return 返回重新生成的token |
||||
|
*/ |
||||
|
UserVo.TokenBean getTokenByRefreshToken(String refreshToken); |
||||
|
|
||||
|
/** |
||||
|
* 通过手机号获取userId |
||||
|
* @param phoneList 手机号列表 |
||||
|
* @return 用户列表 |
||||
|
*/ |
||||
|
List<String> getUserIdByPhone(List<String> phoneList); |
||||
|
|
||||
|
/** |
||||
|
* 修改用户信息 |
||||
|
* @param userId userId |
||||
|
* @param param 详细信息 |
||||
|
* @return 返回头像名称等 |
||||
|
*/ |
||||
|
UserVo.TokenBean updateUserInfo(Long userId, UserDto.WxInfo param); |
||||
|
} |
@ -0,0 +1,723 @@ |
|||||
|
package com.ccsens.delivery.service; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||
|
import cn.hutool.core.lang.Snowflake; |
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import cn.hutool.core.util.RandomUtil; |
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.ccsens.delivery.bean.dto.UserDto; |
||||
|
import com.ccsens.delivery.bean.po.SysAuth; |
||||
|
import com.ccsens.delivery.bean.po.SysAuthExample; |
||||
|
import com.ccsens.delivery.bean.po.SysUser; |
||||
|
import com.ccsens.delivery.bean.vo.UserVo; |
||||
|
import com.ccsens.delivery.persist.dao.SysAuthDao; |
||||
|
import com.ccsens.delivery.persist.dao.SysUserDao; |
||||
|
import com.ccsens.delivery.util.DeliveryCodeError; |
||||
|
import com.ccsens.delivery.util.DeliveryConstant; |
||||
|
import com.ccsens.util.*; |
||||
|
import com.ccsens.util.bean.wx.po.WxOauth2UserInfo; |
||||
|
import com.ccsens.util.exception.BaseException; |
||||
|
import com.ccsens.util.wx.WxGzhUtil; |
||||
|
import com.ccsens.util.wx.WxXcxUtil; |
||||
|
import com.ccsens.wechatutil.bean.po.MiniProgramUser; |
||||
|
import com.ccsens.wechatutil.wxmini.MiniSigninUtil; |
||||
|
import io.jsonwebtoken.Claims; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.lang3.RandomStringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Propagation; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.regex.Matcher; |
||||
|
import java.util.regex.Pattern; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class) |
||||
|
public class UserService implements IUserService { |
||||
|
@Resource |
||||
|
private RedisUtil redisUtil; |
||||
|
@Resource |
||||
|
private SysUserDao sysUserDao; |
||||
|
@Resource |
||||
|
private SysAuthDao sysAuthDao; |
||||
|
@Resource |
||||
|
private Snowflake snowflake; |
||||
|
|
||||
|
@Override |
||||
|
public UserVo.TokenBean userSignin(UserDto.SigninDto params, String deviceId, String clientIp) throws Exception { |
||||
|
|
||||
|
String identifier = params.getData().getIdentifier(); |
||||
|
String credential = params.getData().getCredential(); |
||||
|
|
||||
|
UserVo.UserSign userSign; |
||||
|
//验证客户端类型
|
||||
|
switch (params.getClient()) { |
||||
|
case 0: |
||||
|
//h5 只能账号登录
|
||||
|
userSign = accountLogin(identifier, credential); |
||||
|
break; |
||||
|
case 1: |
||||
|
//小程序 只能小程序登录
|
||||
|
userSign = wxmplogin(identifier); |
||||
|
break; |
||||
|
default: |
||||
|
throw new BaseException(DeliveryCodeError.CLIENT_ERROR); |
||||
|
} |
||||
|
|
||||
|
//手机号
|
||||
|
// String phone = null;
|
||||
|
// if(ObjectUtil.isNull(userSign)){
|
||||
|
// switch (params.getType()) {
|
||||
|
// case 0:
|
||||
|
// //小程序登录
|
||||
|
// userSign = wxmplogin(identifier);
|
||||
|
// break;
|
||||
|
// case 1:
|
||||
|
// //验证数据
|
||||
|
// if(StrUtil.isBlank(identifier)){
|
||||
|
// throw new BaseException(DeliveryCodeError.NOT_PHONE);
|
||||
|
// }
|
||||
|
// if(StrUtil.isBlank(credential)){
|
||||
|
// throw new BaseException(DeliveryCodeError.NOT_SMS_CODE);
|
||||
|
// }
|
||||
|
// //手机号登录
|
||||
|
// userSign = phoneLogin(identifier, credential, deviceId);
|
||||
|
// phone = identifier;
|
||||
|
// break;
|
||||
|
// case 3:
|
||||
|
// //账号登录
|
||||
|
// userSign = accountLogin(identifier, credential);
|
||||
|
// break;
|
||||
|
// case 4:
|
||||
|
// //微信登录
|
||||
|
// WebConstant.IDENTIFY_TYPE identifyType = WebConstant.IDENTIFY_TYPE.valueOf(params.getType());
|
||||
|
// userSign = wxLogin(identifyType,identifier);
|
||||
|
// break;
|
||||
|
// default: {
|
||||
|
// throw new BaseException(DeliveryCodeError.SIGNIN_TYPE_ERROR);
|
||||
|
// }
|
||||
|
// }
|
||||
|
// }
|
||||
|
//生成token
|
||||
|
UserVo.TokenBean tokenBean = generateToken(userSign.getUserId(), userSign.getAuthId()); |
||||
|
|
||||
|
|
||||
|
tokenBean.setId(userSign.getUserId()); |
||||
|
// if(ObjectUtil.isNull(phone)){
|
||||
|
// phone = sysAuthDao.getPhoneByUserId(userSign.getUserId());
|
||||
|
// }
|
||||
|
// if(ObjectUtil.isNotNull(phone)){
|
||||
|
// tokenBean.setPhone(phone);
|
||||
|
// }
|
||||
|
//获取用户信息
|
||||
|
SysUser sysUser = sysUserDao.selectByPrimaryKey(userSign.getUserId()); |
||||
|
if(ObjectUtil.isNotNull(sysUser)){ |
||||
|
tokenBean.setName(sysUser.getName()); |
||||
|
tokenBean.setAvatarUrl(sysUser.getAvatarUrl()); |
||||
|
// if(ObjectUtil.isNull(tokenBean.getPhone())){
|
||||
|
tokenBean.setPhone(sysUser.getPhone()); |
||||
|
// }
|
||||
|
} |
||||
|
return tokenBean; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 微信小程序 |
||||
|
*/ |
||||
|
private UserVo.UserSign wxmplogin(String code) throws Exception { |
||||
|
//0.获取openid
|
||||
|
MiniProgramUser miniProgramUser; |
||||
|
try { |
||||
|
miniProgramUser = MiniSigninUtil.signinByMini(code, DeliveryConstant.DEFAULT_APP_ID, DeliveryConstant.DEFAULT_SECRET); |
||||
|
}catch (Exception e){ |
||||
|
throw new BaseException(DeliveryCodeError.SIGNIN_ERROR); |
||||
|
} |
||||
|
if(ObjectUtil.isNull(miniProgramUser)){ |
||||
|
throw new BaseException(DeliveryCodeError.SIGNIN_ERROR); |
||||
|
} |
||||
|
String openId = miniProgramUser.openid; |
||||
|
String unionId = miniProgramUser.unionid; |
||||
|
log.info("小程序登录,openid:{} ,unionId:{}", openId, unionId); |
||||
|
return getUserSign(openId, unionId, (byte) WebConstant.IDENTIFY_TYPE.Wxmp.value); |
||||
|
} |
||||
|
/** |
||||
|
* @param openId |
||||
|
* @param unionId |
||||
|
* @return |
||||
|
*/ |
||||
|
private UserVo.UserSign getUserSign(String openId, String unionId,byte identifyType) { |
||||
|
//1.查找对应账户,不存在则注册
|
||||
|
UserVo.UserSign userSignVo; |
||||
|
List<SysAuth> authList = null; |
||||
|
SysAuth theAuth; |
||||
|
if (ObjectUtil.isNotNull(openId)) { |
||||
|
SysAuthExample authExample = new SysAuthExample(); |
||||
|
authExample.createCriteria().andIdentifyTypeEqualTo(identifyType) |
||||
|
.andIdentifierEqualTo(openId); |
||||
|
authList = sysAuthDao.selectByExample(authExample); |
||||
|
} |
||||
|
if (CollectionUtil.isEmpty(authList)) { |
||||
|
List<SysAuth> sysAuthList = null; |
||||
|
if (ObjectUtil.isNotNull(unionId) && identifyType == WebConstant.IDENTIFY_TYPE.Wxmp.value) { |
||||
|
SysAuthExample sysAuthExample = new SysAuthExample(); |
||||
|
sysAuthExample.createCriteria().andCredentialEqualTo(unionId); |
||||
|
sysAuthList = sysAuthDao.selectByExample(sysAuthExample); |
||||
|
} |
||||
|
if (CollectionUtil.isNotEmpty(sysAuthList)) { |
||||
|
//添加认证方式
|
||||
|
theAuth = new SysAuth(); |
||||
|
theAuth.setId(snowflake.nextId()); |
||||
|
theAuth.setUserId(sysAuthList.get(0).getUserId()); |
||||
|
theAuth.setIdentifyType(identifyType); |
||||
|
theAuth.setIdentifier(openId); |
||||
|
theAuth.setCredential(unionId); |
||||
|
sysAuthDao.insertSelective(theAuth); |
||||
|
} else { |
||||
|
//新建用户并保存微信信息
|
||||
|
SysUser user = new SysUser(); |
||||
|
user.setId(snowflake.nextId()); |
||||
|
sysUserDao.insertSelective(user); |
||||
|
//添加认证方式
|
||||
|
theAuth = new SysAuth(); |
||||
|
theAuth.setId(snowflake.nextId()); |
||||
|
theAuth.setUserId(user.getId()); |
||||
|
theAuth.setIdentifyType(identifyType); |
||||
|
theAuth.setIdentifier(openId); |
||||
|
theAuth.setCredential(unionId); |
||||
|
sysAuthDao.insertSelective(theAuth); |
||||
|
} |
||||
|
} else { |
||||
|
theAuth = authList.get(0); |
||||
|
} |
||||
|
//2.返回
|
||||
|
userSignVo = new UserVo.UserSign(); |
||||
|
userSignVo.setUserId(theAuth.getUserId()); |
||||
|
userSignVo.setAuthId(theAuth.getId()); |
||||
|
return userSignVo; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 账号登录 |
||||
|
* @param account 账号密码 |
||||
|
* @param password 密码 |
||||
|
* @return 返回 |
||||
|
*/ |
||||
|
private UserVo.UserSign accountLogin(String account, String password) throws Exception { |
||||
|
UserVo.UserSign userSignVo; |
||||
|
List<SysAuth> authList; |
||||
|
SysAuth theAuth; |
||||
|
SysAuthExample authExample = new SysAuthExample(); |
||||
|
authExample.createCriteria() |
||||
|
.andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value).andIdentifierEqualTo(account); |
||||
|
authList = sysAuthDao.selectByExample(authExample); |
||||
|
if (CollectionUtil.isNotEmpty(authList)) { |
||||
|
theAuth = authList.get(0); |
||||
|
if (ShiroKit.authenticate(password, theAuth.getCredential(), theAuth.getSalt())) { |
||||
|
userSignVo = new UserVo.UserSign(); |
||||
|
userSignVo.setUserId(theAuth.getUserId()); |
||||
|
userSignVo.setAuthId(theAuth.getId()); |
||||
|
} else { |
||||
|
throw new BaseException(CodeEnum.PASSWORD_ERROR); |
||||
|
} |
||||
|
} else { |
||||
|
throw new BaseException(CodeEnum.PASSWORD_ERROR); |
||||
|
} |
||||
|
return userSignVo; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取token |
||||
|
*/ |
||||
|
@Override |
||||
|
public UserVo.TokenBean generateToken(Long userId, Object authId) { |
||||
|
Map<String, Object> payLoads = CollectionUtil.newHashMap(); |
||||
|
payLoads.put(WebConstant.PARAMETER_KEY_TOKEN_AUTH_ID, String.valueOf(authId)); |
||||
|
|
||||
|
UserVo.TokenBean tokenBean = new UserVo.TokenBean(); |
||||
|
//生成过期时间
|
||||
|
long tokenExpired = 3600 * 1000L * 2; |
||||
|
long refreshTokenExpired = 3600 * 1000L * 24 * 30; |
||||
|
|
||||
|
//1.生成token并缓存
|
||||
|
String token = JwtUtil.createJWT(userId + "",payLoads, tokenExpired, WebConstant.JWT_ACCESS_TOKEN_SECERT); |
||||
|
redisUtil.set(RedisKeyManager.getTokenCachedKey(userId), token, tokenExpired / 1000); |
||||
|
tokenBean.setToken(token); |
||||
|
|
||||
|
//生成refreshToken
|
||||
|
String refreshToken = JwtUtil.createJWT(userId + "", payLoads, refreshTokenExpired, WebConstant.JWT_ACCESS_TOKEN_SECERT); |
||||
|
redisUtil.set(RedisKeyManager.getRefreshTokenCachedKey(userId), refreshToken, refreshTokenExpired / 1000); |
||||
|
tokenBean.setRefreshToken(refreshToken); |
||||
|
|
||||
|
//2.返回
|
||||
|
return tokenBean; |
||||
|
} |
||||
|
|
||||
|
// /**
|
||||
|
// * 添加登录记录
|
||||
|
// */
|
||||
|
// private void saveSigninLog(Long userId, Long authId, String deviceId, Byte client, String clientIp) {
|
||||
|
// SysSigninLog sysSigninLog = new SysSigninLog();
|
||||
|
// sysSigninLog.setId(snowflake.nextId());
|
||||
|
// sysSigninLog.setUserId(userId);
|
||||
|
// sysSigninLog.setAuthId(authId);
|
||||
|
// sysSigninLog.setTime(System.currentTimeMillis());
|
||||
|
// sysSigninLog.setDeviceId(deviceId);
|
||||
|
// sysSigninLog.setClientType(client);
|
||||
|
// sysSigninLog.setIpAddress(clientIp);
|
||||
|
// sysSigninLogMapper.insertSelective(sysSigninLog);
|
||||
|
// }
|
||||
|
|
||||
|
// /**
|
||||
|
// * 添加用户设备关联信息
|
||||
|
// * @param userId userId
|
||||
|
// * @param deviceId 设备id
|
||||
|
// */
|
||||
|
// private void saveUserDevice(Long userId, String deviceId,Integer client) {
|
||||
|
// //查找用户和设备的关联信息,如果为空则添加关联信息
|
||||
|
// SysUserDeviceExample userDeviceExample = new SysUserDeviceExample();
|
||||
|
// userDeviceExample.createCriteria().andUserIdEqualTo(userId).andDeviceIdEqualTo(deviceId);
|
||||
|
// List<SysUserDevice> sysUserDevices = userDeviceMapper.selectByExample(userDeviceExample);
|
||||
|
// //不存在则添加
|
||||
|
// if(CollectionUtil.isEmpty(sysUserDevices)){
|
||||
|
// SysUserDevice sysUserDevice = new SysUserDevice();
|
||||
|
// sysUserDevice.setId(snowflake.nextId());
|
||||
|
// sysUserDevice.setUserId(userId);
|
||||
|
// sysUserDevice.setDeviceId(deviceId);
|
||||
|
// sysUserDevice.setClientType(client.byteValue());
|
||||
|
// userDeviceMapper.insertSelective(sysUserDevice);
|
||||
|
// }
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* 手机号登陆 |
||||
|
* @param phone 手机号 |
||||
|
* @param smsVerifyCode 验证码 |
||||
|
* @param deviceId 设备id |
||||
|
* @return 返回用户信息 |
||||
|
*/ |
||||
|
private UserVo.UserSign phoneLogin(String phone, String smsVerifyCode, String deviceId) { |
||||
|
UserVo.UserSign userSignVo; |
||||
|
if (!isSmsCodeCorrect(phone, smsVerifyCode)) { |
||||
|
throw new BaseException(DeliveryCodeError.SMS_CODE_CORRECT); |
||||
|
} |
||||
|
//1.查找对应账户,不存在则注册
|
||||
|
SysAuth theAuth = sysAuthDao.getByPhone(phone); |
||||
|
if (ObjectUtil.isNull(theAuth)) { |
||||
|
theAuth = saveUser(phone, deviceId); |
||||
|
} |
||||
|
//返回用户id和认证id
|
||||
|
userSignVo = new UserVo.UserSign(); |
||||
|
userSignVo.setUserId(theAuth.getUserId()); |
||||
|
userSignVo.setAuthId(theAuth.getId()); |
||||
|
|
||||
|
return userSignVo; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 微信登陆 |
||||
|
* @param code 微信code |
||||
|
* @return 返回用户信息 |
||||
|
*/ |
||||
|
private UserVo.UserSign wxLogin(WebConstant.IDENTIFY_TYPE identifyType, String code) { |
||||
|
UserVo.UserSign userSignVo; |
||||
|
//获取微信信息并保存
|
||||
|
log.info("公众号登陆,{}", code); |
||||
|
WxOauth2UserInfo wxOauth2UserInfo = WxGzhUtil.getOauth2UserInfo(identifyType, code); |
||||
|
log.info("获取用户的微信信息,{}", wxOauth2UserInfo); |
||||
|
SysAuth theAuth; |
||||
|
if (ObjectUtil.isNull(wxOauth2UserInfo)) { |
||||
|
throw new BaseException(CodeEnum.NOT_SELECT_WX); |
||||
|
} |
||||
|
SysAuthExample authExample = new SysAuthExample(); |
||||
|
authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.OAUTH2_Wx.value) |
||||
|
.andIdentifierEqualTo(wxOauth2UserInfo.getOpenId()).andCredentialEqualTo(wxOauth2UserInfo.getUnionId()); |
||||
|
List<SysAuth> authList = sysAuthDao.selectByExample(authExample); |
||||
|
if (CollectionUtil.isNotEmpty(authList)) { |
||||
|
theAuth = authList.get(0); |
||||
|
log.info("该用户已有微信登录的auth信息,{}", theAuth); |
||||
|
} else { |
||||
|
SysAuthExample sysAuthExample = new SysAuthExample(); |
||||
|
sysAuthExample.createCriteria().andCredentialEqualTo(wxOauth2UserInfo.getUnionId()); |
||||
|
List<SysAuth> sysAuthList = sysAuthDao.selectByExample(sysAuthExample); |
||||
|
if (CollectionUtil.isNotEmpty(sysAuthList)) { |
||||
|
//添加认证方式
|
||||
|
theAuth = new SysAuth(); |
||||
|
theAuth.setId(snowflake.nextId()); |
||||
|
theAuth.setUserId(sysAuthList.get(0).getUserId()); |
||||
|
} else { |
||||
|
//新建用户并保存微信信息
|
||||
|
SysUser user = new SysUser(); |
||||
|
user.setId(snowflake.nextId()); |
||||
|
user.setAvatarUrl(wxOauth2UserInfo.getHeadImgUrl()); |
||||
|
user.setName(wxOauth2UserInfo.getNickname()); |
||||
|
user.setGender((byte) wxOauth2UserInfo.getSex()); |
||||
|
user.setCountry(wxOauth2UserInfo.getCountry()); |
||||
|
user.setProvince(wxOauth2UserInfo.getProvince()); |
||||
|
user.setCity(wxOauth2UserInfo.getCity()); |
||||
|
sysUserDao.insertSelective(user); |
||||
|
//添加认证方式
|
||||
|
theAuth = new SysAuth(); |
||||
|
theAuth.setId(snowflake.nextId()); |
||||
|
theAuth.setUserId(user.getId()); |
||||
|
} |
||||
|
theAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.OAUTH2_Wx.value); |
||||
|
theAuth.setIdentifier(wxOauth2UserInfo.getOpenId()); |
||||
|
theAuth.setCredential(wxOauth2UserInfo.getUnionId()); |
||||
|
sysAuthDao.insertSelective(theAuth); |
||||
|
} |
||||
|
//2.返回
|
||||
|
userSignVo = new UserVo.UserSign(); |
||||
|
userSignVo.setUserId(theAuth.getUserId()); |
||||
|
userSignVo.setAuthId(theAuth.getId()); |
||||
|
log.info("认证成功返回:{}", userSignVo); |
||||
|
return userSignVo; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 添加用户和手机号认证方式 |
||||
|
* @return 认证信息 |
||||
|
*/ |
||||
|
private SysAuth saveUser(String identifier, String deviceId) { |
||||
|
//1.添加user
|
||||
|
SysUser user = new SysUser(); |
||||
|
user.setId(snowflake.nextId()); |
||||
|
user.setDeviceId(deviceId); |
||||
|
user.setAuthType((byte) 1); |
||||
|
sysUserDao.insertSelective(user); |
||||
|
//2.添加auth
|
||||
|
SysAuth auth = new SysAuth(); |
||||
|
auth.setId(snowflake.nextId()); |
||||
|
auth.setUserId(user.getId()); |
||||
|
auth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Phone.value); |
||||
|
auth.setIdentifier(identifier); |
||||
|
auth.setCredential(null); |
||||
|
sysAuthDao.insertSelective(auth); |
||||
|
return auth; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 判断验证码是否有效 |
||||
|
*/ |
||||
|
private Boolean isSmsCodeCorrect(String phone, String smsCode) { |
||||
|
boolean correct = false; |
||||
|
//TODO 暂时1111也可以
|
||||
|
if("1111".equals(smsCode)){ |
||||
|
correct = true; |
||||
|
} |
||||
|
if (redisUtil.hasKey(RedisKeyManager.getSigninSmsKey(phone))) { |
||||
|
if (smsCode.equals(redisUtil.get(RedisKeyManager.getSigninSmsKey(phone)).toString())) { |
||||
|
correct = true; |
||||
|
} |
||||
|
} |
||||
|
return correct; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public UserVo.SmsCode getSignInSmsCode(String phone, String verificationCodeId, String verificationCodeValue) { |
||||
|
//检查图形验证码是否正确
|
||||
|
String codeKey = WebConstant.IMAGE_CODE + verificationCodeId; |
||||
|
if (!redisUtil.hasKey(codeKey)) { |
||||
|
throw new BaseException(CodeEnum.VERIFICATION_CODE_PAST_IMG); |
||||
|
} |
||||
|
if (!verificationCodeValue.equals(String.valueOf(redisUtil.get(codeKey)))) { |
||||
|
throw new BaseException(CodeEnum.VERIFICATION_CODE_ERROR_IMG); |
||||
|
} |
||||
|
//验证一次,无论是否正确,都将缓存删除
|
||||
|
redisUtil.del(codeKey); |
||||
|
//验证手机号的正确性
|
||||
|
String regex = "[1]([3-9])[0-9]{9}$"; |
||||
|
Pattern p = Pattern.compile(regex); |
||||
|
Matcher m = p.matcher(phone); |
||||
|
boolean isMatch = m.matches(); |
||||
|
if (!isMatch) { |
||||
|
throw new BaseException(CodeEnum.PHONE_ERR); |
||||
|
} |
||||
|
|
||||
|
UserVo.SmsCode smsCodeVo; |
||||
|
//1.验证发送间隔是否大于指定间隔
|
||||
|
if (redisUtil.hasKey(RedisKeyManager.getSigninSmsExistKey(phone))) { |
||||
|
throw new BaseException(DeliveryCodeError.ERROR_SEND_TOO_FAST); |
||||
|
} |
||||
|
//测试环境默认发送1111
|
||||
|
String verifyCode; |
||||
|
// if (PtOsConstant.SMS_CODE.equalsIgnoreCase(PropUtil.smsCode)) {
|
||||
|
verifyCode = RandomUtil.randomNumbers(4); |
||||
|
// }
|
||||
|
//3.保存到redis中
|
||||
|
Integer codeValidInSeconds = WebConstant.Expired_Verify_Code_In_Seconds; |
||||
|
Integer codeExistInSeconds = WebConstant.Exist_Verify_Code_In_Seconds; |
||||
|
redisUtil.set(RedisKeyManager.getSigninSmsKey(phone), verifyCode, codeValidInSeconds); |
||||
|
redisUtil.set(RedisKeyManager.getSigninSmsExistKey(phone), verifyCode, codeExistInSeconds); |
||||
|
|
||||
|
//5.发送验证码
|
||||
|
// if (PtOsConstant.SMS_CODE.equalsIgnoreCase(PropUtil.smsCode)) {
|
||||
|
SmsUtil.sendSms(phone, verifyCode, "", codeValidInSeconds); |
||||
|
// }
|
||||
|
//6.返回
|
||||
|
smsCodeVo = new UserVo.SmsCode(); |
||||
|
smsCodeVo.setPhone(phone); |
||||
|
smsCodeVo.setSmsCode(verifyCode); |
||||
|
smsCodeVo.setExpiredInSeconds(WebConstant.Expired_Verify_Code_In_Seconds); |
||||
|
return smsCodeVo; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public UserVo.VerificationCode getVertifyCode() { |
||||
|
Map<String, Object> codeMap = ImageCodeGeneratorUtil.generateCountCode(); |
||||
|
//生成一个id
|
||||
|
long id = snowflake.nextId(); |
||||
|
//将两个数的和,存在redis内,key为新生成的id
|
||||
|
String imageCodeKey = WebConstant.IMAGE_CODE + id; |
||||
|
redisUtil.set(imageCodeKey, codeMap.get("sum"), 90); |
||||
|
log.info("将图形验证码存入redis:{},,,{}", imageCodeKey,codeMap.get("sum")); |
||||
|
String imageBase64 = "data:image/png;base64," + ImageCodeGeneratorUtil.generateCodeImage(null, (String) codeMap.get("imageCode"), 200, 70); |
||||
|
|
||||
|
UserVo.VerificationCode vertifyCode = new UserVo.VerificationCode(); |
||||
|
vertifyCode.setImageBase64(imageBase64); |
||||
|
vertifyCode.setVerificationCodeId(String.valueOf(id)); |
||||
|
|
||||
|
return vertifyCode; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public UserVo.TokenToUserId getUserByToken(UserDto.UserInfoByToken params) { |
||||
|
UserVo.TokenToUserId userInfo; |
||||
|
if(StrUtil.isNotBlank(params.getToken())){ |
||||
|
//根据token获取userId
|
||||
|
userInfo = getUserByToken(params.getToken()); |
||||
|
}else { |
||||
|
// //根据deviceId获取userId
|
||||
|
// userInfo = getUserByDeviceId(params);
|
||||
|
throw new BaseException(CodeEnum.NOT_LOGIN); |
||||
|
} |
||||
|
return userInfo; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据token获取用户信息 |
||||
|
* @param token token |
||||
|
*/ |
||||
|
private UserVo.TokenToUserId getUserByToken(String token) { |
||||
|
UserVo.TokenToUserId userInfo = new UserVo.TokenToUserId(); |
||||
|
//如果token不为空,获取用户信息
|
||||
|
if (!token.startsWith(WebConstant.HEADER_KEY_TOKEN_PREFIX)) { |
||||
|
log.info("token不存在:{}",token); |
||||
|
throw new BaseException(CodeEnum.NOT_LOGIN); |
||||
|
} |
||||
|
String userToken = token.substring(WebConstant.HEADER_KEY_TOKEN_PREFIX.length()); |
||||
|
//验证token是否有效
|
||||
|
Claims claims; |
||||
|
try { |
||||
|
claims = JwtUtil.parseJWT(userToken, WebConstant.JWT_ACCESS_TOKEN_SECERT); |
||||
|
}catch(Exception e){ |
||||
|
log.info("token无效"); |
||||
|
throw new BaseException(CodeEnum.NOT_LOGIN); |
||||
|
} |
||||
|
//验证用户存根
|
||||
|
if(!redisUtil.hasKey(RedisKeyManager.getTokenCachedKey(Long.valueOf(claims.getSubject())))){ |
||||
|
log.info("用户存根不存在:{}",claims.getSubject()); |
||||
|
throw new BaseException(CodeEnum.NOT_LOGIN); |
||||
|
} |
||||
|
SysUser sysUser = sysUserDao.selectByPrimaryKey(Long.valueOf(claims.getSubject())); |
||||
|
if(ObjectUtil.isNull(sysUser)){ |
||||
|
throw new BaseException(CodeEnum.NOT_LOGIN); |
||||
|
} |
||||
|
|
||||
|
//获取用户信息
|
||||
|
BeanUtil.copyProperties(sysUser,userInfo); |
||||
|
userInfo.setUserName(sysUser.getName()); |
||||
|
//查找手机号
|
||||
|
userInfo.setPhone(sysAuthDao.getPhoneByUserId(Long.valueOf(claims.getSubject()))); |
||||
|
|
||||
|
return userInfo; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据deviceId获取userId |
||||
|
* @param params 设备id等 |
||||
|
*/ |
||||
|
private UserVo.TokenToUserId getUserByDeviceId(UserDto.UserInfoByToken params) { |
||||
|
UserVo.TokenToUserId userInfo = new UserVo.TokenToUserId(); |
||||
|
//如果token为空,则用deviceId获取用户信息
|
||||
|
if(StrUtil.isBlank(params.getDeviceId())){ |
||||
|
throw new BaseException(DeliveryCodeError.ILLEGAL_LOG_IN); |
||||
|
} |
||||
|
synchronized (this) { |
||||
|
//查找deviceId关联的临时用户
|
||||
|
SysUser sysUser = sysUserDao.getVisitorUser(params.getDeviceId()); |
||||
|
log.info("查找deviceId用户:{}" ,sysUser); |
||||
|
if(ObjectUtil.isNotNull(sysUser)){ |
||||
|
BeanUtil.copyProperties(sysUser,userInfo); |
||||
|
userInfo.setUserName(sysUser.getName()); |
||||
|
}else { |
||||
|
//以前没有关联用户则新建一个
|
||||
|
sysUser = new SysUser(); |
||||
|
sysUser.setId(snowflake.nextId()); |
||||
|
sysUser.setDeviceId(params.getDeviceId()); |
||||
|
sysUser.setAuthType((byte) 0); |
||||
|
sysUserDao.insertSelective(sysUser); |
||||
|
userInfo.setId(sysUser.getId()); |
||||
|
} |
||||
|
// userInfo.setAuthType(sysUser.getAuthType());
|
||||
|
// //添加登录记录
|
||||
|
// saveSigninLog(sysUser.getId(), 0L,params.getDeviceId(), params.getClientType(),params.getClientIp());
|
||||
|
//重新生成token
|
||||
|
UserVo.TokenBean tokenBean = generateToken(sysUser.getId(), 0L); |
||||
|
userInfo.setToken(tokenBean.getToken()); |
||||
|
userInfo.setRefreshToken(tokenBean.getRefreshToken()); |
||||
|
} |
||||
|
return userInfo; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public UserVo.TokenBean getTokenByRefreshToken(String refreshToken) { |
||||
|
Claims claims; |
||||
|
try { |
||||
|
claims = JwtUtil.parseJWT(refreshToken, WebConstant.JWT_ACCESS_TOKEN_SECERT); |
||||
|
}catch(Exception e){ |
||||
|
log.info("token无效"); |
||||
|
throw new BaseException(DeliveryCodeError.NOT_REFRESH_TOKEN); |
||||
|
} |
||||
|
//获取userId和authId
|
||||
|
String subject = claims.getSubject(); |
||||
|
Object authId = claims.get(WebConstant.PARAMETER_KEY_TOKEN_AUTH_ID); |
||||
|
//验证用户存根
|
||||
|
if(!redisUtil.hasKey(RedisKeyManager.getRefreshTokenCachedKey(Long.valueOf(subject)))){ |
||||
|
log.info("用户存根不存在:{}",claims.getSubject()); |
||||
|
throw new BaseException(DeliveryCodeError.NOT_REFRESH_TOKEN); |
||||
|
} |
||||
|
//检查用户是否存在
|
||||
|
SysUser sysUser = sysUserDao.selectByPrimaryKey(Long.valueOf(claims.getSubject())); |
||||
|
if(ObjectUtil.isNull(sysUser)){ |
||||
|
throw new BaseException(DeliveryCodeError.NOT_REFRESH_TOKEN); |
||||
|
} |
||||
|
//重新生成token
|
||||
|
Map<String, Object> payLoads = CollectionUtil.newHashMap(); |
||||
|
payLoads.put(WebConstant.PARAMETER_KEY_TOKEN_AUTH_ID, String.valueOf(authId)); |
||||
|
//生成过期时间
|
||||
|
long tokenExpired = 3600 * 1000L * 2; |
||||
|
//生成token并缓存
|
||||
|
String token = JwtUtil.createJWT(subject + "",payLoads, tokenExpired, WebConstant.JWT_ACCESS_TOKEN_SECERT); |
||||
|
redisUtil.set(RedisKeyManager.getTokenCachedKey(subject), token, tokenExpired / 1000); |
||||
|
|
||||
|
UserVo.TokenBean tokenBean = new UserVo.TokenBean(); |
||||
|
tokenBean.setToken(token); |
||||
|
tokenBean.setRefreshToken(refreshToken); |
||||
|
tokenBean.setId(sysUser.getId()); |
||||
|
tokenBean.setAvatarUrl(sysUser.getAvatarUrl()); |
||||
|
tokenBean.setPhone(sysAuthDao.getPhoneByUserId(sysUser.getId())); |
||||
|
return tokenBean; |
||||
|
} |
||||
|
|
||||
|
// @Override
|
||||
|
// public UserVo.TokenToUserId userByBusinessToken(String accessToken, UserDto.BusinessToken params) {
|
||||
|
// //验证业务的accessToken
|
||||
|
// Claims claims;
|
||||
|
// try {
|
||||
|
// claims = JwtUtil.parseJWT(accessToken, WebConstant.JWT_ACCESS_TOKEN_SECERT);
|
||||
|
// }catch(Exception e){
|
||||
|
// log.info("token无效");
|
||||
|
// throw new BaseException(CodeEnum.NOT_LOGIN);
|
||||
|
// }
|
||||
|
// //检查业务是否存在
|
||||
|
// String appId = claims.getSubject();
|
||||
|
// Object secret = claims.get(WebConstant.ACCESS_TOKEN_SECRET);
|
||||
|
// OpenBusinessExample openBusinessExample = new OpenBusinessExample();
|
||||
|
// openBusinessExample.createCriteria().andAppIdEqualTo(appId).andSecretEqualTo(String.valueOf(secret));
|
||||
|
// long l = businessMapper.countByExample(openBusinessExample);
|
||||
|
// if(l == 0){
|
||||
|
// throw new BaseException(DeliveryCodeError.NOT_BUSINESS);
|
||||
|
// }
|
||||
|
// //根据token查找用户信息
|
||||
|
// //验证token是否有效
|
||||
|
//
|
||||
|
// Claims userClaims;
|
||||
|
// try {
|
||||
|
// userClaims = JwtUtil.parseJWT(params.getToken(), WebConstant.JWT_ACCESS_TOKEN_SECERT);
|
||||
|
// }catch(Exception e){
|
||||
|
// log.info("token无效");
|
||||
|
// throw new BaseException(CodeEnum.NOT_LOGIN);
|
||||
|
// }
|
||||
|
// //验证用户存根
|
||||
|
// if(!redisUtil.hasKey(RedisKeyManager.getTokenCachedKey(Long.valueOf(userClaims.getSubject())))){
|
||||
|
// log.info("用户存根不存在:{}",userClaims.getSubject());
|
||||
|
// throw new BaseException(CodeEnum.NOT_LOGIN);
|
||||
|
// }
|
||||
|
// SysUser sysUser = sysUserDao.selectByPrimaryKey(Long.valueOf(userClaims.getSubject()));
|
||||
|
// if(ObjectUtil.isNull(sysUser)){
|
||||
|
// throw new BaseException(CodeEnum.NOT_LOGIN);
|
||||
|
// }
|
||||
|
// UserVo.TokenToUserId userInfo = new UserVo.TokenToUserId();
|
||||
|
// userInfo.setId(sysUser.getId());
|
||||
|
// //获取用户信息
|
||||
|
// userInfo.setAvatarUrl(sysUser.getAvatarUrl());
|
||||
|
// userInfo.setUserName(sysUser.getName());
|
||||
|
// userInfo.setAuthType(sysUser.getAuthType());
|
||||
|
//
|
||||
|
// //查找手机号
|
||||
|
// userInfo.setPhone(sysAuthDao.getPhoneByUserId(sysUser.getId()));
|
||||
|
//返回用户信息
|
||||
|
// return getUserByToken(params.getToken());
|
||||
|
// }
|
||||
|
|
||||
|
@Override |
||||
|
public List<String> getUserIdByPhone(List<String> phoneList) { |
||||
|
List<String> userIdByPhone = null; |
||||
|
if(CollectionUtil.isNotEmpty(phoneList)){ |
||||
|
userIdByPhone = sysUserDao.getUserIdByPhone(phoneList); |
||||
|
} |
||||
|
return userIdByPhone; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public UserVo.TokenBean updateUserInfo(Long userId, UserDto.WxInfo userInfo) { |
||||
|
//通过userId查找到用户
|
||||
|
SysUser user = sysUserDao.selectByPrimaryKey(userId); |
||||
|
if (ObjectUtil.isNull(user)) { |
||||
|
throw new BaseException(CodeEnum.NOT_USER); |
||||
|
} |
||||
|
|
||||
|
if (StrUtil.isNotEmpty(userInfo.getNickname())) { |
||||
|
user.setName(userInfo.getNickname()); |
||||
|
} |
||||
|
if (StrUtil.isNotEmpty(userInfo.getHeadImgUrl())) { |
||||
|
user.setAvatarUrl(userInfo.getHeadImgUrl()); |
||||
|
} |
||||
|
if (ObjectUtil.isNotNull(userInfo.getSex())) { |
||||
|
user.setGender(userInfo.getSex()); |
||||
|
} |
||||
|
if (StrUtil.isNotEmpty(userInfo.getCountry())) { |
||||
|
user.setCountry(userInfo.getCountry()); |
||||
|
} |
||||
|
if (StrUtil.isNotEmpty(userInfo.getProvince())) { |
||||
|
user.setProvince(userInfo.getProvince()); |
||||
|
} |
||||
|
if (StrUtil.isNotEmpty(userInfo.getCity())) { |
||||
|
user.setCity(userInfo.getCity()); |
||||
|
} |
||||
|
sysUserDao.updateByPrimaryKeySelective(user); |
||||
|
//返回信息
|
||||
|
UserVo.TokenBean tokenBean = new UserVo.TokenBean(); |
||||
|
tokenBean.setId(user.getId()); |
||||
|
String phone = sysAuthDao.getPhoneByUserId(user.getId()); |
||||
|
tokenBean.setPhone(phone); |
||||
|
//获取用户信息
|
||||
|
tokenBean.setName(user.getName()); |
||||
|
tokenBean.setAvatarUrl(user.getAvatarUrl()); |
||||
|
if(ObjectUtil.isNull(tokenBean.getPhone())){ |
||||
|
tokenBean.setPhone(user.getPhone()); |
||||
|
} |
||||
|
return tokenBean; |
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package com.ccsens.delivery.util; |
||||
|
|
||||
|
import com.ccsens.util.CodeError; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
public class DeliveryCodeError extends CodeError { |
||||
|
public static final Code SMS_CODE_CORRECT = new Code(46,"请输入正确验证码",true); |
||||
|
public static final Code ILLEGAL_LOG_IN = new Code(400,"非法登录",true); |
||||
|
public static final Code NOT_REFRESH_TOKEN = new Code(401,"refreshToken过期,请重新登录",true); |
||||
|
public static final Code CLIENT_ERROR = new Code(501,"客户端类型异常",true); |
||||
|
public static final Code SIGNIN_ERROR = new Code(502,"登录异常",true); |
||||
|
public static final Code NOT_PHONE = new Code(503,"手机号不能为空",true); |
||||
|
public static final Code NOT_SMS_CODE = new Code(504,"请填写手机号验证码",true); |
||||
|
public static final Code ERROR_SEND_TOO_FAST = new Code(505,"60秒内只能发送一次,请稍后再试",false); |
||||
|
public static final Code NOT_BUSINESS = new Code(506,"业务信息异常",true); |
||||
|
|
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.ccsens.delivery.util; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
public class DeliveryConstant { |
||||
|
|
||||
|
/**是否发送验证码 0不发送 1发送*/ |
||||
|
public static final String SMS_CODE = "1"; |
||||
|
|
||||
|
/**默认公众号appId*/ |
||||
|
public static final String DEFAULT_APP_ID = "wxb3be21dcd7912555"; |
||||
|
/**默认公众号secret*/ |
||||
|
public static final String DEFAULT_SECRET = "9213776254878a8065f1a29d1f58a02c"; |
||||
|
|
||||
|
/**图片类型*/ |
||||
|
public static final String FILE_TYPE_IMG = "bmp,jpg,jpeg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,WMF,webp"; |
||||
|
/**文档类型*/ |
||||
|
public static final String FILE_TYPE_DOCUMENT = "doc, dot, wps, wpt, docx, dotx, docm, dotm, xls, xlt, et, xlsx, xltx, csv, xlsm, xltm, ppt,pptx,pptm,ppsx,ppsm,pps,potx,potm,dpt,dps, pdf"; |
||||
|
|
||||
|
|
||||
|
/**验证手机正则*/ |
||||
|
public static final String PHONE_REGEX = "^[1]([3-9])[0-9]{9}$"; |
||||
|
/**字符串分隔符*/ |
||||
|
public static final String STRING_REGEX = ",|,|;|;|、|/"; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
logging: |
||||
|
level: |
||||
|
com: |
||||
|
favorites: DEBUG |
||||
|
org: |
||||
|
hibernate: ERROR |
||||
|
springframework: |
||||
|
web: DEBUG |
||||
|
mybatis: |
||||
|
config-location: classpath:mybatis/mybatis-config.xml |
||||
|
mapper-locations: classpath*:mapper_*/*.xml |
||||
|
# type-aliases-package: com.ccsens.mtpro.bean |
||||
|
#server: |
||||
|
# tomcat: |
||||
|
# uri-encoding: UTF-8 |
||||
|
spring: |
||||
|
http: |
||||
|
encoding: |
||||
|
charset: UTF-8 |
||||
|
enabled: true |
||||
|
force: true |
||||
|
log-request-details: true |
||||
|
servlet: |
||||
|
multipart: |
||||
|
max-file-size: 200MB |
||||
|
max-request-size: 200MB |
||||
|
snowflake: |
||||
|
dataCenterId: 2 |
||||
|
workerId: 2 |
||||
|
|
@ -0,0 +1,53 @@ |
|||||
|
server: |
||||
|
port: 7340 |
||||
|
servlet: |
||||
|
context-path: /v1.0 |
||||
|
spring: |
||||
|
application: |
||||
|
name: delivery |
||||
|
datasource: |
||||
|
type: com.alibaba.druid.pool.DruidDataSource |
||||
|
# rabbitmq: |
||||
|
# host: 192.168.0.99 |
||||
|
# password: 111111 |
||||
|
# port: 5672 |
||||
|
# username: admin |
||||
|
# rabbitmq: |
||||
|
# host: dd.tall.wiki |
||||
|
# password: 111111 |
||||
|
# port: 5672 |
||||
|
# username: admin |
||||
|
# redis: |
||||
|
# database: 0 |
||||
|
# host: 127.0.0.1 |
||||
|
# jedis: |
||||
|
# pool: |
||||
|
# max-active: 200 |
||||
|
# max-idle: 10 |
||||
|
# max-wait: -1ms |
||||
|
# min-idle: 0 |
||||
|
# password: '' |
||||
|
# port: 6379 |
||||
|
# timeout: 1000ms |
||||
|
swagger: |
||||
|
enable: true |
||||
|
#mybatisCache: |
||||
|
# database: 1 |
||||
|
# host: 127.0.0.1 |
||||
|
# jedis: |
||||
|
# pool: |
||||
|
# max-active: 200 |
||||
|
# max-idle: 10 |
||||
|
# max-wait: -1 |
||||
|
# min-idle: 0 |
||||
|
# password: '' |
||||
|
# port: 6379 |
||||
|
# timeout: 1000 |
||||
|
|
||||
|
file: |
||||
|
path: /home/cloud/delivery/server/uploads/ |
||||
|
domain: http://127.0.0.1:7280/v1.0/ |
||||
|
imgDomain: http://127.0.0.1:7280/v1.0/uploads/ |
||||
|
url: |
||||
|
token: http://101.201.226.163/gateway/ptostall/users/token |
||||
|
subscriptWx: http://101.201.226.163/gateway/ptostall/wx/officialId |
@ -0,0 +1,19 @@ |
|||||
|
server: |
||||
|
port: 7340 |
||||
|
servlet: |
||||
|
context-path: /v1.0 |
||||
|
spring: |
||||
|
application: |
||||
|
name: delivery |
||||
|
datasource: |
||||
|
type: com.alibaba.druid.pool.DruidDataSource |
||||
|
swagger: |
||||
|
enable: true |
||||
|
|
||||
|
file: |
||||
|
path: /home/cloud/delivery/server/uploads/ |
||||
|
domain: https://www.tall.wiki/delivery/v1.0/ |
||||
|
imgDomain: https://www.tall.wiki/delivery/v1.0/uploads/ |
||||
|
url: |
||||
|
token: http://101.201.226.163/gateway/ptostall/users/token |
||||
|
subscriptWx: http://101.201.226.163/gateway/ptostall/wx/officialId |
@ -0,0 +1,19 @@ |
|||||
|
server: |
||||
|
port: 7340 |
||||
|
servlet: |
||||
|
context-path: /v1.0 |
||||
|
spring: |
||||
|
application: |
||||
|
name: delivery |
||||
|
datasource: |
||||
|
type: com.alibaba.druid.pool.DruidDataSource |
||||
|
swagger: |
||||
|
enable: true |
||||
|
|
||||
|
file: |
||||
|
path: /home/cloud/delivery/server/uploads/ |
||||
|
domain: http://test.tall.wiki/delivery/v1.0/ |
||||
|
imgDomain: http://test.tall.wiki/delivery/v1.0/uploads/ |
||||
|
url: |
||||
|
token: http://101.201.226.163/gateway/ptostall/users/token |
||||
|
subscriptWx: http://101.201.226.163/gateway/ptostall/wx/officialId |
@ -0,0 +1,4 @@ |
|||||
|
spring: |
||||
|
profiles: |
||||
|
active: test |
||||
|
include: common |
@ -0,0 +1,35 @@ |
|||||
|
spring: |
||||
|
datasource: |
||||
|
druid: |
||||
|
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
||||
|
driverClassName: com.mysql.cj.jdbc.Driver |
||||
|
dynamicUrl: jdbc:mysql://localhost:3306/${schema} |
||||
|
filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' |
||||
|
filterName: druidFilter |
||||
|
filterProfileEnable: true |
||||
|
filterUrlPattern: /* |
||||
|
filters: stat,wall |
||||
|
initialSize: 5 |
||||
|
maxActive: 20 |
||||
|
maxPoolPreparedStatementPerConnectionSize: 20 |
||||
|
maxWait: 60000 |
||||
|
minEvictableIdleTimeMillis: 300000 |
||||
|
minIdle: 5 |
||||
|
# password: 37080c1f223685592316b02dad8816c019290a476e54ebb638f9aa3ba8b6bdb9 |
||||
|
password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 |
||||
|
poolPreparedStatements: true |
||||
|
servletLogSlowSql: true |
||||
|
servletLoginPassword: 111111 |
||||
|
servletLoginUsername: druid |
||||
|
servletName: druidServlet |
||||
|
servletResetEnable: true |
||||
|
servletUrlMapping: /druid/* |
||||
|
testOnBorrow: false |
||||
|
testOnReturn: false |
||||
|
testWhileIdle: true |
||||
|
timeBetweenEvictionRunsMillis: 60000 |
||||
|
url: jdbc:mysql://test.tall.wiki:3306/delivery?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true |
||||
|
username: root |
||||
|
validationQuery: SELECT 1 FROM DUAL |
||||
|
# env: CCSENS_GAME |
||||
|
env: CCSENS_TALL |
@ -0,0 +1,33 @@ |
|||||
|
spring: |
||||
|
datasource: |
||||
|
druid: |
||||
|
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
||||
|
driverClassName: com.mysql.cj.jdbc.Driver |
||||
|
dynamicUrl: jdbc:mysql://localhost:3306/${schema} |
||||
|
filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' |
||||
|
filterName: druidFilter |
||||
|
filterProfileEnable: true |
||||
|
filterUrlPattern: /* |
||||
|
filters: stat,wall |
||||
|
initialSize: 5 |
||||
|
maxActive: 20 |
||||
|
maxPoolPreparedStatementPerConnectionSize: 20 |
||||
|
maxWait: 60000 |
||||
|
minEvictableIdleTimeMillis: 300000 |
||||
|
minIdle: 5 |
||||
|
password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 |
||||
|
poolPreparedStatements: true |
||||
|
servletLogSlowSql: true |
||||
|
servletLoginPassword: 111111 |
||||
|
servletLoginUsername: druid |
||||
|
servletName: druidServlet |
||||
|
servletResetEnable: true |
||||
|
servletUrlMapping: /druid/* |
||||
|
testOnBorrow: false |
||||
|
testOnReturn: false |
||||
|
testWhileIdle: true |
||||
|
timeBetweenEvictionRunsMillis: 60000 |
||||
|
url: jdbc:mysql://127.0.0.1/delivery?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true |
||||
|
username: root |
||||
|
validationQuery: SELECT 1 FROM DUAL |
||||
|
env: CCSENS_TALL |
@ -0,0 +1,33 @@ |
|||||
|
spring: |
||||
|
datasource: |
||||
|
druid: |
||||
|
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
||||
|
driverClassName: com.mysql.cj.jdbc.Driver |
||||
|
dynamicUrl: jdbc:mysql://localhost:3306/${schema} |
||||
|
filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' |
||||
|
filterName: druidFilter |
||||
|
filterProfileEnable: true |
||||
|
filterUrlPattern: /* |
||||
|
filters: stat,wall |
||||
|
initialSize: 5 |
||||
|
maxActive: 20 |
||||
|
maxPoolPreparedStatementPerConnectionSize: 20 |
||||
|
maxWait: 60000 |
||||
|
minEvictableIdleTimeMillis: 300000 |
||||
|
minIdle: 5 |
||||
|
password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 |
||||
|
poolPreparedStatements: true |
||||
|
servletLogSlowSql: true |
||||
|
servletLoginPassword: 111111 |
||||
|
servletLoginUsername: druid |
||||
|
servletName: druidServlet |
||||
|
servletResetEnable: true |
||||
|
servletUrlMapping: /druid/* |
||||
|
testOnBorrow: false |
||||
|
testOnReturn: false |
||||
|
testWhileIdle: true |
||||
|
timeBetweenEvictionRunsMillis: 60000 |
||||
|
url: jdbc:mysql://test.tall.wiki:3306/delivery?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true |
||||
|
username: root |
||||
|
validationQuery: SELECT 1 FROM DUAL |
||||
|
env: CCSENS_TALL |
@ -0,0 +1,196 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 --> |
||||
|
<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true --> |
||||
|
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> |
||||
|
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> |
||||
|
<configuration scan="true" scanPeriod="10 seconds"> |
||||
|
|
||||
|
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />--> |
||||
|
|
||||
|
<contextName>logback</contextName> |
||||
|
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 --> |
||||
|
<property name="log.path" value="/home/cloud/delivery/server/log/" /> |
||||
|
|
||||
|
<!-- 彩色日志 --> |
||||
|
<!-- 彩色日志依赖的渲染类 --> |
||||
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> |
||||
|
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> |
||||
|
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> |
||||
|
<!-- 彩色日志格式 --> |
||||
|
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
||||
|
|
||||
|
|
||||
|
<!--输出到控制台--> |
||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
||||
|
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
|
<level>info</level> |
||||
|
</filter> |
||||
|
<encoder> |
||||
|
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
||||
|
<!-- 设置字符集 --> |
||||
|
<charset>UTF-8</charset> |
||||
|
</encoder> |
||||
|
</appender> |
||||
|
|
||||
|
|
||||
|
<!--输出到文件--> |
||||
|
|
||||
|
<!-- 时间滚动输出 level为 DEBUG 日志 --> |
||||
|
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文件的路径及文件名 --> |
||||
|
<file>${log.path}/log_debug.log</file> |
||||
|
<!--日志文件输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<!-- 日志归档 --> |
||||
|
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文件保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文件只记录debug级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>debug</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 时间滚动输出 level为 INFO 日志 --> |
||||
|
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文件的路径及文件名 --> |
||||
|
<file>${log.path}/log_info.log</file> |
||||
|
<!--日志文件输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<!-- 每天日志归档路径以及格式 --> |
||||
|
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文件保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文件只记录info级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>info</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 时间滚动输出 level为 WARN 日志 --> |
||||
|
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文件的路径及文件名 --> |
||||
|
<file>${log.path}/log_warn.log</file> |
||||
|
<!--日志文件输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文件保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文件只记录warn级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>warn</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
|
||||
|
<!-- 时间滚动输出 level为 ERROR 日志 --> |
||||
|
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文件的路径及文件名 --> |
||||
|
<file>${log.path}/log_error.log</file> |
||||
|
<!--日志文件输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文件保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文件只记录ERROR级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>ERROR</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- |
||||
|
<logger>用来设置某一个包或者具体的某一个类的日志打印级别、 |
||||
|
以及指定<appender>。<logger>仅有一个name属性, |
||||
|
一个可选的level和一个可选的addtivity属性。 |
||||
|
name:用来指定受此logger约束的某一个包或者具体的某一个类。 |
||||
|
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
||||
|
还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。 |
||||
|
如果未设置此属性,那么当前logger将会继承上级的级别。 |
||||
|
addtivity:是否向上级logger传递打印信息。默认是true。 |
||||
|
--> |
||||
|
<!--<logger name="org.springframework.web" level="info"/>--> |
||||
|
<!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>--> |
||||
|
<!-- |
||||
|
使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作: |
||||
|
第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息 |
||||
|
第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别: |
||||
|
--> |
||||
|
|
||||
|
|
||||
|
<!-- |
||||
|
root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 |
||||
|
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
||||
|
不能设置为INHERITED或者同义词NULL。默认是DEBUG |
||||
|
可以包含零个或多个元素,标识这个appender将会添加到这个logger。 |
||||
|
--> |
||||
|
|
||||
|
<!--开发环境:打印控制台--> |
||||
|
<springProfile name="dev"> |
||||
|
<logger name="com.ccsens.ptpro.persist.*" level="debug"/> |
||||
|
</springProfile> |
||||
|
|
||||
|
<root level="info"> |
||||
|
<appender-ref ref="CONSOLE" /> |
||||
|
<appender-ref ref="DEBUG_FILE" /> |
||||
|
<appender-ref ref="INFO_FILE" /> |
||||
|
<appender-ref ref="WARN_FILE" /> |
||||
|
<appender-ref ref="ERROR_FILE" /> |
||||
|
</root> |
||||
|
|
||||
|
<!--生产环境:输出到文件--> |
||||
|
<!--<springProfile name="pro">--> |
||||
|
<!--<root level="info">--> |
||||
|
<!--<appender-ref ref="CONSOLE" />--> |
||||
|
<!--<appender-ref ref="DEBUG_FILE" />--> |
||||
|
<!--<appender-ref ref="INFO_FILE" />--> |
||||
|
<!--<appender-ref ref="ERROR_FILE" />--> |
||||
|
<!--<appender-ref ref="WARN_FILE" />--> |
||||
|
<!--</root>--> |
||||
|
<!--</springProfile>--> |
||||
|
|
||||
|
</configuration> |
@ -0,0 +1,27 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.ccsens.delivery.persist.dao.SysAuthDao"> |
||||
|
|
||||
|
<select id="getByPhone" resultType="com.ccsens.delivery.bean.po.SysAuth"> |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
t_sys_auth |
||||
|
WHERE |
||||
|
identify_type = 1 |
||||
|
and identifier = #{phone} |
||||
|
and rec_status = 0 |
||||
|
limit 1 |
||||
|
</select> |
||||
|
<select id="getPhoneByUserId" resultType="java.lang.String"> |
||||
|
SELECT |
||||
|
identifier |
||||
|
FROM |
||||
|
t_sys_auth |
||||
|
WHERE |
||||
|
identify_type = 1 |
||||
|
and user_id = #{userId} |
||||
|
and rec_status = 0 |
||||
|
limit 1 |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,53 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.ccsens.delivery.persist.dao.SysUserDao"> |
||||
|
|
||||
|
<select id="getVisitorUser" resultType="com.ccsens.delivery.bean.po.SysUser"> |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
t_sys_user |
||||
|
WHERE |
||||
|
device_id = #{deviceId} |
||||
|
and auth_type = 0 |
||||
|
and rec_status = 0 |
||||
|
limit 1 |
||||
|
</select> |
||||
|
<select id="getUserIdByPhone" resultType="java.lang.String"> |
||||
|
SELECT |
||||
|
user_id |
||||
|
FROM |
||||
|
t_sys_auth |
||||
|
WHERE |
||||
|
identify_type = 1 |
||||
|
and rec_status = 0 |
||||
|
and identifier in |
||||
|
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")"> |
||||
|
#{item} |
||||
|
</foreach> |
||||
|
</select> |
||||
|
<select id="getUserByIdentifier" resultType="com.ccsens.delivery.bean.vo.UserVo$UserSign"> |
||||
|
SELECT |
||||
|
u.id as userId, |
||||
|
a.id as authId, |
||||
|
u.avatar_url as avatarUrl, |
||||
|
(SELECT |
||||
|
identifier |
||||
|
FROM |
||||
|
t_sys_auth |
||||
|
WHERE |
||||
|
identify_type = 1 |
||||
|
and user_id = u.id |
||||
|
and rec_status = 0 |
||||
|
limit 1) as phone |
||||
|
FROM |
||||
|
t_sys_auth a, |
||||
|
t_sys_user u |
||||
|
WHERE |
||||
|
a.user_id = u.id |
||||
|
and a.identify_type = #{identifyType} |
||||
|
and a.identifier = #{identifier} |
||||
|
and a.rec_status = 0 |
||||
|
and u.rec_status = 0 |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,291 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.ccsens.delivery.persist.mapper.SysAuthMapper"> |
||||
|
<resultMap id="BaseResultMap" type="com.ccsens.delivery.bean.po.SysAuth"> |
||||
|
<id column="id" jdbcType="BIGINT" property="id" /> |
||||
|
<result column="user_id" jdbcType="BIGINT" property="userId" /> |
||||
|
<result column="identify_type" jdbcType="TINYINT" property="identifyType" /> |
||||
|
<result column="identifier" jdbcType="VARCHAR" property="identifier" /> |
||||
|
<result column="credential" jdbcType="VARCHAR" property="credential" /> |
||||
|
<result column="salt" jdbcType="VARCHAR" property="salt" /> |
||||
|
<result column="operator" jdbcType="BIGINT" property="operator" /> |
||||
|
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> |
||||
|
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" /> |
||||
|
<result column="rec_status" jdbcType="TINYINT" property="recStatus" /> |
||||
|
</resultMap> |
||||
|
<sql id="Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
<sql id="Update_By_Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="example.oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
<sql id="Base_Column_List"> |
||||
|
id, user_id, identify_type, identifier, credential, salt, operator, created_at, updated_at, |
||||
|
rec_status |
||||
|
</sql> |
||||
|
<select id="selectByExample" parameterType="com.ccsens.delivery.bean.po.SysAuthExample" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<if test="distinct"> |
||||
|
distinct |
||||
|
</if> |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from t_sys_auth |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
<if test="orderByClause != null"> |
||||
|
order by ${orderByClause} |
||||
|
</if> |
||||
|
</select> |
||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from t_sys_auth |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</select> |
||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
||||
|
delete from t_sys_auth |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</delete> |
||||
|
<delete id="deleteByExample" parameterType="com.ccsens.delivery.bean.po.SysAuthExample"> |
||||
|
delete from t_sys_auth |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</delete> |
||||
|
<insert id="insert" parameterType="com.ccsens.delivery.bean.po.SysAuth"> |
||||
|
insert into t_sys_auth (id, user_id, identify_type, |
||||
|
identifier, credential, salt, |
||||
|
operator, created_at, updated_at, |
||||
|
rec_status) |
||||
|
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{identifyType,jdbcType=TINYINT}, |
||||
|
#{identifier,jdbcType=VARCHAR}, #{credential,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR}, |
||||
|
#{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
#{recStatus,jdbcType=TINYINT}) |
||||
|
</insert> |
||||
|
<insert id="insertSelective" parameterType="com.ccsens.delivery.bean.po.SysAuth"> |
||||
|
insert into t_sys_auth |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null"> |
||||
|
id, |
||||
|
</if> |
||||
|
<if test="userId != null"> |
||||
|
user_id, |
||||
|
</if> |
||||
|
<if test="identifyType != null"> |
||||
|
identify_type, |
||||
|
</if> |
||||
|
<if test="identifier != null"> |
||||
|
identifier, |
||||
|
</if> |
||||
|
<if test="credential != null"> |
||||
|
credential, |
||||
|
</if> |
||||
|
<if test="salt != null"> |
||||
|
salt, |
||||
|
</if> |
||||
|
<if test="operator != null"> |
||||
|
operator, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
created_at, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
updated_at, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
rec_status, |
||||
|
</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null"> |
||||
|
#{id,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="userId != null"> |
||||
|
#{userId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="identifyType != null"> |
||||
|
#{identifyType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="identifier != null"> |
||||
|
#{identifier,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="credential != null"> |
||||
|
#{credential,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="salt != null"> |
||||
|
#{salt,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="operator != null"> |
||||
|
#{operator,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
#{createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
#{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
#{recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
<select id="countByExample" parameterType="com.ccsens.delivery.bean.po.SysAuthExample" resultType="java.lang.Long"> |
||||
|
select count(*) from t_sys_auth |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</select> |
||||
|
<update id="updateByExampleSelective" parameterType="map"> |
||||
|
update t_sys_auth |
||||
|
<set> |
||||
|
<if test="record.id != null"> |
||||
|
id = #{record.id,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.userId != null"> |
||||
|
user_id = #{record.userId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.identifyType != null"> |
||||
|
identify_type = #{record.identifyType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="record.identifier != null"> |
||||
|
identifier = #{record.identifier,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.credential != null"> |
||||
|
credential = #{record.credential,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.salt != null"> |
||||
|
salt = #{record.salt,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.operator != null"> |
||||
|
operator = #{record.operator,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.createdAt != null"> |
||||
|
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="record.updatedAt != null"> |
||||
|
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="record.recStatus != null"> |
||||
|
rec_status = #{record.recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</set> |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
<update id="updateByExample" parameterType="map"> |
||||
|
update t_sys_auth |
||||
|
set id = #{record.id,jdbcType=BIGINT}, |
||||
|
user_id = #{record.userId,jdbcType=BIGINT}, |
||||
|
identify_type = #{record.identifyType,jdbcType=TINYINT}, |
||||
|
identifier = #{record.identifier,jdbcType=VARCHAR}, |
||||
|
credential = #{record.credential,jdbcType=VARCHAR}, |
||||
|
salt = #{record.salt,jdbcType=VARCHAR}, |
||||
|
operator = #{record.operator,jdbcType=BIGINT}, |
||||
|
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, |
||||
|
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, |
||||
|
rec_status = #{record.recStatus,jdbcType=TINYINT} |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.delivery.bean.po.SysAuth"> |
||||
|
update t_sys_auth |
||||
|
<set> |
||||
|
<if test="userId != null"> |
||||
|
user_id = #{userId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="identifyType != null"> |
||||
|
identify_type = #{identifyType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="identifier != null"> |
||||
|
identifier = #{identifier,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="credential != null"> |
||||
|
credential = #{credential,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="salt != null"> |
||||
|
salt = #{salt,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="operator != null"> |
||||
|
operator = #{operator,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
created_at = #{createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
rec_status = #{recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</set> |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKey" parameterType="com.ccsens.delivery.bean.po.SysAuth"> |
||||
|
update t_sys_auth |
||||
|
set user_id = #{userId,jdbcType=BIGINT}, |
||||
|
identify_type = #{identifyType,jdbcType=TINYINT}, |
||||
|
identifier = #{identifier,jdbcType=VARCHAR}, |
||||
|
credential = #{credential,jdbcType=VARCHAR}, |
||||
|
salt = #{salt,jdbcType=VARCHAR}, |
||||
|
operator = #{operator,jdbcType=BIGINT}, |
||||
|
created_at = #{createdAt,jdbcType=TIMESTAMP}, |
||||
|
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
rec_status = #{recStatus,jdbcType=TINYINT} |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
</mapper> |
@ -0,0 +1,385 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.ccsens.delivery.persist.mapper.SysUserMapper"> |
||||
|
<resultMap id="BaseResultMap" type="com.ccsens.delivery.bean.po.SysUser"> |
||||
|
<id column="id" jdbcType="BIGINT" property="id" /> |
||||
|
<result column="name" jdbcType="VARCHAR" property="name" /> |
||||
|
<result column="gender" jdbcType="TINYINT" property="gender" /> |
||||
|
<result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl" /> |
||||
|
<result column="country" jdbcType="VARCHAR" property="country" /> |
||||
|
<result column="province" jdbcType="VARCHAR" property="province" /> |
||||
|
<result column="city" jdbcType="VARCHAR" property="city" /> |
||||
|
<result column="phone" jdbcType="VARCHAR" property="phone" /> |
||||
|
<result column="id_card" jdbcType="VARCHAR" property="idCard" /> |
||||
|
<result column="power" jdbcType="TINYINT" property="power" /> |
||||
|
<result column="device_id" jdbcType="VARCHAR" property="deviceId" /> |
||||
|
<result column="auth_type" jdbcType="TINYINT" property="authType" /> |
||||
|
<result column="operator" jdbcType="BIGINT" property="operator" /> |
||||
|
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> |
||||
|
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" /> |
||||
|
<result column="rec_status" jdbcType="TINYINT" property="recStatus" /> |
||||
|
</resultMap> |
||||
|
<sql id="Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
<sql id="Update_By_Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="example.oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
<sql id="Base_Column_List"> |
||||
|
id, name, gender, avatar_url, country, province, city, phone, id_card, power, device_id, |
||||
|
auth_type, operator, created_at, updated_at, rec_status |
||||
|
</sql> |
||||
|
<select id="selectByExample" parameterType="com.ccsens.delivery.bean.po.SysUserExample" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<if test="distinct"> |
||||
|
distinct |
||||
|
</if> |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from t_sys_user |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
<if test="orderByClause != null"> |
||||
|
order by ${orderByClause} |
||||
|
</if> |
||||
|
</select> |
||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from t_sys_user |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</select> |
||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
||||
|
delete from t_sys_user |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</delete> |
||||
|
<delete id="deleteByExample" parameterType="com.ccsens.delivery.bean.po.SysUserExample"> |
||||
|
delete from t_sys_user |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</delete> |
||||
|
<insert id="insert" parameterType="com.ccsens.delivery.bean.po.SysUser"> |
||||
|
insert into t_sys_user (id, name, gender, |
||||
|
avatar_url, country, province, |
||||
|
city, phone, id_card, |
||||
|
power, device_id, auth_type, |
||||
|
operator, created_at, updated_at, |
||||
|
rec_status) |
||||
|
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT}, |
||||
|
#{avatarUrl,jdbcType=VARCHAR}, #{country,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, |
||||
|
#{city,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{idCard,jdbcType=VARCHAR}, |
||||
|
#{power,jdbcType=TINYINT}, #{deviceId,jdbcType=VARCHAR}, #{authType,jdbcType=TINYINT}, |
||||
|
#{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
#{recStatus,jdbcType=TINYINT}) |
||||
|
</insert> |
||||
|
<insert id="insertSelective" parameterType="com.ccsens.delivery.bean.po.SysUser"> |
||||
|
insert into t_sys_user |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null"> |
||||
|
id, |
||||
|
</if> |
||||
|
<if test="name != null"> |
||||
|
name, |
||||
|
</if> |
||||
|
<if test="gender != null"> |
||||
|
gender, |
||||
|
</if> |
||||
|
<if test="avatarUrl != null"> |
||||
|
avatar_url, |
||||
|
</if> |
||||
|
<if test="country != null"> |
||||
|
country, |
||||
|
</if> |
||||
|
<if test="province != null"> |
||||
|
province, |
||||
|
</if> |
||||
|
<if test="city != null"> |
||||
|
city, |
||||
|
</if> |
||||
|
<if test="phone != null"> |
||||
|
phone, |
||||
|
</if> |
||||
|
<if test="idCard != null"> |
||||
|
id_card, |
||||
|
</if> |
||||
|
<if test="power != null"> |
||||
|
power, |
||||
|
</if> |
||||
|
<if test="deviceId != null"> |
||||
|
device_id, |
||||
|
</if> |
||||
|
<if test="authType != null"> |
||||
|
auth_type, |
||||
|
</if> |
||||
|
<if test="operator != null"> |
||||
|
operator, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
created_at, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
updated_at, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
rec_status, |
||||
|
</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null"> |
||||
|
#{id,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="name != null"> |
||||
|
#{name,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="gender != null"> |
||||
|
#{gender,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="avatarUrl != null"> |
||||
|
#{avatarUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="country != null"> |
||||
|
#{country,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="province != null"> |
||||
|
#{province,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="city != null"> |
||||
|
#{city,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="phone != null"> |
||||
|
#{phone,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="idCard != null"> |
||||
|
#{idCard,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="power != null"> |
||||
|
#{power,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="deviceId != null"> |
||||
|
#{deviceId,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="authType != null"> |
||||
|
#{authType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="operator != null"> |
||||
|
#{operator,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
#{createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
#{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
#{recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
<select id="countByExample" parameterType="com.ccsens.delivery.bean.po.SysUserExample" resultType="java.lang.Long"> |
||||
|
select count(*) from t_sys_user |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</select> |
||||
|
<update id="updateByExampleSelective" parameterType="map"> |
||||
|
update t_sys_user |
||||
|
<set> |
||||
|
<if test="record.id != null"> |
||||
|
id = #{record.id,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.name != null"> |
||||
|
name = #{record.name,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.gender != null"> |
||||
|
gender = #{record.gender,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="record.avatarUrl != null"> |
||||
|
avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.country != null"> |
||||
|
country = #{record.country,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.province != null"> |
||||
|
province = #{record.province,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.city != null"> |
||||
|
city = #{record.city,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.phone != null"> |
||||
|
phone = #{record.phone,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.idCard != null"> |
||||
|
id_card = #{record.idCard,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.power != null"> |
||||
|
power = #{record.power,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="record.deviceId != null"> |
||||
|
device_id = #{record.deviceId,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.authType != null"> |
||||
|
auth_type = #{record.authType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="record.operator != null"> |
||||
|
operator = #{record.operator,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.createdAt != null"> |
||||
|
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="record.updatedAt != null"> |
||||
|
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="record.recStatus != null"> |
||||
|
rec_status = #{record.recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</set> |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
<update id="updateByExample" parameterType="map"> |
||||
|
update t_sys_user |
||||
|
set id = #{record.id,jdbcType=BIGINT}, |
||||
|
name = #{record.name,jdbcType=VARCHAR}, |
||||
|
gender = #{record.gender,jdbcType=TINYINT}, |
||||
|
avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}, |
||||
|
country = #{record.country,jdbcType=VARCHAR}, |
||||
|
province = #{record.province,jdbcType=VARCHAR}, |
||||
|
city = #{record.city,jdbcType=VARCHAR}, |
||||
|
phone = #{record.phone,jdbcType=VARCHAR}, |
||||
|
id_card = #{record.idCard,jdbcType=VARCHAR}, |
||||
|
power = #{record.power,jdbcType=TINYINT}, |
||||
|
device_id = #{record.deviceId,jdbcType=VARCHAR}, |
||||
|
auth_type = #{record.authType,jdbcType=TINYINT}, |
||||
|
operator = #{record.operator,jdbcType=BIGINT}, |
||||
|
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, |
||||
|
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, |
||||
|
rec_status = #{record.recStatus,jdbcType=TINYINT} |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.delivery.bean.po.SysUser"> |
||||
|
update t_sys_user |
||||
|
<set> |
||||
|
<if test="name != null"> |
||||
|
name = #{name,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="gender != null"> |
||||
|
gender = #{gender,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="avatarUrl != null"> |
||||
|
avatar_url = #{avatarUrl,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="country != null"> |
||||
|
country = #{country,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="province != null"> |
||||
|
province = #{province,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="city != null"> |
||||
|
city = #{city,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="phone != null"> |
||||
|
phone = #{phone,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="idCard != null"> |
||||
|
id_card = #{idCard,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="power != null"> |
||||
|
power = #{power,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="deviceId != null"> |
||||
|
device_id = #{deviceId,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="authType != null"> |
||||
|
auth_type = #{authType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="operator != null"> |
||||
|
operator = #{operator,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="createdAt != null"> |
||||
|
created_at = #{createdAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="updatedAt != null"> |
||||
|
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="recStatus != null"> |
||||
|
rec_status = #{recStatus,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
</set> |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKey" parameterType="com.ccsens.delivery.bean.po.SysUser"> |
||||
|
update t_sys_user |
||||
|
set name = #{name,jdbcType=VARCHAR}, |
||||
|
gender = #{gender,jdbcType=TINYINT}, |
||||
|
avatar_url = #{avatarUrl,jdbcType=VARCHAR}, |
||||
|
country = #{country,jdbcType=VARCHAR}, |
||||
|
province = #{province,jdbcType=VARCHAR}, |
||||
|
city = #{city,jdbcType=VARCHAR}, |
||||
|
phone = #{phone,jdbcType=VARCHAR}, |
||||
|
id_card = #{idCard,jdbcType=VARCHAR}, |
||||
|
power = #{power,jdbcType=TINYINT}, |
||||
|
device_id = #{deviceId,jdbcType=VARCHAR}, |
||||
|
auth_type = #{authType,jdbcType=TINYINT}, |
||||
|
operator = #{operator,jdbcType=BIGINT}, |
||||
|
created_at = #{createdAt,jdbcType=TIMESTAMP}, |
||||
|
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, |
||||
|
rec_status = #{recStatus,jdbcType=TINYINT} |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
</mapper> |
@ -0,0 +1,62 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE generatorConfiguration |
||||
|
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> |
||||
|
|
||||
|
<generatorConfiguration> |
||||
|
<context id="MySQL" targetRuntime="MyBatis3"> |
||||
|
<!-- 为生成的Java模型创建一个toString方法 --> |
||||
|
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"></plugin> |
||||
|
|
||||
|
<!-- 自定义的序列化 类文件 插件 --> |
||||
|
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"></plugin> |
||||
|
|
||||
|
<!-- 重新生成xml文件,而不是追加 --> |
||||
|
<plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin" /> |
||||
|
|
||||
|
<commentGenerator> |
||||
|
<!-- 是否去除自动生成的注释 true:是 : false:否 --> |
||||
|
<property name="suppressAllComments" value="true" /> |
||||
|
</commentGenerator> |
||||
|
|
||||
|
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 --> |
||||
|
<jdbcConnection driverClass="com.mysql.jdbc.Driver" |
||||
|
connectionURL="jdbc:mysql://test.tall.wiki:3306/delivery?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false" |
||||
|
userId="root" |
||||
|
password="po3OynBO[M3579p6L7)o"> |
||||
|
</jdbcConnection> |
||||
|
|
||||
|
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和 |
||||
|
NUMERIC 类型解析为java.math.BigDecimal --> |
||||
|
<javaTypeResolver> |
||||
|
<property name="forceBigDecimals" value="true" /> |
||||
|
</javaTypeResolver> |
||||
|
|
||||
|
<!-- targetProject:生成PO类的位置 --> |
||||
|
<javaModelGenerator targetPackage="com.ccsens.delivery.bean.po" |
||||
|
targetProject=".\src\main\java"> |
||||
|
<!-- enableSubPackages:是否让schema作为包的后缀 --> |
||||
|
<property name="enableSubPackages" value="false" /> |
||||
|
<!-- 从数据库返回的值被清理前后的空格 --> |
||||
|
<property name="trimStrings" value="true" /> |
||||
|
</javaModelGenerator> |
||||
|
|
||||
|
<!-- targetProject:mapper映射文件生成的位置 --> |
||||
|
<sqlMapGenerator targetPackage="mapper_raw" |
||||
|
targetProject=".\src\main\resources"> |
||||
|
<!-- enableSubPackages:是否让schema作为包的后缀 --> |
||||
|
<property name="enableSubPackages" value="false" /> |
||||
|
</sqlMapGenerator> |
||||
|
|
||||
|
<!-- targetPackage:mapper接口生成的位置 --> |
||||
|
<javaClientGenerator type="XMLMAPPER" |
||||
|
targetPackage="com.ccsens.delivery.persist.mapper" |
||||
|
targetProject=".\src\main\java"> |
||||
|
<!-- enableSubPackages:是否让schema作为包的后缀 --> |
||||
|
<property name="enableSubPackages" value="false" /> |
||||
|
</javaClientGenerator> |
||||
|
|
||||
|
<table tableName="t_sys_user" domainObjectName="SysUser"/> |
||||
|
<table tableName="t_sys_auth" domainObjectName="SysAuth"/> |
||||
|
</context> |
||||
|
</generatorConfiguration> |
@ -0,0 +1,62 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE configuration |
||||
|
PUBLIC "-//mybatis.org//DTD Config 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-config.dtd"> |
||||
|
|
||||
|
<configuration> |
||||
|
<!-- 全局参数 --> |
||||
|
<settings> |
||||
|
<!-- 打印SQL语句 --> |
||||
|
<setting name="logImpl" value="STDOUT_LOGGING" /> |
||||
|
<!-- 使全局的映射器启用或禁用缓存。 --> |
||||
|
<setting name="cacheEnabled" value="true"/> |
||||
|
<!-- 全局启用或禁用延迟加载。当禁用时,所有关联对象都会即时加载。 --> |
||||
|
<setting name="lazyLoadingEnabled" value="true"/> |
||||
|
<!-- 当启用时,有延迟加载属性的对象在被调用时将会完全加载任意属性。否则,每种属性将会按需要加载。 --> |
||||
|
<setting name="aggressiveLazyLoading" value="true"/> |
||||
|
<!-- 是否允许单条sql 返回多个数据集 (取决于驱动的兼容性) default:true --> |
||||
|
<setting name="multipleResultSetsEnabled" value="true"/> |
||||
|
<!-- 是否可以使用列的别名 (取决于驱动的兼容性) default:true --> |
||||
|
<setting name="useColumnLabel" value="true"/> |
||||
|
<!-- 允许JDBC 生成主键。需要驱动器支持。如果设为了true,这个设置将强制使用被生成的主键,有一些驱动器不兼容不过仍然可以执行。 default:false --> |
||||
|
<setting name="useGeneratedKeys" value="true"/> |
||||
|
<!-- 指定 MyBatis 如何自动映射 数据基表的列 NONE:不隐射 PARTIAL:部分 FULL:全部 --> |
||||
|
<setting name="autoMappingBehavior" value="PARTIAL"/> |
||||
|
<!-- 这是默认的执行类型 (SIMPLE: 简单; REUSE: 执行器可能重复使用prepared statements语句;BATCH: 执行器可以重复执行语句和批量更新) --> |
||||
|
<setting name="defaultExecutorType" value="SIMPLE"/> |
||||
|
<!-- 使用驼峰命名法转换字段。 --> |
||||
|
<setting name="mapUnderscoreToCamelCase" value="true"/> |
||||
|
<!-- 设置本地缓存范围 session:就会有数据的共享 statement:语句范围 (这样就不会有数据的共享 ) defalut:session --> |
||||
|
<setting name="localCacheScope" value="SESSION"/> |
||||
|
<!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER,插入空值时不需要指定类型 --> |
||||
|
<setting name="jdbcTypeForNull" value="NULL"/> |
||||
|
</settings> |
||||
|
|
||||
|
<typeAliases> |
||||
|
<typeAlias alias="Integer" type="java.lang.Integer" /> |
||||
|
<typeAlias alias="Long" type="java.lang.Long" /> |
||||
|
<typeAlias alias="HashMap" type="java.util.HashMap" /> |
||||
|
<typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap" /> |
||||
|
<typeAlias alias="ArrayList" type="java.util.ArrayList" /> |
||||
|
<typeAlias alias="LinkedList" type="java.util.LinkedList" /> |
||||
|
<typeAlias alias="String" type="java.lang.String" /> |
||||
|
</typeAliases> |
||||
|
|
||||
|
<plugins> |
||||
|
<!-- com.github.pagehelper为PageHelper类所在包名 --> |
||||
|
<plugin interceptor="com.github.pagehelper.PageHelper"> |
||||
|
<property name="dialect" value="mysql"/> |
||||
|
<!-- 该参数默认为false --> |
||||
|
<!-- 设置为true时,会将RowBounds第一个参数offset当成pageNum页码使用 --> |
||||
|
<!-- 和startPage中的pageNum效果一样--> |
||||
|
<property name="offsetAsPageNum" value="false"/> |
||||
|
<!-- 该参数默认为false --> |
||||
|
<!-- 设置为true时,使用RowBounds分页会进行count查询 --> |
||||
|
<property name="rowBoundsWithCount" value="false"/> |
||||
|
<property name="pageSizeZero" value="true"/> |
||||
|
<property name="reasonable" value="false"/> |
||||
|
<property name="supportMethodsArguments" value="false"/> |
||||
|
<property name="returnPageInfo" value="none"/> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</configuration> |
Loading…
Reference in new issue