Commit 4179081b by 涂亚平

start...

0 parents
Showing with 7848 additions and 0 deletions
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/
No preview for this file type
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
2023-02-21 09:22:54,349 [main] INFO org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:330 - Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$93373f07] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-02-21 09:22:54,523 [main] INFO org.springframework.boot.web.embedded.tomcat.TomcatWebServer:90 - Tomcat initialized with port(s): 34567 (http)
2023-02-21 09:22:54,531 [main] INFO org.apache.coyote.http11.Http11NioProtocol:173 - Initializing ProtocolHandler ["http-nio-34567"]
2023-02-21 09:22:54,537 [main] INFO org.apache.catalina.core.StandardService:173 - Starting service [Tomcat]
2023-02-21 09:22:54,537 [main] INFO org.apache.catalina.core.StandardEngine:173 - Starting Servlet engine: [Apache Tomcat/9.0.22]
2023-02-21 09:22:54,613 [main] INFO org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]:173 - Initializing Spring embedded WebApplicationContext
2023-02-21 09:22:54,614 [main] INFO org.springframework.web.context.ContextLoader:284 - Root WebApplicationContext: initialization completed in 1098 ms
2023-02-21 09:22:54,689 [main] INFO com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure:56 - Init DruidDataSource
2023-02-21 09:22:55,721 [main] INFO com.alibaba.druid.pool.DruidDataSource:994 - {dataSource-1} inited
2023-02-21 09:22:56,633 [main] INFO springfox.documentation.spring.web.PropertySourcedRequestMappingHandlerMapping:69 - Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2023-02-21 09:22:56,719 [main] INFO org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor:171 - Initializing ExecutorService 'applicationTaskExecutor'
2023-02-21 09:22:56,859 [main] INFO springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper:160 - Context refreshed
2023-02-21 09:22:56,872 [main] INFO springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper:163 - Found 1 custom documentation plugin(s)
2023-02-21 09:22:56,897 [main] INFO springfox.documentation.spring.web.scanners.ApiListingReferenceScanner:41 - Scanning for api listing references
2023-02-21 09:22:57,047 [main] INFO org.apache.coyote.http11.Http11NioProtocol:173 - Starting ProtocolHandler ["http-nio-34567"]
2023-02-21 09:22:57,064 [main] INFO org.springframework.boot.web.embedded.tomcat.TomcatWebServer:202 - Tomcat started on port(s): 34567 (http) with context path ''
2023-02-21 10:10:47,110 [http-nio-34567-exec-1] INFO org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]:173 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-02-21 10:10:47,111 [http-nio-34567-exec-1] INFO org.springframework.web.servlet.DispatcherServlet:524 - Initializing Servlet 'dispatcherServlet'
2023-02-21 10:10:47,115 [http-nio-34567-exec-1] INFO org.springframework.web.servlet.DispatcherServlet:546 - Completed initialization in 4 ms
2023-02-21 10:51:35,688 [Thread-10] INFO org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor:208 - Shutting down ExecutorService 'applicationTaskExecutor'
2023-02-21 10:51:35,690 [Thread-10] INFO com.alibaba.druid.pool.DruidDataSource:2029 - {dataSource-1} closing ...
2023-02-21 10:51:35,692 [Thread-10] INFO com.alibaba.druid.pool.DruidDataSource:2101 - {dataSource-1} closed
2023-02-21 10:51:40,188 [main] INFO org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:330 - Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$d1e6e1c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-02-21 10:51:40,359 [main] INFO org.springframework.boot.web.embedded.tomcat.TomcatWebServer:90 - Tomcat initialized with port(s): 34567 (http)
2023-02-21 10:51:40,368 [main] INFO org.apache.coyote.http11.Http11NioProtocol:173 - Initializing ProtocolHandler ["http-nio-34567"]
2023-02-21 10:51:40,374 [main] INFO org.apache.catalina.core.StandardService:173 - Starting service [Tomcat]
2023-02-21 10:51:40,374 [main] INFO org.apache.catalina.core.StandardEngine:173 - Starting Servlet engine: [Apache Tomcat/9.0.22]
2023-02-21 10:51:40,447 [main] INFO org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]:173 - Initializing Spring embedded WebApplicationContext
2023-02-21 10:51:40,447 [main] INFO org.springframework.web.context.ContextLoader:284 - Root WebApplicationContext: initialization completed in 1027 ms
2023-02-21 10:51:40,517 [main] INFO com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure:56 - Init DruidDataSource
2023-02-21 10:51:41,559 [main] INFO com.alibaba.druid.pool.DruidDataSource:994 - {dataSource-1} inited
2023-02-21 10:51:42,461 [main] INFO springfox.documentation.spring.web.PropertySourcedRequestMappingHandlerMapping:69 - Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2023-02-21 10:51:42,538 [main] INFO org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor:171 - Initializing ExecutorService 'applicationTaskExecutor'
2023-02-21 10:51:42,672 [main] INFO springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper:160 - Context refreshed
2023-02-21 10:51:42,686 [main] INFO springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper:163 - Found 1 custom documentation plugin(s)
2023-02-21 10:51:42,709 [main] INFO springfox.documentation.spring.web.scanners.ApiListingReferenceScanner:41 - Scanning for api listing references
2023-02-21 10:51:42,858 [main] INFO org.apache.coyote.http11.Http11NioProtocol:173 - Starting ProtocolHandler ["http-nio-34567"]
2023-02-21 10:51:42,876 [main] INFO org.springframework.boot.web.embedded.tomcat.TomcatWebServer:202 - Tomcat started on port(s): 34567 (http) with context path ''
2023-02-21 10:51:48,136 [http-nio-34567-exec-1] INFO org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]:173 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-02-21 10:51:48,137 [http-nio-34567-exec-1] INFO org.springframework.web.servlet.DispatcherServlet:524 - Initializing Servlet 'dispatcherServlet'
2023-02-21 10:51:48,141 [http-nio-34567-exec-1] INFO org.springframework.web.servlet.DispatcherServlet:546 - Completed initialization in 4 ms
#!/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 "$@"
@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%
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.laowu</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>laowu</name>
<description>laowu</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<java.version>1.8</java.version>
<mybatis-plus.version>3.3.0</mybatis-plus.version>
<generator.version>3.3.2</generator.version>
<swagger2.version>2.9.2</swagger2.version>
<druid.version>1.1.22</druid.version>
<java-jwt.version>3.10.3</java-jwt.version>
<poi-ooxml.version>3.13</poi-ooxml.version>
<lang3.version>3.9</lang3.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<!-- <optional>true</optional>-->
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>${generator.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<!--webSocket-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>${java-jwt.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi-ooxml.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${lang3.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.laowu;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@MapperScan(basePackages = {"com.laowu.mapper"})
@RestController
public class LaowuApplication {
public static void main(String[] args) {
SpringApplication.run(LaowuApplication.class, args);
}
}
package com.laowu.common;
import org.apache.catalina.connector.Connector;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.MultipartConfigElement;
@Configuration
public class MyTomcat {
@Value("${spring.server.port}")
private String port;
@Value("${spring.server.acceptorThreadCount}")
private String acceptorThreadCount;
@Value("${spring.server.minSpareThreads}")
private String minSpareThreads;
@Value("${spring.server.maxSpareThreads}")
private String maxSpareThreads;
@Value("${spring.server.maxThreads}")
private String maxThreads;
@Value("${spring.server.maxConnections}")
private String maxConnections;
@Value("${spring.server.protocol}")
private String protocol;
@Value("${spring.server.redirectPort}")
private String redirectPort;
@Value("${spring.server.compression}")
private String compression;
@Value("${spring.server.connectionTimeout}")
private String connectionTimeout;
@Value("${spring.server.MaxFileSize}")
private String MaxFileSize;
@Value("${spring.server.MaxRequestSize}")
private String MaxRequestSize;
@Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
tomcat.addConnectorCustomizers(new GwsTomcatConnectionCustomizer());
return tomcat;
}
@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
// 单个数据大小
factory.setMaxFileSize(MaxFileSize); // KB,MB
/// 总上传数据大小
factory.setMaxRequestSize(MaxRequestSize);
return factory.createMultipartConfig();
}
/**
*
* 默认http连接
*
* @version
* @author liuyi 2016年7月20日 下午7:59:41
*
*/
public class GwsTomcatConnectionCustomizer implements TomcatConnectorCustomizer {
public GwsTomcatConnectionCustomizer() {
}
@Override
public void customize(Connector connector) {
connector.setPort(Integer.valueOf(port));
connector.setAttribute("connectionTimeout", connectionTimeout);
connector.setAttribute("acceptorThreadCount", acceptorThreadCount);
connector.setAttribute("minSpareThreads", minSpareThreads);
connector.setAttribute("maxSpareThreads", maxSpareThreads);
connector.setAttribute("maxThreads", maxThreads);
connector.setAttribute("maxConnections", maxConnections);
connector.setAttribute("protocol", protocol);
connector.setAttribute("redirectPort", "redirectPort");
connector.setAttribute("compression", "compression");
}
}
}
package com.laowu.common;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.laowu.common.handler.MetaHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author: tuyp
* @create: 2020-08-12 12:01
*/
@Configuration
@ConditionalOnClass(value = {PaginationInterceptor.class})
public class MybatisPlusConfig {
/**
* 分页
* @return
*/
@Bean
public PaginationInterceptor paginationInterceptor(){
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
paginationInterceptor.setDialectType(DbType.MYSQL.getDb());
return paginationInterceptor;
}
//
// /**
// * 打印 sql
// */
// @Bean
// public PerformanceInterceptor performanceInterceptor() {
// PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
// //格式化sql语句
// Properties properties = new Properties();
// properties.setProperty("format", "false");
// performanceInterceptor.setProperties(properties);
// return performanceInterceptor;
// }
/**
* 自动填充功能
* @return
*/
@Bean
public GlobalConfig globalConfig() {
GlobalConfig globalConfig = new GlobalConfig();
globalConfig.setMetaObjectHandler(new MetaHandler());
return globalConfig;
}
}
package com.laowu.common;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* 读取状态码
* </p>
*
* @author DengMin
* @date Created in 2020/08/24
*/
@Component
@ConfigurationProperties(prefix = "laowu")
@PropertySource(value = "classpath:code.properties", encoding = "UTF-8")
public class RemoteProperties {
private static Map<Integer, String> codeMessage = new HashMap<>();
public static String getMessage(Integer code) {
return codeMessage.get(code);
}
public Map<Integer, String> getCodeMessage() {
return codeMessage;
}
public void setCodeMessage(Map<Integer, String> codeMessage) {
RemoteProperties.codeMessage = codeMessage;
}
}
\ No newline at end of file
package com.laowu.common;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.pathMapping("/")
.select()
.apis(RequestHandlerSelectors.basePackage("com.laowu"))
.paths(PathSelectors.any())
.build().apiInfo(new ApiInfoBuilder()
.title("劳务可信库")
.description("接口文档规范")
.version("1.0")
// .contact(new Contact("啊啊啊啊","www.youkehulian.com","tcp@meishu.com"))
// .license("The Apache License")
// .licenseUrl("http://www.baidu.com")
.build());
}
}
package com.laowu.common;
import com.laowu.common.interceptor.AuthenticationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
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;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author DengMin
* @date 2020/07/06
**/
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Autowired
private AuthenticationInterceptor authenticationInterceptor;
/**
* 跨域支持
*
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
// .allowCredentials(true)
.allowedOrigins("*")
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*")
.maxAge(3600);
}
/**
* Swagger
*
* @param registry
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
/**
* 鉴权
*
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authenticationInterceptor)
.excludePathPatterns("/static/*")
.addPathPatterns("/**");
}
@Bean
public CorsFilter corsFilter() {
CorsConfiguration config = new CorsConfiguration();
config.setMaxAge(3600L);
config.addAllowedOrigin("*");
config.addAllowedMethod("*");
config.addAllowedHeader("*");
UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
configSource.registerCorsConfiguration("/**", config);
return new CorsFilter(configSource);
}
}
\ No newline at end of file
package com.laowu.common.constant;
import lombok.Getter;
@Getter
public enum Code {
USERNAMENOTFOUND(1001, "用户不存在"),
BADCREDENTIALS(1002,"账户或者密码错误"),
ACCOUNTEXPIRED(1003,"账户过期"),
LOCKEDEXCEPTION(1004, "账户已锁定"),
DISABLEDEXCEPTION(1005,"账户已禁用"),
ACCESSDENIED(1006,"无权限访问"),
AUTHENTICATION(1007,"身份验证异常"),
NOHANDLERFOUND(1008,"找不到相应的视图处理器"),
PARAM_INVALID(1009, "参数不合法"),
TOKEN_EXCEPTION(1010, "无效的令牌"),
TOKEN_EXPIRED(1011, "当前账户已在其他设备登录"),
TOKEN_VERIFICATION_FAILED(1013, "令牌验证失败"),
OSS_ERROR(1012, "OSS文件上传异常"),
Network_ERROR(9000, "网络请求失败"),
SERVER_INTERNAL_ERROR(99999, "服务器内部错误"),
;
private Integer code;
private String message;
Code(Integer code, String message) {
this.code = code;
this.message = message;
}
}
package com.laowu.common.exception;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.laowu.common.RemoteProperties;
import com.laowu.common.constant.Code;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.NoHandlerFoundException;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
* 异常处理
* @author DengMin
* @date 2020/07/14
**/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
/**
* 自定义异常
* @param e
* @return
*/
@ExceptionHandler(value = HttpException.class)
public ResponseVO handlerException(HttpServletRequest request, HttpException e) {
String message = RemoteProperties.getMessage(e.getCode());
if(StringUtils.isBlank(message)) {
message = e.getMessage();
}
String url = request.getRequestURI();
return ResponseData.generateCreatedResponse(e.getCode(), message, url);
}
/**
* 404
* @param request
* @return
*/
@ExceptionHandler(value = NoHandlerFoundException.class)
public ResponseVO NoHandlerFoundException(HttpServletRequest request) {
String url = request.getRequestURI();
return ResponseData.generateCreatedResponse(Code.NOHANDLERFOUND.getCode(), Code.NOHANDLERFOUND.getMessage(), url);
}
/**
* 请求方式错误
* @param request
* @return
*/
@ExceptionHandler(value = HttpRequestMethodNotSupportedException.class)
public ResponseVO HttpRequestMethodNotSupportedException(HttpServletRequest request) {
String url = request.getRequestURI();
return ResponseData.generateCreatedResponse(Code.NOHANDLERFOUND.getCode(), Code.NOHANDLERFOUND.getMessage(), url);
}
/**
* 参数不合法
* @param e
* @return
*/
@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseVO validateException(MethodArgumentNotValidException e){
final List<String> errList = new ArrayList<>();
e.getBindingResult().getAllErrors().stream().forEach(x -> {
errList.add(x.getDefaultMessage());
});
return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage(), errList.toString());
}
/**
* JSON 序列化异常
* @param e
* @return
*/
@ExceptionHandler(HttpMessageNotReadableException.class)
public ResponseVO exceptionHandler(HttpMessageNotReadableException e) {
log.error(e.getMessage());
return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage()+":{"+e.getMessage()+"}");
}
/**
* 校验异常
* @param e
* @return
*/
@ExceptionHandler(BindException.class)
public ResponseVO BindException(BindException e){
final List<String> errList = new ArrayList<>();
e.getBindingResult().getAllErrors().stream().forEach(x -> {
errList.add(x.getDefaultMessage());
});
return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage(), errList.toString());
}
/**
* 服务器内部错误
* @return
*/
@ExceptionHandler(value = Exception.class)
public ResponseVO serverInternalError(Exception e, HttpServletRequest request) {
String url = request.getRequestURI();
// log.error("path:"+url);
// log.error("---- error message: ---"+e.toString());
e.printStackTrace();
return ResponseData.generateCreatedResponse(Code.SERVER_INTERNAL_ERROR.getCode(), Code.SERVER_INTERNAL_ERROR.getMessage(), url);
}
}
\ No newline at end of file
package com.laowu.common.exception;
import com.laowu.common.RemoteProperties;
/**
* 异常处理
* @author DengMin
* @date 2020/08/12
**/
public class HttpException extends RuntimeException{
private Integer code;
private String message;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
@Override
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public HttpException(Integer code) {
super(RemoteProperties.getMessage(code));
String message = RemoteProperties.getMessage(code);
this.message = message;
this.code = code;
}
public HttpException(Integer code, String message) {
this.message = message;
this.code = code;
}
}
package com.laowu.common.handler;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
/**
* 填充配置
* @author DengMin
* @date 2020/07/21
**/
@Component
public class MetaHandler implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
this.setFieldValByName("createDate", LocalDateTime.now(), metaObject);
}
@Override
public void updateFill(MetaObject metaObject) {
this.setFieldValByName("updateDate", LocalDateTime.now(), metaObject);
}
}
package com.laowu.common.interceptor;
import com.auth0.jwt.interfaces.Claim;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.laowu.common.exception.HttpException;
import com.laowu.mapper.AdministerMapper;
import com.laowu.model.AdministerDO;
import com.laowu.util.ConstantUtils;
import com.laowu.util.JwtUtil;
import com.laowu.util.Localstorage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.util.Map;
/**
* <p>
* 鉴权拦截器
* </p>
*
* @author DengMin
* @since 2021/4/14
*/
@Component
public class AuthenticationInterceptor implements HandlerInterceptor {
@Autowired
private AdministerMapper administerMapper;
@Override
@CrossOrigin()
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
// 不需要进行拦截
if (!(handler instanceof HandlerMethod)) {
return true;
}
HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod();
TimeRequired timeRequired = method.getAnnotation(TimeRequired.class);
LoginRequired methodAnnotation = method.getAnnotation(LoginRequired.class);
if (methodAnnotation != null) {
String authorization = request.getHeader("Authorization");
if (!StringUtils.isBlank(authorization)) {
String token = authorization;
if (authorization.startsWith("Bearer")) {
token = authorization.replace("Bearer ", "");
}
/*Token不存在*/
if (token == null || !JwtUtil.verifyToken(token)) {
throw new HttpException(1010);
}
Map<String, Claim> claimMap = JwtUtil.getClaims(token);
if (claimMap != null) {
//String[] role = methodAnnotation.value();
String type = claimMap.get("type").asString();
if (ConstantUtils.ADMINISTER_TERMINATE.equals(type)) {
AdministerDO administerDO = administerMapper.selectById(claimMap.get("id").asLong());
if (administerDO != null) {
Localstorage.setUser(administerDO);
return true;
}
}
// else if(ConstantUtils.MOBILE_TERMINATE.equals(type)) {
// MemberDO memberDO = memberMapper.selectById(claimMap.get("id").asLong());
// if(memberDO != null) {
// Localstorage.setUser(memberDO);
// return true;
// }
//
// int count = memberTokensMapper.selectCount(new QueryWrapper<MemberTokensDO>()
// .lambda()
// .eq(MemberTokensDO::getMemberId,memberDO.getId()));
// if (count==0){
// throw new HttpException(1011);
// }
else {
throw new HttpException(1010);
}
}
}
throw new HttpException(1010);
}
return true;
}
}
package com.laowu.common.interceptor;
import java.lang.annotation.*;
/**
* <p>
* 自定义验证登陆注解
* </p>
*
* @author DengMin
* @since 2020/12/18
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface LoginRequired {
//String[] value();
}
\ No newline at end of file
package com.laowu.common.interceptor;
import java.lang.annotation.*;
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface TimeRequired {
}
package com.laowu.common.interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.HandshakeInterceptor;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* <p>
* WebSocket握手拦截器
* </p>
*
* @author DengMin
* @since 2022/7/14
*/
@Component
public class WebSocketInterceptor implements HandshakeInterceptor {
/**
* 自定义验证规则, 如果该用户不存在数据表中,拒绝此次连接
*/
@Override
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Map<String, Object> map) throws Exception {
if(request instanceof ServletServerHttpRequest) {
HttpServletRequest httpServletRequest = ((ServletServerHttpRequest) request).getServletRequest();
Long userId = Long.parseLong(httpServletRequest.getParameter("userId"));
// MemberDO memberDO = memberMapper.selectById(userId);
// return null != memberDO;
}
return false;
}
@Override
public void afterHandshake(ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Exception e) {
}
}
package com.laowu.controller;
import com.laowu.common.interceptor.LoginRequired;
import com.laowu.model.AdministerDO;
import com.laowu.service.AdministerService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 管理后台用户 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@RestController
@Api(tags = "管理后台用户")
@RequestMapping("/administer")
public class AdministerController {
@Autowired
private AdministerService administerService;
@PostMapping("login")
@ApiOperation("登录 account password")
public ResponseVO login(@RequestBody AdministerDO administerDO){
return ResponseData.generateCreatedResponse(0,administerService.login(administerDO));
}
@PostMapping("/getPermissions")
@ApiOperation("权限查询")
@LoginRequired
public ResponseVO getPermissions() {
return ResponseData.generateCreatedResponse(0, administerService.getPermissions());
}
}
package com.laowu.controller;
import com.laowu.model.BusinessDictDO;
import com.laowu.service.BusinessDictService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 经营范围 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@RestController
@Api(tags = "经营范围")
@RequestMapping("/businessDict")
public class BusinessDictController {
@Autowired
private BusinessDictService businessDictService;
@PostMapping("addBusiness")
@ApiOperation("新增经营范围 business")
public ResponseVO addBusiness(@RequestBody BusinessDictDO businessDictDO){
return ResponseData.generateCreatedResponse(0,businessDictService.addBusiness(businessDictDO));
}
@PostMapping("updateBusiness")
@ApiOperation("修改经营范围 id business")
public ResponseVO updateBusiness(@RequestBody BusinessDictDO businessDictDO){
return ResponseData.generateCreatedResponse(0,businessDictService.updateBusiness(businessDictDO));
}
@PostMapping("deleteBusiness")
@ApiOperation("删除经营范围 id")
public ResponseVO deleteBusiness(@RequestBody BusinessDictDO businessDictDO){
return ResponseData.generateCreatedResponse(0,businessDictService.deleteBusiness(businessDictDO));
}
@PostMapping("queryBusiness")
@ApiOperation("查询经营范围")
public ResponseVO queryBusiness(){
return ResponseData.generateCreatedResponse(0,businessDictService.queryBusiness());
}
}
package com.laowu.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 城市字典表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "城市字典表")
@RequestMapping("/city-dict-do")
public class CityDictController {
}
package com.laowu.controller;
import com.laowu.dto.company.AddCompanyDTO;
import com.laowu.dto.company.CompanyDTO;
import com.laowu.model.CompanyDictDO;
import com.laowu.service.CompanyDictService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 企业管理表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@RestController
@Api(tags = "企业管理表")
@RequestMapping("/companyDict")
public class CompanyDictController {
@Autowired
private CompanyDictService companyDictService;
@PostMapping("/company")
@ApiOperation("获取所有企业 pageSize pageNum companyName placeId businessId")
public ResponseVO company(@RequestBody CompanyDTO companyDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.company(companyDTO));
}
@PostMapping("deleteCompany")
@ApiOperation("删除某个企业 id")
public ResponseVO deleteCompany(@RequestBody CompanyDictDO companyDictDO){
return ResponseData.generateCreatedResponse(0,companyDictService.deleteCompany(companyDictDO));
}
@PostMapping("addCompany")
@ApiOperation("添加企业 companyName companyLogo placeId businessId companyCode account companyDesc companyPhotoDOS[ photo]")
public ResponseVO addCompany(@RequestBody AddCompanyDTO addCompanyDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.addCompany(addCompanyDTO));
}
@PostMapping("updateCompany")
@ApiOperation("更新企业 id companyName companyLogo placeId businessId companyCode account companyDesc companyPhotoDOS[ photo]")
public ResponseVO updateCompany(@RequestBody AddCompanyDTO addCompanyDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.updateCompany(addCompanyDTO));
}
@PostMapping("oneCompany")
@ApiOperation("查询一个企业 id")
public ResponseVO oneCompany(@RequestBody CompanyDictDO companyDictDO){
return ResponseData.generateCreatedResponse(0,companyDictService.oneCompany(companyDictDO));
}
}
package com.laowu.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 企业展示 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@RestController
@Api(tags = "企业展示")
@RequestMapping("/companyPhoto")
public class CompanyPhotoController {
}
package com.laowu.controller;
import com.laowu.dto.job.JobDTO;
import com.laowu.dto.job.JobManagementDTO;
import com.laowu.model.JobDictDO;
import com.laowu.service.JobDictService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 职位字典表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "职位字典表")
@RequestMapping("/jobDict")
public class JobDictController {
@Autowired
private JobDictService jobDictService;
@PostMapping("jobs")
@ApiOperation("所有工作 pageSize pageNum jobType 0:一村一技,1:工学一体,2:对外劳务 recruitId cityId positions[] ")
public ResponseVO jobs(@RequestBody JobDTO jobDTO){
return ResponseData.generateCreatedResponse(0,jobDictService.jobs(jobDTO));
}
@PostMapping("oneJob")
@ApiOperation("一个工作详情 id")
public ResponseVO oneJob(@RequestBody JobDictDO jobDictDO){
return ResponseData.generateCreatedResponse(0,jobDictService.oneJob(jobDictDO));
}
@PostMapping("relativeJobs")
@ApiOperation("相关职位 positionId ")
public ResponseVO relativeJobs(@RequestBody JobDictDO jobDictDO){
return ResponseData.generateCreatedResponse(0,jobDictService.relativeJobs(jobDictDO));
}
@PostMapping("jobManagement")
@ApiOperation("职位管理 pageSize pageNum jobType 0:一村一技,1:工学一体,2:对外劳务 recruitId cityId positions[] recruitStatus ")
public ResponseVO jobManagement(@RequestBody JobManagementDTO jobManagementDTO){
return ResponseData.generateCreatedResponse(0,jobDictService.jobManagement(jobManagementDTO));
}
@PostMapping("deleteJob")
@ApiOperation("删除职位 id")
public ResponseVO deleteJob(@RequestBody JobDictDO jobDictDO){
return ResponseData.generateCreatedResponse(0,jobDictService.deleteJob(jobDictDO));
}
@PostMapping("updateJob")
@ApiOperation("编辑工作 id recruitStatus jobName cityId positionId jobDesc startSalary endSalary")
public ResponseVO updateJob(@RequestBody JobDictDO jobDictDO){
return ResponseData.generateCreatedResponse(0,jobDictService.updateJob(jobDictDO));
}
@PostMapping("addJob")
@ApiOperation("添加工作 jobType recruitStatus jobName companyId cityId recruitId" +
" positionId startSalary endSalary jobDesc jobRequirement")
public ResponseVO addJob(@RequestBody JobDictDO jobDictDO){
return ResponseData.generateCreatedResponse(0,jobDictService.addJob(jobDictDO));
}
@PostMapping("batchAddJob")
@ApiOperation("批量添加工作")
public ResponseVO batchAddJob(Integer jobType, @RequestParam("file") MultipartFile multipartFile){
return ResponseData.generateCreatedResponse(0,jobDictService.batchAddJob(jobType,multipartFile));
}
}
package com.laowu.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 公司介绍 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "公司介绍")
@RequestMapping("/job-photo-do")
public class JobPhotoController {
}
package com.laowu.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 权限表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@RestController
@Api(tags = "权限表")
@RequestMapping("/permissions-dict-do")
public class PermissionsDictController {
}
package com.laowu.controller;
import com.laowu.dto.place.AddPlaceDTO;
import com.laowu.model.PlaceDictDO;
import com.laowu.service.PlaceDictService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 地区字典表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "地区字典表")
@RequestMapping("/placeDict")
public class PlaceDictController {
@Autowired
private PlaceDictService placeDictService;
@PostMapping("allPlaces")
@ApiOperation("查看所有工作地点")
public ResponseVO allPlaces(){
return ResponseData.generateCreatedResponse(0,placeDictService.allPlaces());
}
@PostMapping("deletePlace")
@ApiOperation("删除工作地点 id")
public ResponseVO deletePlace(@RequestBody PlaceDictDO placeDictDO){
return ResponseData.generateCreatedResponse(0,placeDictService.deletePlace(placeDictDO));
}
@PostMapping("addPlace")
@ApiOperation("添加工作地点 place secondTitle desc cityId placeImgsDOS[img]")
public ResponseVO addPlace(@RequestBody AddPlaceDTO addPlaceDTO){
return ResponseData.generateCreatedResponse(0,placeDictService.addPlace(addPlaceDTO));
}
@PostMapping("updatePlace")
@ApiOperation("修改工作地点 id place secondTitle desc cityId placeImgsDOS[img]")
public ResponseVO updatePlace(@RequestBody AddPlaceDTO addPlaceDTO){
return ResponseData.generateCreatedResponse(0,placeDictService.updatePlace(addPlaceDTO));
}
@PostMapping("onePlace")
@ApiOperation("一个地点详情 id")
public ResponseVO onePlace(@RequestBody PlaceDictDO placeDictDO){
return ResponseData.generateCreatedResponse(0,placeDictService.onePlace(placeDictDO));
}
}
package com.laowu.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 地点图片 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "地点图片")
@RequestMapping("/place-imgs-do")
public class PlaceImgsController {
}
package com.laowu.controller;
import com.laowu.service.PositionDictService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 职位类别 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "职位类别")
@RequestMapping("/positionDict")
public class PositionDictController {
@Autowired
private PositionDictService positionDictService;
@PostMapping("allPosition")
public ResponseVO allPosition(){
return ResponseData.generateCreatedResponse(0,positionDictService.allPosition());
}
}
package com.laowu.controller;
import com.laowu.service.ProvinceDictService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 城市字典表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "城市字典表")
@RequestMapping("/provinceDict")
public class ProvinceDictController {
@Autowired
private ProvinceDictService provinceDictService;
@PostMapping("allProvince")
public ResponseVO allProvince(){
return ResponseData.generateCreatedResponse(0,provinceDictService.allProvince());
}
}
package com.laowu.controller;
import com.laowu.model.QuestionContentDO;
import com.laowu.service.QuestionContentService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 答疑目录 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "答疑目录")
@RequestMapping("/questionContent")
public class QuestionContentController {
@Autowired
private QuestionContentService questionContentService;
@PostMapping("contents")
@ApiOperation("查询所有目录")
public ResponseVO contents(){
return ResponseData.generateCreatedResponse(0,questionContentService.contents());
}
@PostMapping("addContent")
@ApiOperation("添加目录 content")
public ResponseVO addContent(@RequestBody QuestionContentDO questionContentDO){
return ResponseData.generateCreatedResponse(0,questionContentService.addContent(questionContentDO));
}
@PostMapping("deleteContent")
@ApiOperation("删除目录 id")
public ResponseVO deleteContent(@RequestBody QuestionContentDO questionContentDO){
return ResponseData.generateCreatedResponse(0,questionContentService.deleteContent(questionContentDO));
}
@PostMapping("updateContent")
@ApiOperation("更新目录 id content")
public ResponseVO updateContent(@RequestBody QuestionContentDO questionContentDO){
return ResponseData.generateCreatedResponse(0,questionContentService.updateContent(questionContentDO));
}
}
package com.laowu.controller;
import com.laowu.model.QuestionsDO;
import com.laowu.service.QuestionsService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* Q && A 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "Q && A")
@RequestMapping("/questions")
public class QuestionsController {
@Autowired
private QuestionsService questionsService;
@PostMapping("contentQuestions")
@ApiOperation("某个目录下的问题&答案 contentId")
public ResponseVO contentQuestions(@RequestBody QuestionsDO questionsDO){
return ResponseData.generateCreatedResponse(0,questionsService.contentQuestions(questionsDO));
}
@PostMapping("deleteQuestion")
@ApiOperation("删除答疑 id")
public ResponseVO deleteQuestion(@RequestBody QuestionsDO questionsDO){
return ResponseData.generateCreatedResponse(0,questionsService.deleteQuestion(questionsDO));
}
@PostMapping("addQuestion")
@ApiOperation("新增答疑 contentId question answer")
public ResponseVO addQuestion(@RequestBody QuestionsDO questionsDO){
return ResponseData.generateCreatedResponse(0,questionsService.addQuestion(questionsDO));
}
@PostMapping("updateQuestion")
@ApiOperation("修改答疑 id contentId question answer")
public ResponseVO updateQuestion(@RequestBody QuestionsDO questionsDO){
return ResponseData.generateCreatedResponse(0,questionsService.updateQuestion(questionsDO));
}
}
package com.laowu.controller;
import com.laowu.service.RecruitDictService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 招聘类型 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "招聘类型")
@RequestMapping("/recruitDict")
public class RecruitDictController {
@Autowired
private RecruitDictService recruitDictService;
@PostMapping("types")
@ApiOperation("所有招聘类型")
public ResponseVO types(){
return ResponseData.generateCreatedResponse(0,recruitDictService.types());
}
}
package com.laowu.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@RestController
@Api(tags = "")
@RequestMapping("/role-administer-mapping-do")
public class RoleAdministerMappingController {
}
package com.laowu.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 角色表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@RestController
@Api(tags = "角色表")
@RequestMapping("/role-dict-do")
public class RoleDictController {
}
package com.laowu.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 系统用户角色表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@RestController
@Api(tags = "系统用户角色表")
@RequestMapping("/role-permission-mapping-do")
public class RolePermissionMappingController {
}
package com.laowu.controller;
import com.laowu.dto.user.UsersDTO;
import com.laowu.model.UserDO;
import com.laowu.service.UserService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 用户表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@RestController
@Api(tags = "用户表")
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@PostMapping("users")
@ApiOperation("查询院校/社会用户 pageSize pageNum education partyMember userName userType ")
public ResponseVO users(@RequestBody UsersDTO usersDTO) {
return ResponseData.generateCreatedResponse(0,userService.users(usersDTO));
}
@PostMapping("deleteUser")
@ApiOperation("删除用户 id")
public ResponseVO deleteUser(@RequestBody UserDO userDO){
return ResponseData.generateCreatedResponse(0,userService.deleteUser(userDO));
}
@PostMapping("addUser")
@ApiOperation("添加用户 userType:账户类型 userName telephone email idCard area address toCity school" +
"studyPeriod education rank educationType jobStatus job companyName jobType" +
"jobStartDate jobEndDate jobMonth salary resume partyMember")
public ResponseVO addUser(@RequestBody UserDO userDO){
return ResponseData.generateCreatedResponse(0,userService.addUser(userDO));
}
@PostMapping("updateUser")
@ApiOperation("修改用户 id userType:账户类型 userName telephone email idCard area address toCity school" +
"studyPeriod education rank educationType jobStatus job companyName jobType" +
"jobStartDate jobEndDate jobMonth salary resume partyMember")
public ResponseVO updateUser (@RequestBody UserDO userDO){
return ResponseData.generateCreatedResponse(0,userService.updateUser(userDO));
}
@PostMapping("importUsers")
@ApiOperation("导入用户 userType:账户类型 file")
public void importUsers(Long userType,@RequestParam("file") MultipartFile file){
userService.importUsers(userType,file);
}
@PostMapping("oneUser")
@ApiOperation("获取一个学员 id")
public ResponseVO oneUser(@RequestBody UserDO userDO){
return ResponseData.generateCreatedResponse(0,userService.oneUser(userDO));
}
}
package com.laowu.dto.company;
import com.laowu.model.CompanyDictDO;
import com.laowu.model.CompanyPhotoDO;
import lombok.Data;
import java.util.List;
@Data
public class AddCompanyDTO extends CompanyDictDO {
private List<CompanyPhotoDO> companyPhotoDOS;
}
package com.laowu.dto.company;
import lombok.Data;
@Data
public class CompanyDTO {
private Integer pageSize;
private Integer pageNum;
private String companyName;
private Long placeId;
private Long businessId;
private String companyLogo;
}
package com.laowu.dto.job;
import com.laowu.util.ExcelColumnUtil;
import lombok.Data;
@Data
public class BatchAddJobDTO {
@ExcelColumnUtil(col = 1,value = "企业名称")
private String enterpriseName;
@ExcelColumnUtil(col = 2,value = "招聘状态")
private String recruitStatus;
@ExcelColumnUtil(col = 3,value = "职位名称")
private String jobName;
@ExcelColumnUtil(col = 4,value = "招聘类型")
private Long recruitId;
@ExcelColumnUtil(col = 5,value = "职位描述")
private String jobDesc;
}
package com.laowu.dto.job;
import lombok.Data;
import java.util.List;
@Data
public class JobDTO {
private Integer pageSize;
private Integer pageNum;
private Long recruitId;
private Integer jobType;
private Long cityId;
private List<Long> positions;
}
package com.laowu.dto.job;
import lombok.Data;
import java.util.List;
@Data
public class JobManagementDTO {
private Integer pageSize;
private Integer pageNum;
private Long recruitId;
private Integer jobType;
private Long cityId;
private String jobName;
private String recruitStatus;
private List<Long> positions;
}
package com.laowu.dto.place;
import com.laowu.model.PlaceDictDO;
import com.laowu.model.PlaceImgsDO;
import lombok.Data;
import java.util.List;
@Data
public class AddPlaceDTO extends PlaceDictDO {
private List<PlaceImgsDO> placeImgsDOS;
}
package com.laowu.dto.user;
import com.laowu.util.ExcelColumnUtil;
import lombok.Data;
@Data
public class ImportUsersDTO {
@ExcelColumnUtil(col = 1,value = "姓名")
private String userName;
@ExcelColumnUtil(col = 2,value = "手机号码")
private String telephone;
@ExcelColumnUtil(col = 3,value = "邮箱")
private String email;
@ExcelColumnUtil(col = 4,value = "个人证件")
private String idType;
@ExcelColumnUtil(col = 5,value = "证件号码")
private String idCard;
@ExcelColumnUtil(col = 6,value = "所在地区")
private String area;
@ExcelColumnUtil(col = 7,value = "具体地址")
private String address;
@ExcelColumnUtil(col = 8,value = "意向城市")
private String toCity;
@ExcelColumnUtil(col = 9,value = "学校")
private String school;
@ExcelColumnUtil(col = 10,value = "起止时间")
private String studyPeriod;
@ExcelColumnUtil(col = 11,value = "学历")
private String education;
@ExcelColumnUtil(col = 12,value = "排名")
private String rank;
@ExcelColumnUtil(col = 13,value = "学历类型")
private String educationType;
@ExcelColumnUtil(col = 14,value = "就业状态")
private String jobStatus;
@ExcelColumnUtil(col = 15,value = "就业岗位")
private String job;
@ExcelColumnUtil(col = 16,value = "单位名称")
private String companyName;
@ExcelColumnUtil(col = 17,value = "就业类型")
private String jobType;
@ExcelColumnUtil(col = 18,value = "开始时间")
private String jobStartDate;
@ExcelColumnUtil(col = 19,value = "结束时间")
private String jobEndDate;
@ExcelColumnUtil(col = 20,value = "就业月数")
private String jobMonth;
@ExcelColumnUtil(col = 21,value = "月均收入")
private String salary;
@ExcelColumnUtil(col = 22,value = "简历")
private String resume;
@ExcelColumnUtil(col = 23,value = "党员")
private String partyMember;
@ExcelColumnUtil(col = 24,value = "脱贫劳动力")
private String poorless;
@ExcelColumnUtil(col = 25,value = "易迁户")
private String migration;
}
package com.laowu.dto.user;
import lombok.Data;
@Data
public class UsersDTO {
private Integer pageSize;
private Integer pageNum;
private String education;
private String partyMember;
private String userName;
private Long userType;
}
package com.laowu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.laowu.model.AdministerDO;
import com.laowu.vo.admin.PermissionsVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 管理后台用户 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Repository
public interface AdministerMapper extends BaseMapper<AdministerDO> {
List<PermissionsVO> getPermissions(Long id);
}
package com.laowu.mapper;
import com.laowu.model.BusinessDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 经营范围 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Repository
public interface BusinessDictMapper extends BaseMapper<BusinessDictDO> {
}
package com.laowu.mapper;
import com.laowu.model.CityDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 城市字典表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Repository
public interface CityDictMapper extends BaseMapper<CityDictDO> {
/**
* 通过cityId查询省-市
*/
String getCityName(Long cityId);
}
package com.laowu.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.laowu.model.CompanyDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.laowu.vo.company.CompanyVO;
import org.springframework.stereotype.Repository;
/**
* <p>
* 企业管理表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@Repository
public interface CompanyDictMapper extends BaseMapper<CompanyDictDO> {
/**
* 查询企业
*/
IPage<CompanyVO> company(IPage page, String companyName, Long placeId,Long businessId);
}
package com.laowu.mapper;
import com.laowu.model.CompanyPhotoDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 企业展示 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@Repository
public interface CompanyPhotoMapper extends BaseMapper<CompanyPhotoDO> {
}
package com.laowu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.laowu.model.JobDictDO;
import com.laowu.vo.job.JobManagementVO;
import com.laowu.vo.job.JobVO;
import com.laowu.vo.job.OneJobVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 职位字典表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Repository
public interface JobDictMapper extends BaseMapper<JobDictDO> {
/**
* 查询工作 分页
*/
IPage<JobVO> jobs(IPage page, Long recruitId, Long cityId, List<Long> positions,Integer jobType);
/**
* 查询 一个工作
*/
OneJobVO oneJob(Long id);
/**
* 相关推荐
*/
List<JobVO> relativeJobs(Long positionId);
/**
* 职位管理
*/
IPage<JobManagementVO> jobManagement(IPage page,Long recruitId, Long cityId, List<Long> positions,Integer jobType,String recruitStatus);
}
package com.laowu.mapper;
import com.laowu.model.JobPhotoDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 公司介绍 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Repository
public interface JobPhotoMapper extends BaseMapper<JobPhotoDO> {
}
package com.laowu.mapper;
import com.laowu.model.PermissionsDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 权限表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Repository
public interface PermissionsDictMapper extends BaseMapper<PermissionsDictDO> {
}
package com.laowu.mapper;
import com.laowu.model.PlaceDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 地区字典表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Repository
public interface PlaceDictMapper extends BaseMapper<PlaceDictDO> {
}
package com.laowu.mapper;
import com.laowu.model.PlaceImgsDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 地点图片 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Repository
public interface PlaceImgsMapper extends BaseMapper<PlaceImgsDO> {
}
package com.laowu.mapper;
import com.laowu.model.PositionDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 职位类别 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Repository
public interface PositionDictMapper extends BaseMapper<PositionDictDO> {
/**
* 通过子职位生成父子职位编码
*/
String jobCode(Long positionId);
}
package com.laowu.mapper;
import com.laowu.model.ProvinceDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 城市字典表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Repository
public interface ProvinceDictMapper extends BaseMapper<ProvinceDictDO> {
}
package com.laowu.mapper;
import com.laowu.model.QuestionContentDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 答疑目录 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Repository
public interface QuestionContentMapper extends BaseMapper<QuestionContentDO> {
}
package com.laowu.mapper;
import com.laowu.model.QuestionsDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Q && A Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Repository
public interface QuestionsMapper extends BaseMapper<QuestionsDO> {
}
package com.laowu.mapper;
import com.laowu.model.RecruitDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 招聘类型 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Repository
public interface RecruitDictMapper extends BaseMapper<RecruitDictDO> {
}
package com.laowu.mapper;
import com.laowu.model.RoleAdministerMappingDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Repository
public interface RoleAdministerMappingMapper extends BaseMapper<RoleAdministerMappingDO> {
}
package com.laowu.mapper;
import com.laowu.model.RoleDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 角色表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Repository
public interface RoleDictMapper extends BaseMapper<RoleDictDO> {
}
package com.laowu.mapper;
import com.laowu.model.RolePermissionMappingDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 系统用户角色表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Repository
public interface RolePermissionMappingMapper extends BaseMapper<RolePermissionMappingDO> {
}
package com.laowu.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.laowu.model.UserDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.laowu.vo.user.UsersVO;
import org.springframework.stereotype.Repository;
/**
* <p>
* 用户表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@Repository
public interface UserMapper extends BaseMapper<UserDO> {
IPage<UsersVO> users(IPage page, Long userType, String education, String partyMember, String userName);
UsersVO oneUser(Long id);
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 管理后台用户
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("administer")
public class AdministerDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String account;
private String password;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 经营范围
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("business_dict")
public class BusinessDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String business;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 城市字典表
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("city_dict")
public class CityDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 省id
*/
private Long provinceId;
/**
* 城市名
*/
private String city;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 企业管理表
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("company_dict")
public class CompanyDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 企业名称
*/
private String companyName;
/**
* 企业logo
*/
private String companyLogo;
/**
* 地区id
*/
private Long placeId;
/**
* 经营范围id
*/
private Long businessId;
/**
* 企业代码
*/
private String companyCode;
/**
* 主账号
*/
private String account;
/**
* 企业简介
*/
private String companyDesc;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 企业展示
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("company_photo")
public class CompanyPhotoDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 公司id
*/
private Long companyId;
/**
* 企业展示
*/
private String photo;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 职位字典表
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("job_dict")
public class JobDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 工作类型:一村一技,工学一体,对外劳务
*/
private Integer jobType;
/**
* 职位id
*/
private String jobId;
/**
* 招聘状态
*/
private String recruitStatus;
/**
* 职位名称
*/
private String jobName;
/**
* 企业id
*/
private String companyId;
/**
* 市
*/
private Long cityId;
/**
* 招聘类型
*/
private Long recruitId;
/**
* 职位类别id
*/
private Long positionId;
/**
* 起薪
*/
private Integer startSalary;
/**
* 止薪
*/
private Integer endSalary;
/**
* 职位描述
*/
private String jobDesc;
/**
* 职位要求
*/
private String jobRequirement;
/**
* 公司描述
*/
private String companyDesc;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 公司介绍
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("job_photo")
public class JobPhotoDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 职位id
*/
private Long jobId;
/**
* 公司照片
*/
private String companyPhotos;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 权限表
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("permissions_dict")
public class PermissionsDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 父级ID
*/
private Long parentId;
/**
* 名称
*/
private String name;
private String children;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 地区字典表
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("place_dict")
public class PlaceDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 地点名称
*/
private String place;
/**
* 副标题
*/
private String secondTitle;
/**
* 描述
*/
private String placeDesc;
/**
* 关联城市
*/
private Long cityId;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 地点图片
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("place_imgs")
public class PlaceImgsDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long placeId;
private String img;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 职位类别
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("position_dict")
public class PositionDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String positionType;
private Long parentId;
private String positionCode;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 城市字典表
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("province_dict")
public class ProvinceDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 城市
*/
private String province;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 答疑目录
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("question_content")
public class QuestionContentDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String content;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* Q && A
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("Questions")
public class QuestionsDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 目录id
*/
private Long contentId;
/**
* 问题
*/
private String question;
/**
* 答案
*/
private String answer;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 招聘类型
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("recruit_dict")
public class RecruitDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 招聘类型
*/
private String recruitType;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("role_administer_mapping")
public class RoleAdministerMappingDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long administerId;
private Long roleId;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 角色表
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("role_dict")
public class RoleDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 角色
*/
private String role;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 系统用户角色表
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("role_permission_mapping")
public class RolePermissionMappingDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 权限ID
*/
private Long roleId;
/**
* 角色ID
*/
private Long permissionId;
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 用户表
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("user")
public class UserDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 0:院校用户 1:社会用户
*/
private Integer userType;
/**
* 姓名
*/
private String userName;
/**
* 手机号
*/
private String telephone;
/**
* 邮箱
*/
private String email;
/**
* 证件类型
*/
private String idType;
/**
* 个人证件
*/
private String idCard;
/**
* 所在地区
*/
private String area;
/**
* 具体地址
*/
private String address;
/**
* 意向城市
*/
private String toCity;
/**
* 学校
*/
private String school;
/**
* 起止时间
*/
private String studyPeriod;
/**
* 学历
*/
private String education;
/**
* 成绩排名
*/
private String rank;
/**
* 学历类型
*/
private String educationType;
/**
* 就业状态
*/
private String jobStatus;
/**
* 就业岗位
*/
private String job;
/**
* 单位名称
*/
private String companyName;
/**
* 就业类型
*/
private String jobType;
/**
* 就业开始时间
*/
private String jobStartDate;
/**
* 就业结束时间
*/
private String jobEndDate;
/**
* 就业月数
*/
private String jobMonth;
/**
* 月均收入
*/
private String salary;
/**
* 简历
*/
private String resume;
/**
* 党员
*/
private String partyMember;
/**
* 脱贫劳动力
*/
private String poorless;
/**
* 易迁户
*/
private String migration;
}
package com.laowu.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.laowu.model.AdministerDO;
import com.laowu.vo.admin.AdministerPermissionVO;
import com.laowu.vo.admin.LoginVO;
/**
* <p>
* 管理后台用户 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
public interface AdministerService extends IService<AdministerDO> {
LoginVO login(AdministerDO administerDO);
AdministerPermissionVO getPermissions();
}
package com.laowu.service;
import com.laowu.model.BusinessDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 经营范围 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
public interface BusinessDictService extends IService<BusinessDictDO> {
String addBusiness(BusinessDictDO businessDictDO);
String updateBusiness(BusinessDictDO businessDictDO);
String deleteBusiness(BusinessDictDO businessDictDO);
List<BusinessDictDO> queryBusiness();
}
package com.laowu.service;
import com.laowu.model.CityDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 城市字典表 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
public interface CityDictService extends IService<CityDictDO> {
}
package com.laowu.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.laowu.dto.company.AddCompanyDTO;
import com.laowu.dto.company.CompanyDTO;
import com.laowu.model.CompanyDictDO;
import com.laowu.vo.company.CompanyVO;
/**
* <p>
* 企业管理表 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
public interface CompanyDictService extends IService<CompanyDictDO> {
IPage company(CompanyDTO companyDTO);
String deleteCompany(CompanyDictDO companyDictDO);
String addCompany(AddCompanyDTO addCompanyDTO);
String updateCompany(AddCompanyDTO addCompanyDTO);
CompanyVO oneCompany(CompanyDictDO companyDictDO);
}
package com.laowu.service;
import com.laowu.model.CompanyPhotoDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 企业展示 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
public interface CompanyPhotoService extends IService<CompanyPhotoDO> {
}
package com.laowu.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.laowu.dto.job.JobDTO;
import com.laowu.dto.job.JobManagementDTO;
import com.laowu.model.JobDictDO;
import com.laowu.vo.job.JobManagementVO;
import com.laowu.vo.job.JobVO;
import com.laowu.vo.job.OneJobVO;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* <p>
* 职位字典表 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
public interface JobDictService extends IService<JobDictDO> {
IPage<JobVO> jobs(JobDTO jobDTO);
OneJobVO oneJob(JobDictDO jobDictDO);
List<JobVO> relativeJobs(JobDictDO jobDictDO);
IPage<JobManagementVO> jobManagement(JobManagementDTO jobManagementDTO);
String deleteJob(JobDictDO jobDictDO);
String updateJob(JobDictDO jobDictDO);
String addJob(JobDictDO jobDictDO);
String batchAddJob(Integer jobType, MultipartFile multipartFile);
}
package com.laowu.service;
import com.laowu.model.JobPhotoDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 公司介绍 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
public interface JobPhotoService extends IService<JobPhotoDO> {
}
package com.laowu.service;
import com.laowu.model.PermissionsDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 权限表 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
public interface PermissionsDictService extends IService<PermissionsDictDO> {
}
package com.laowu.service;
import com.laowu.dto.place.AddPlaceDTO;
import com.laowu.model.PlaceDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.laowu.vo.place.AllPlacesVO;
import java.util.List;
/**
* <p>
* 地区字典表 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
public interface PlaceDictService extends IService<PlaceDictDO> {
List<AllPlacesVO> allPlaces();
String deletePlace(PlaceDictDO placeDictDO);
String addPlace(AddPlaceDTO addPlaceDTO);
String updatePlace(AddPlaceDTO addPlaceDTO);
AllPlacesVO onePlace(PlaceDictDO placeDictDO);
}
package com.laowu.service;
import com.laowu.model.PlaceImgsDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 地点图片 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
public interface PlaceImgsService extends IService<PlaceImgsDO> {
}
package com.laowu.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.laowu.model.PositionDictDO;
import com.laowu.vo.job.AllPositionVO;
import java.util.List;
/**
* <p>
* 职位类别 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
public interface PositionDictService extends IService<PositionDictDO> {
List<AllPositionVO> allPosition();
}
package com.laowu.service;
import com.laowu.model.ProvinceDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 城市字典表 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
public interface ProvinceDictService extends IService<ProvinceDictDO> {
List<ProvinceDictDO> allProvince();
}
package com.laowu.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.laowu.model.QuestionContentDO;
import java.util.List;
/**
* <p>
* 答疑目录 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
public interface QuestionContentService extends IService<QuestionContentDO> {
List<QuestionContentDO> contents();
String addContent(QuestionContentDO questionContentDO);
String deleteContent(QuestionContentDO questionContentDO);
String updateContent(QuestionContentDO questionContentDO);
}
package com.laowu.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.laowu.model.QuestionsDO;
import java.util.List;
/**
* <p>
* Q && A 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
public interface QuestionsService extends IService<QuestionsDO> {
List<QuestionsDO> contentQuestions(QuestionsDO questionsDO);
String deleteQuestion(QuestionsDO questionsDO);
String addQuestion(QuestionsDO questionsDO);
String updateQuestion(QuestionsDO questionsDO);
}
package com.laowu.service;
import com.laowu.model.RecruitDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 招聘类型 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
public interface RecruitDictService extends IService<RecruitDictDO> {
List<RecruitDictDO> types();
}
package com.laowu.service;
import com.laowu.model.RoleAdministerMappingDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
public interface RoleAdministerMappingService extends IService<RoleAdministerMappingDO> {
}
package com.laowu.service;
import com.laowu.model.RoleDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 角色表 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
public interface RoleDictService extends IService<RoleDictDO> {
}
package com.laowu.service;
import com.laowu.model.RolePermissionMappingDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 系统用户角色表 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
public interface RolePermissionMappingService extends IService<RolePermissionMappingDO> {
}
package com.laowu.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.laowu.dto.user.UsersDTO;
import com.laowu.model.UserDO;
import com.laowu.vo.user.UsersVO;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 用户表 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
public interface UserService extends IService<UserDO> {
IPage users(UsersDTO usersDTO);
String deleteUser(UserDO userDO);
String addUser(UserDO userDO);
String updateUser(UserDO userDO);
void importUsers(Long userType,MultipartFile file);
UsersVO oneUser(UserDO userDO);
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.common.exception.HttpException;
import com.laowu.mapper.AdministerMapper;
import com.laowu.mapper.RoleAdministerMappingMapper;
import com.laowu.model.AdministerDO;
import com.laowu.model.RoleAdministerMappingDO;
import com.laowu.service.AdministerService;
import com.laowu.util.ConstantUtils;
import com.laowu.util.JwtUtil;
import com.laowu.util.Localstorage;
import com.laowu.vo.admin.AdministerPermissionVO;
import com.laowu.vo.admin.LoginVO;
import com.laowu.vo.admin.PermissionsVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 管理后台用户 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Service
public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, AdministerDO> implements AdministerService {
@Autowired
private RoleAdministerMappingMapper roleAdministerMappingMapper;
public LoginVO login(AdministerDO administerDO) {
LoginVO login = new LoginVO();
AdministerDO administerDO1 = this.baseMapper.selectOne(new QueryWrapper<AdministerDO>()
.lambda()
.eq(AdministerDO::getAccount,administerDO.getAccount())
.eq(AdministerDO::getPassword,administerDO.getPassword()));
if (null == administerDO1){
throw new HttpException(50001);
}
String token = JwtUtil.generateToken(administerDO1.getId(), ConstantUtils.ADMINISTER_TERMINATE);
login.setToken(token);
return login;
}
public AdministerPermissionVO getPermissions() {
AdministerPermissionVO administerPermissionVO = new AdministerPermissionVO();
AdministerDO administerDO = (AdministerDO) Localstorage.getUser();
if (administerDO == null) {
throw new HttpException(10012);
}
BeanUtils.copyProperties(administerDO, administerPermissionVO);
List<PermissionsVO> list = this.baseMapper.getPermissions(administerDO.getId());
List<PermissionsVO> treeList = new ArrayList();
if (list != null) {
list.forEach(permission -> {
if (permission.getParentId() == null) {
treeList.add(permission);
}
list.forEach(p -> {
if (null != p.getParentId() && p.getParentId().equals(permission.getId())) {
if (permission.getChildren() == null) {
permission.setChildren(new ArrayList<>());
}
permission.getChildren().add(p);
}
});
});
}
administerPermissionVO.setPermissions(treeList);
//查询角色
RoleAdministerMappingDO roleAdministerMappingDO = roleAdministerMappingMapper.selectOne(new QueryWrapper<RoleAdministerMappingDO>()
.lambda()
.eq(RoleAdministerMappingDO::getAdministerId, administerDO.getId()));
if (null != roleAdministerMappingDO){
administerPermissionVO.setRole(roleAdministerMappingDO.getRoleId());
}
return administerPermissionVO;
}
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.common.exception.HttpException;
import com.laowu.mapper.BusinessDictMapper;
import com.laowu.model.BusinessDictDO;
import com.laowu.service.BusinessDictService;
import com.laowu.util.ConstantUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 经营范围 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Service
public class BusinessDictServiceImpl extends ServiceImpl<BusinessDictMapper, BusinessDictDO> implements BusinessDictService {
public String addBusiness(BusinessDictDO businessDictDO) {
int count = this.baseMapper.selectCount(new QueryWrapper<BusinessDictDO>()
.lambda()
.eq(BusinessDictDO::getBusiness, businessDictDO.getBusiness()));
if (count > 0) {
throw new HttpException(60001);
}
this.baseMapper.insert(businessDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String updateBusiness(BusinessDictDO businessDictDO) {
int count = this.baseMapper.selectCount(new QueryWrapper<BusinessDictDO>()
.lambda()
.eq(BusinessDictDO::getBusiness, businessDictDO.getBusiness())
.ne(BusinessDictDO::getBusiness, businessDictDO.getBusiness()));
if (count > 0) {
throw new HttpException(60001);
}
this.baseMapper.updateById(businessDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String deleteBusiness(BusinessDictDO businessDictDO) {
this.baseMapper.deleteById(businessDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public List<BusinessDictDO> queryBusiness() {
return this.baseMapper.selectList(null);
}
}
package com.laowu.service.impl;
import com.laowu.model.CityDictDO;
import com.laowu.mapper.CityDictMapper;
import com.laowu.service.CityDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 城市字典表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Service
public class CityDictServiceImpl extends ServiceImpl<CityDictMapper, CityDictDO> implements CityDictService {
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.common.exception.HttpException;
import com.laowu.dto.company.AddCompanyDTO;
import com.laowu.dto.company.CompanyDTO;
import com.laowu.mapper.CompanyDictMapper;
import com.laowu.mapper.CompanyPhotoMapper;
import com.laowu.model.CompanyDictDO;
import com.laowu.model.CompanyPhotoDO;
import com.laowu.service.CompanyDictService;
import com.laowu.util.ConstantUtils;
import com.laowu.vo.company.CompanyVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 企业管理表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@Service
public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, CompanyDictDO> implements CompanyDictService {
@Autowired
private CompanyPhotoMapper companyPhotoMapper;
public IPage company(CompanyDTO companyDTO) {
Page pager = new Page(companyDTO.getPageNum(), companyDTO.getPageSize());
IPage<CompanyVO> company = this.baseMapper.company(pager, companyDTO.getCompanyName(), companyDTO.getPlaceId(), companyDTO.getBusinessId());
List<CompanyVO> records = company.getRecords();
for (CompanyVO companyVO : records) {
List<CompanyPhotoDO> companyPhotoDOS = companyPhotoMapper.selectList(new QueryWrapper<CompanyPhotoDO>()
.lambda()
.eq(CompanyPhotoDO::getCompanyId, companyVO.getId()));
companyVO.setCompanyPhotoDOS(companyPhotoDOS);
}
return company;
}
public String deleteCompany(CompanyDictDO companyDictDO) {
this.baseMapper.deleteById(companyDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String addCompany(AddCompanyDTO addCompanyDTO) {
int count = this.baseMapper.selectCount(new QueryWrapper<CompanyDictDO>()
.lambda()
.eq(CompanyDictDO::getCompanyName, addCompanyDTO.getCompanyName()));
if (count > 0) {
throw new HttpException(30001);
}
CompanyDictDO companyDictDO = new CompanyDictDO();
BeanUtils.copyProperties(addCompanyDTO, companyDictDO);
this.baseMapper.insert(companyDictDO);
List<CompanyPhotoDO> companyPhotoDOS = addCompanyDTO.getCompanyPhotoDOS();
for (CompanyPhotoDO companyPhotoDO : companyPhotoDOS) {
companyPhotoDO.setCompanyId(companyDictDO.getId());
companyPhotoMapper.insert(companyPhotoDO);
}
return ConstantUtils.ADD_SUCCESS;
}
public String updateCompany(AddCompanyDTO addCompanyDTO) {
CompanyDictDO companyDictDO = new CompanyDictDO();
BeanUtils.copyProperties(addCompanyDTO, companyDictDO);
this.baseMapper.updateById(companyDictDO);
List<CompanyPhotoDO> companyPhotoDOS = addCompanyDTO.getCompanyPhotoDOS();
if (companyPhotoDOS.size() > 0) {
companyPhotoMapper.delete(new QueryWrapper<CompanyPhotoDO>()
.lambda()
.eq(CompanyPhotoDO::getCompanyId, addCompanyDTO.getId()));
for (CompanyPhotoDO companyPhotoDO : companyPhotoDOS) {
companyPhotoDO.setCompanyId(addCompanyDTO.getId());
companyPhotoMapper.insert(companyPhotoDO);
}
}
return ConstantUtils.SUCCESS_UPDATE;
}
public CompanyVO oneCompany(CompanyDictDO companyDictDO) {
CompanyVO companyVO = new CompanyVO();
CompanyDictDO companyDictDO1 = this.baseMapper.selectById(companyDictDO.getId());
BeanUtils.copyProperties(companyDictDO1, companyVO);
List<CompanyPhotoDO> companyPhotoDOS = companyPhotoMapper.selectList(new QueryWrapper<CompanyPhotoDO>()
.lambda()
.eq(CompanyPhotoDO::getCompanyId, companyDictDO1.getId()));
companyVO.setCompanyPhotoDOS(companyPhotoDOS);
return companyVO;
}
}
package com.laowu.service.impl;
import com.laowu.model.CompanyPhotoDO;
import com.laowu.mapper.CompanyPhotoMapper;
import com.laowu.service.CompanyPhotoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 企业展示 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@Service
public class CompanyPhotoServiceImpl extends ServiceImpl<CompanyPhotoMapper, CompanyPhotoDO> implements CompanyPhotoService {
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.common.exception.HttpException;
import com.laowu.dto.job.BatchAddJobDTO;
import com.laowu.dto.job.JobDTO;
import com.laowu.dto.job.JobManagementDTO;
import com.laowu.mapper.JobDictMapper;
import com.laowu.mapper.JobPhotoMapper;
import com.laowu.mapper.PositionDictMapper;
import com.laowu.model.JobDictDO;
import com.laowu.model.JobPhotoDO;
import com.laowu.service.JobDictService;
import com.laowu.util.ConstantUtils;
import com.laowu.util.ExcelUtil;
import com.laowu.vo.job.JobManagementVO;
import com.laowu.vo.job.JobVO;
import com.laowu.vo.job.OneJobVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* <p>
* 职位字典表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Service
public class JobDictServiceImpl extends ServiceImpl<JobDictMapper, JobDictDO> implements JobDictService {
@Autowired
private JobPhotoMapper jobPhotoMapper;
@Autowired
private PositionDictMapper positionDictMapper;
public IPage<JobVO> jobs(JobDTO jobDTO) {
Page pager = new Page(jobDTO.getPageNum(), jobDTO.getPageSize());
return this.baseMapper.jobs(pager, jobDTO.getRecruitId(), jobDTO.getCityId(), jobDTO.getPositions(), jobDTO.getJobType());
}
public OneJobVO oneJob(JobDictDO jobDictDO) {
OneJobVO oneJob = this.baseMapper.oneJob(jobDictDO.getId());
List<JobPhotoDO> jobPhotoDOS = jobPhotoMapper.selectList(new QueryWrapper<JobPhotoDO>()
.lambda()
.eq(JobPhotoDO::getJobId, jobDictDO.getId()));
oneJob.setJobPhotoDOS(jobPhotoDOS);
return oneJob;
}
public List<JobVO> relativeJobs(JobDictDO jobDictDO) {
return this.baseMapper.relativeJobs(jobDictDO.getPositionId());
}
public IPage<JobManagementVO> jobManagement(JobManagementDTO jobManagementDTO) {
Page pager = new Page(jobManagementDTO.getPageNum(), jobManagementDTO.getPageSize());
return this.baseMapper.jobManagement(pager, jobManagementDTO.getRecruitId(), jobManagementDTO.getCityId(), jobManagementDTO.getPositions(), jobManagementDTO.getJobType(), jobManagementDTO.getRecruitStatus());
}
public String deleteJob(JobDictDO jobDictDO) {
this.baseMapper.deleteById(jobDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String updateJob(JobDictDO jobDictDO) {
this.baseMapper.updateById(jobDictDO);
return ConstantUtils.SUCCESS_UPDATE;
}
public String addJob(JobDictDO jobDictDO) {
//生成职位id
String positionCode = positionDictMapper.jobCode(jobDictDO.getPositionId());
List<JobDictDO> jobDictDOS = this.baseMapper.selectList(new QueryWrapper<JobDictDO>()
.lambda()
.eq(JobDictDO::getPositionId, jobDictDO.getPositionId())
.orderByDesc(JobDictDO::getCreateDate));
if (jobDictDOS.size() > 0) {
String substring = jobDictDOS.get(0).getJobId().substring(2);
Integer cnt = Integer.parseInt(substring) + 1;
jobDictDO.setJobId(positionCode + cnt);
} else {
jobDictDO.setJobId(positionCode + "100001");
}
this.baseMapper.insert(jobDictDO);
return ConstantUtils.ADD_SUCCESS;
}
@Transactional(rollbackFor = Exception.class)
public String batchAddJob(Integer jobType, MultipartFile multipartFile){
try {
ExcelUtil.readExcelWithoutTitle(null, BatchAddJobDTO.class, multipartFile).forEach(s -> {
JobDictDO jobDictDO = new JobDictDO();
BeanUtils.copyProperties(s, jobDictDO);
jobDictDO.setJobType(jobType);
this.baseMapper.insert(jobDictDO);
});
} catch (Exception e) {
e.printStackTrace();
throw new HttpException(10001);
}
return ConstantUtils.IMPORT_SUCCESS;
}
public static void main(String[] args) {
String abc = "AB100001";
Integer a = Integer.parseInt(abc.substring(2)) + 1;
System.out.println(a);
}
}
package com.laowu.service.impl;
import com.laowu.model.JobPhotoDO;
import com.laowu.mapper.JobPhotoMapper;
import com.laowu.service.JobPhotoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 公司介绍 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Service
public class JobPhotoServiceImpl extends ServiceImpl<JobPhotoMapper, JobPhotoDO> implements JobPhotoService {
}
package com.laowu.service.impl;
import com.laowu.model.PermissionsDictDO;
import com.laowu.mapper.PermissionsDictMapper;
import com.laowu.service.PermissionsDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 权限表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Service
public class PermissionsDictServiceImpl extends ServiceImpl<PermissionsDictMapper, PermissionsDictDO> implements PermissionsDictService {
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.common.exception.HttpException;
import com.laowu.dto.place.AddPlaceDTO;
import com.laowu.mapper.CityDictMapper;
import com.laowu.mapper.PlaceDictMapper;
import com.laowu.mapper.PlaceImgsMapper;
import com.laowu.model.PlaceDictDO;
import com.laowu.model.PlaceImgsDO;
import com.laowu.service.PlaceDictService;
import com.laowu.util.ConstantUtils;
import com.laowu.vo.place.AllPlacesVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 地区字典表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Service
public class PlaceDictServiceImpl extends ServiceImpl<PlaceDictMapper, PlaceDictDO> implements PlaceDictService {
@Autowired
private PlaceImgsMapper placeImgsMapper;
@Autowired
private CityDictMapper cityDictMapper;
public List<AllPlacesVO> allPlaces() {
List<AllPlacesVO> allPlacesVOS = new ArrayList<AllPlacesVO>();
List<PlaceDictDO> placeDictDOS = this.baseMapper.selectList(null);
for (PlaceDictDO placeDictDO : placeDictDOS) {
AllPlacesVO allPlacesVO = new AllPlacesVO();
BeanUtils.copyProperties(placeDictDO, allPlacesVO);
List<PlaceImgsDO> placeImgsDOS = placeImgsMapper.selectList(new QueryWrapper<PlaceImgsDO>()
.lambda()
.eq(PlaceImgsDO::getPlaceId, placeDictDO.getId()));
allPlacesVO.setPlaceImgsDOS(placeImgsDOS);
allPlacesVO.setCityName(cityDictMapper.getCityName(placeDictDO.getCityId()));
allPlacesVOS.add(allPlacesVO);
}
return allPlacesVOS;
}
public String deletePlace(PlaceDictDO placeDictDO) {
this.baseMapper.deleteById(placeDictDO.getId());
placeImgsMapper.delete(new QueryWrapper<PlaceImgsDO>()
.lambda()
.eq(PlaceImgsDO::getPlaceId, placeDictDO.getId()));
return ConstantUtils.DELETE_SUCCESS;
}
public String addPlace(AddPlaceDTO addPlaceDTO) {
int count = this.baseMapper.selectCount(new QueryWrapper<PlaceDictDO>()
.lambda()
.eq(PlaceDictDO::getPlace, addPlaceDTO.getPlace()));
if (count > 0) {
throw new HttpException(10001);
}
PlaceDictDO placeDictDO = new PlaceDictDO();
BeanUtils.copyProperties(addPlaceDTO, placeDictDO);
this.baseMapper.insert(placeDictDO);
List<PlaceImgsDO> placeImgsDOS = addPlaceDTO.getPlaceImgsDOS();
for (PlaceImgsDO placeImgsDO : placeImgsDOS) {
placeImgsDO.setPlaceId(placeDictDO.getId());
placeImgsMapper.insert(placeImgsDO);
}
return ConstantUtils.ADD_SUCCESS;
}
public String updatePlace(AddPlaceDTO addPlaceDTO) {
int count = this.baseMapper.selectCount(new QueryWrapper<PlaceDictDO>()
.lambda()
.eq(PlaceDictDO::getPlace, addPlaceDTO.getPlace())
.ne(PlaceDictDO::getId, addPlaceDTO.getId()));
if (count > 0) {
throw new HttpException(10001);
}
PlaceDictDO placeDictDO = new PlaceDictDO();
BeanUtils.copyProperties(addPlaceDTO, placeDictDO);
this.baseMapper.updateById(placeDictDO);
List<PlaceImgsDO> placeImgsDOS = addPlaceDTO.getPlaceImgsDOS();
if (placeImgsDOS.size() > 0) {
placeImgsMapper.delete(new QueryWrapper<PlaceImgsDO>()
.lambda()
.eq(PlaceImgsDO::getPlaceId, addPlaceDTO.getId()));
for (PlaceImgsDO placeImgsDO : placeImgsDOS) {
placeImgsDO.setPlaceId(addPlaceDTO.getId());
placeImgsMapper.insert(placeImgsDO);
}
}
return ConstantUtils.SUCCESS_UPDATE;
}
public AllPlacesVO onePlace(PlaceDictDO placeDictDO) {
PlaceDictDO placeDictDO1 = this.baseMapper.selectById(placeDictDO.getId());
AllPlacesVO allPlacesVO = new AllPlacesVO();
BeanUtils.copyProperties(placeDictDO1, allPlacesVO);
allPlacesVO.setCityName(cityDictMapper.getCityName(placeDictDO1.getCityId()));
List<PlaceImgsDO> placeImgsDOS = placeImgsMapper.selectList(new QueryWrapper<PlaceImgsDO>()
.lambda()
.eq(PlaceImgsDO::getPlaceId, placeDictDO1.getId()));
allPlacesVO.setPlaceImgsDOS(placeImgsDOS);
return null;
}
}
package com.laowu.service.impl;
import com.laowu.model.PlaceImgsDO;
import com.laowu.mapper.PlaceImgsMapper;
import com.laowu.service.PlaceImgsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 地点图片 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Service
public class PlaceImgsServiceImpl extends ServiceImpl<PlaceImgsMapper, PlaceImgsDO> implements PlaceImgsService {
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.mapper.PositionDictMapper;
import com.laowu.model.PositionDictDO;
import com.laowu.service.PositionDictService;
import com.laowu.vo.job.AllPositionVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 职位类别 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Service
public class PositionDictServiceImpl extends ServiceImpl<PositionDictMapper, PositionDictDO> implements PositionDictService {
public List<AllPositionVO> allPosition() {
List<AllPositionVO> allPosition = new ArrayList<>();
List<PositionDictDO> positionDictDOS = this.baseMapper.selectList(new QueryWrapper<PositionDictDO>()
.lambda()
.isNull(PositionDictDO::getParentId));
for (PositionDictDO positionDictDO : positionDictDOS) {
AllPositionVO allPositionVO = new AllPositionVO();
BeanUtils.copyProperties(positionDictDO,allPositionVO);
List<PositionDictDO> positionDictDOS1 = this.baseMapper.selectList(new QueryWrapper<PositionDictDO>()
.lambda()
.eq(PositionDictDO::getParentId,positionDictDO.getId()));
allPositionVO.setPositionDictDOS(positionDictDOS1);
allPosition.add(allPositionVO);
}
return allPosition;
}
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.mapper.ProvinceDictMapper;
import com.laowu.model.ProvinceDictDO;
import com.laowu.service.ProvinceDictService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 城市字典表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Service
public class ProvinceDictServiceImpl extends ServiceImpl<ProvinceDictMapper, ProvinceDictDO> implements ProvinceDictService {
public List<ProvinceDictDO> allProvince() {
return this.baseMapper.selectList(null);
}
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.common.exception.HttpException;
import com.laowu.mapper.QuestionContentMapper;
import com.laowu.mapper.QuestionsMapper;
import com.laowu.model.QuestionContentDO;
import com.laowu.model.QuestionsDO;
import com.laowu.service.QuestionContentService;
import com.laowu.util.ConstantUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 答疑目录 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Service
public class QuestionContentServiceImpl extends ServiceImpl<QuestionContentMapper, QuestionContentDO> implements QuestionContentService {
@Autowired
private QuestionsMapper questionsMapper;
public List<QuestionContentDO> contents() {
return this.baseMapper.selectList(null);
}
@Transactional(rollbackFor = Exception.class)
public String addContent(QuestionContentDO questionContentDO) {
int count = this.baseMapper.selectCount(new QueryWrapper<QuestionContentDO>()
.lambda()
.eq(QuestionContentDO::getContent, questionContentDO.getContent()));
if (count > 0) {
throw new HttpException(20001);
}
this.baseMapper.insert(questionContentDO);
return ConstantUtils.ADD_SUCCESS;
}
@Transactional(rollbackFor = Exception.class)
public String deleteContent(QuestionContentDO questionContentDO) {
this.baseMapper.deleteById(questionContentDO.getId());
/**
* 删除该目录下的答疑
*/
questionsMapper.delete(new QueryWrapper<QuestionsDO>()
.lambda()
.eq(QuestionsDO::getContentId, questionContentDO.getId()));
return ConstantUtils.DELETE_SUCCESS;
}
public String updateContent(QuestionContentDO questionContentDO){
this.baseMapper.updateById(questionContentDO);
return ConstantUtils.SUCCESS_UPDATE;
}
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.mapper.QuestionsMapper;
import com.laowu.model.QuestionsDO;
import com.laowu.service.QuestionsService;
import com.laowu.util.ConstantUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* Q && A 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Service
public class QuestionsServiceImpl extends ServiceImpl<QuestionsMapper, QuestionsDO> implements QuestionsService {
public List<QuestionsDO> contentQuestions(QuestionsDO questionsDO) {
return this.baseMapper.selectList(new QueryWrapper<QuestionsDO>()
.lambda()
.eq(QuestionsDO::getContentId, questionsDO.getContentId()));
}
@Transactional(rollbackFor = Exception.class)
public String deleteQuestion(QuestionsDO questionsDO) {
this.baseMapper.deleteById(questionsDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
@Transactional
public String addQuestion(QuestionsDO questionsDO){
this.baseMapper.insert(questionsDO);
return ConstantUtils.ADD_SUCCESS;
}
public String updateQuestion(QuestionsDO questionsDO){
this.baseMapper.updateById(questionsDO);
return ConstantUtils.SUCCESS_UPDATE;
}
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.mapper.RecruitDictMapper;
import com.laowu.model.RecruitDictDO;
import com.laowu.service.RecruitDictService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 招聘类型 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@Service
public class RecruitDictServiceImpl extends ServiceImpl<RecruitDictMapper, RecruitDictDO> implements RecruitDictService {
public List<RecruitDictDO> types() {
return this.baseMapper.selectList(null);
}
}
package com.laowu.service.impl;
import com.laowu.model.RoleAdministerMappingDO;
import com.laowu.mapper.RoleAdministerMappingMapper;
import com.laowu.service.RoleAdministerMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Service
public class RoleAdministerMappingServiceImpl extends ServiceImpl<RoleAdministerMappingMapper, RoleAdministerMappingDO> implements RoleAdministerMappingService {
}
package com.laowu.service.impl;
import com.laowu.model.RoleDictDO;
import com.laowu.mapper.RoleDictMapper;
import com.laowu.service.RoleDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 角色表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Service
public class RoleDictServiceImpl extends ServiceImpl<RoleDictMapper, RoleDictDO> implements RoleDictService {
}
package com.laowu.service.impl;
import com.laowu.model.RolePermissionMappingDO;
import com.laowu.mapper.RolePermissionMappingMapper;
import com.laowu.service.RolePermissionMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 系统用户角色表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-20
*/
@Service
public class RolePermissionMappingServiceImpl extends ServiceImpl<RolePermissionMappingMapper, RolePermissionMappingDO> implements RolePermissionMappingService {
}
package com.laowu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.common.exception.HttpException;
import com.laowu.dto.user.ImportUsersDTO;
import com.laowu.dto.user.UsersDTO;
import com.laowu.mapper.UserMapper;
import com.laowu.model.UserDO;
import com.laowu.service.UserService;
import com.laowu.util.ConstantUtils;
import com.laowu.util.ExcelUtil;
import com.laowu.vo.user.UsersVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 用户表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-16
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements UserService {
public IPage users(UsersDTO usersDTO) {
Page pager = new Page(usersDTO.getPageNum(), usersDTO.getPageSize());
IPage<UsersVO> usersVOIPage = this.baseMapper.users(pager, usersDTO.getUserType(), usersDTO.getEducation(), usersDTO.getPartyMember(), usersDTO.getUserName());
return usersVOIPage;
}
public String deleteUser(UserDO userDO) {
this.baseMapper.deleteById(userDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String addUser(UserDO userDO) {
int count = this.baseMapper.selectCount(new QueryWrapper<UserDO>()
.lambda()
.eq(UserDO::getTelephone, userDO.getTelephone()));
if (count > 0) {
throw new HttpException(40001);
}
int count1 = this.baseMapper.selectCount(new QueryWrapper<UserDO>()
.lambda()
.eq(UserDO::getIdCard, userDO.getIdCard()));
if (count1 > 0) {
throw new HttpException(40001);
}
this.baseMapper.insert(userDO);
return ConstantUtils.ADD_SUCCESS;
}
public String updateUser(UserDO userDO) {
int count = this.baseMapper.selectCount(new QueryWrapper<UserDO>()
.lambda()
.eq(UserDO::getTelephone, userDO.getTelephone())
.ne(UserDO::getId, userDO.getId()));
if (count > 0) {
throw new HttpException(40001);
}
int count1 = this.baseMapper.selectCount(new QueryWrapper<UserDO>()
.lambda()
.eq(UserDO::getIdCard, userDO.getIdCard())
.ne(UserDO::getId, userDO.getId()));
if (count1 > 0) {
throw new HttpException(40001);
}
this.baseMapper.updateById(userDO);
return ConstantUtils.SUCCESS_UPDATE;
}
@Transactional(rollbackFor = Exception.class)
public void importUsers(Long userType, MultipartFile file) {
try {
ExcelUtil.readExcelWithoutTitle(null, ImportUsersDTO.class, file).forEach(s -> {
int cnt = this.baseMapper.selectCount(new QueryWrapper<UserDO>()
.lambda()
.eq(UserDO::getTelephone, s.getTelephone()));
if (cnt > 0) {
throw new HttpException(40001);
}
int cnt1 = this.baseMapper.selectCount(new QueryWrapper<UserDO>()
.lambda()
.eq(UserDO::getIdCard, s.getIdCard()));
if (cnt1 > 0) {
throw new HttpException(40001);
}
UserDO userDO = new UserDO();
BeanUtils.copyProperties(s, userDO);
this.baseMapper.insert(userDO);
});
} catch (Exception e) {
e.printStackTrace();
throw new HttpException(10001);
}
}
public UsersVO oneUser(UserDO userDO) {
return this.baseMapper.oneUser(userDO.getId());
}
}
package com.laowu.util;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public abstract class BaseModel {
/**
* 创建时间
*/
@JsonIgnore
@TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "create_date", fill = FieldFill.INSERT)
private LocalDateTime createDate;
/**
* 更新时间
*/
@JsonIgnore
@TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "update_date", fill = FieldFill.UPDATE)
private LocalDateTime updateDate;
/**
* 删除时间
*/
@JsonIgnore
@TableLogic
private LocalDateTime deleteDate;
}
package com.laowu.util;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Scanner;
/**
* Mybatis-Plus CodeGenerator
*
* @author DengMin
* @date 2020/07/02
**/
public class CodeGenerator {
public static String scanner(String tip) {
StringBuilder help = new StringBuilder();
help.append("1.生成全部表 2.输入需要生成表名");
System.out.println(help.toString());
Scanner scanner = new Scanner(System.in);
Integer ipt = Integer.valueOf(scanner.next());
if(ipt == 1) {
return "";
} else if(ipt == 2) {
StringBuilder help1 = new StringBuilder();
help1.append("请输入" + tip + ":");
System.out.println(help1.toString());
Scanner scanner1 = new Scanner(System.in);
if (scanner1.hasNext()) {
String name = scanner1.next();
if (StringUtils.isNotEmpty(name)) {
return name;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
return scanner(tip);
}
public static void main(String[] args) {
final ResourceBundle rb = ResourceBundle.getBundle("mybatis-plus");
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
gc.setOutputDir(System.getProperty("user.dir") + rb.getString("outputDir"));
gc.setOpen(false);
gc.setBaseResultMap(true);
gc.setBaseColumnList(true);
gc.setAuthor(rb.getString("author"));
gc.setMapperName("%sMapper");
gc.setEntityName("%sDO");
gc.setServiceName("%sService");
gc.setServiceImplName("%sServiceImpl");
gc.setControllerName("%sController");
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setDbType(DbType.MYSQL);
dsc.setUrl(rb.getString("url"));
dsc.setDriverName(rb.getString("driverName"));
dsc.setUsername(rb.getString("userName"));
dsc.setPassword(rb.getString("password"));
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
pc.setParent(rb.getString("setParent"));
pc.setController("controller");
pc.setService("service");
pc.setServiceImpl("service.impl");
pc.setEntity("model");
pc.setMapper("mapper");
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
List<FileOutConfig> focList = new ArrayList<>();
focList.add(new FileOutConfig("/templates/mapper.xml.ftl") {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输入文件名称
return System.getProperty("user.dir")+ rb.getString("mapperPath") + tableInfo.getMapperName() + StringPool.DOT_XML;
}
});
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
mpg.setTemplate(new TemplateConfig().setXml(null));
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
strategy.setSuperEntityClass(BaseModel.class);
strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true);
String [] tables = scanner("表名,多个英文逗号分割").split(",");
if(StringUtils.isNotBlank(tables[0])) {
strategy.setInclude(tables);
}
strategy.setControllerMappingHyphenStyle(true);
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute();
}
}
\ No newline at end of file
package com.laowu.util;
/**
* 枚举类
*/
public class ConstantUtils {
public static final String DELETE_SUCCESS = "删除成功";
public static final String UPLOAD_FAIL = "上传失败";
public static final String ADD_SUCCESS = "新增成功";
public static final String IMPORT_SUCCESS = "导入成功";
public static final String SUCCESS_SEND_OUT = "发送成功";
public static final String FAIL_SEND_OUT = "发送失败";
public static final String SUCCESS_UPDATE = "更新成功";
public static final String FAIL_UPDATE = "更新失败";
public static final String SUCCESS_VERIFY = "验证成功";
public static final String FAIL_VERIFY = "验证失败";
public static final String SUCCESS_LOGIN = "登录成功";
public static final String ADMINISTER_TERMINATE = "administer";
/**
* 短信模板---验证模板
*/
public static final String TEMPLATE_CODE = "SMS_190945394";
}
package com.laowu.util;
import java.lang.annotation.*;
/**
* <p>
* excel 字段
* </p>
*
* @author DengMin
* @date Created in 2020/08/28
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ExcelColumnUtil {
String value() default "";
int col() default 0;
}
package com.laowu.util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.CharUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellRangeAddress;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFCell;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Excel工具
*
* @author DengMin
* @date 2019/08/27 13:57
**/
@Slf4j
public class ExcelUtil {
private final static String EXCEL2003 = "xls";
private final static String EXCEL2007 = "xlsx";
/**
* 导入excel文件
*
* @param path
* @param cls
* @param file
* @param <T>
* @return
*/
public static <T> List<T> readExcel(String path, Class<T> cls, MultipartFile file) {
String fileName = file.getOriginalFilename();
if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
log.info("上传文件格式不正确");
// throw new HTTPException(10022);
}
List<T> dataList = new ArrayList<>();
Workbook workbook = null;
try {
InputStream is = file.getInputStream();
if (fileName.endsWith(EXCEL2007)) {
// FileInputStream is = new FileInputStream(new File(path));
workbook = new XSSFWorkbook(is);
}
if (fileName.endsWith(EXCEL2003)) {
// FileInputStream is = new FileInputStream(new File(path));
workbook = new HSSFWorkbook(is);
}
if (workbook != null) {
Map<String, List<Field>> classMap = new HashMap<>();
List<Field> fields = Stream.of(cls.getDeclaredFields()).collect(Collectors.toList());
fields.forEach(field -> {
ExcelColumnUtil annotation = field.getAnnotation(ExcelColumnUtil.class);
if (annotation != null) {
String value = annotation.value();
if (StringUtils.isBlank(value)) {
return;
}
if (!classMap.containsKey(value)) {
classMap.put(value, new ArrayList<>());
}
field.setAccessible(true);
classMap.get(value).add(field);
}
});
//索引-->columns
Map<Integer, List<Field>> reflectionMap = new HashMap<>();
//默认读取第一个sheet
Sheet sheet = workbook.getSheetAt(0);
boolean firstRow = true;
for (int i = 0; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i);
//提取标题
if (firstRow) {
for (int j = 0; j <= row.getLastCellNum(); j++) {
Cell cell = row.getCell(j);
String cellValue = getCellValue(cell);
if (classMap.containsKey(cellValue)) {
reflectionMap.put(j, classMap.get(cellValue));
}
}
firstRow = false;
} else {
//忽略空白行
if (row == null) {
continue;
}
try {
T t = cls.newInstance();
//判断是否为空白行
boolean allBlank = true;
for (int j = 0; j <= row.getLastCellNum(); j++) {
if (reflectionMap.containsKey(j)) {
Cell cell = row.getCell(j);
String cellValue = getCellValue(cell);
if (StringUtils.isNotBlank(cellValue)) {
allBlank = false;
}
List<Field> fieldList = reflectionMap.get(j);
fieldList.forEach(x -> {
try {
handleField(t, cellValue, x);
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("reflect field:%s value:%s exception!", x.getName(), cellValue), e);
}
});
}
}
if (!allBlank) {
dataList.add(t);
}
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse row:%s exception!", i), e);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse excel exception!"), e);
} finally {
if (workbook != null) {
try {
workbook.close();
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse excel exception!"), e);
}
}
}
return dataList;
}
/**
* 导入excel文件
*
* @param path
* @param cls
* @param file
* @param <T>
* @return
*/
public static <T> List<T> readExcelWithoutTitle(String path, Class<T> cls, MultipartFile file) {
String fileName = file.getOriginalFilename();
if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
log.info("上传文件格式不正确");
// throw new HTTPException(10022);
}
List<T> dataList = new ArrayList<>();
Workbook workbook = null;
try {
InputStream is = file.getInputStream();
if (fileName.endsWith(EXCEL2007)) {
// FileInputStream is = new FileInputStream(new File(path));
workbook = new XSSFWorkbook(is);
}
if (fileName.endsWith(EXCEL2003)) {
// FileInputStream is = new FileInputStream(new File(path));
workbook = new HSSFWorkbook(is);
}
if (workbook != null) {
Map<String, List<Field>> classMap = new HashMap<>();
List<Field> fields = Stream.of(cls.getDeclaredFields()).collect(Collectors.toList());
fields.forEach(field -> {
ExcelColumnUtil annotation = field.getAnnotation(ExcelColumnUtil.class);
if (annotation != null) {
String value = annotation.value();
if (StringUtils.isBlank(value)) {
return;
}
if (!classMap.containsKey(value)) {
classMap.put(value, new ArrayList<>());
}
field.setAccessible(true);
classMap.get(value).add(field);
}
});
//索引-->columns
Map<Integer, List<Field>> reflectionMap = new HashMap<>();
//默认读取第一个sheet
Sheet sheet = workbook.getSheetAt(0);
boolean firstRow = true;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i);
//提取标题
if (firstRow) {
for (int j = 0; j <= row.getLastCellNum(); j++) {
Cell cell = row.getCell(j);
String cellValue = getCellValue(cell);
if (classMap.containsKey(cellValue)) {
reflectionMap.put(j, classMap.get(cellValue));
}
}
firstRow = false;
} else {
//忽略空白行
if (row == null) {
continue;
}
try {
T t = cls.newInstance();
//判断是否为空白行
boolean allBlank = true;
for (int j = 0; j <= row.getLastCellNum(); j++) {
if (reflectionMap.containsKey(j)) {
Cell cell = row.getCell(j);
String cellValue = getCellValue(cell);
if (StringUtils.isNotBlank(cellValue)) {
allBlank = false;
}
List<Field> fieldList = reflectionMap.get(j);
fieldList.forEach(x -> {
try {
handleField(t, cellValue, x);
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("reflect field:%s value:%s exception!", x.getName(), cellValue), e);
}
});
}
}
if (!allBlank) {
dataList.add(t);
}
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse row:%s exception!", i), e);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse excel exception!"), e);
} finally {
if (workbook != null) {
try {
workbook.close();
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse excel exception!"), e);
}
}
}
return dataList;
}
/**
* 导出excel文件
* @param list
* @param cls
* @param <T>
*/
public static <T> void writeExcel(List<T> list, Class cls) {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse();
Field[] fields = cls.getDeclaredFields();
List<Field> fieldList = Arrays.stream(fields).filter(field -> {
ExcelColumnUtil annotation = field.getAnnotation(ExcelColumnUtil.class);
if(annotation != null) {
field.setAccessible(true);
return true;
}
return false;
}).sorted(Comparator.comparing(field -> {
int col = 0;
ExcelColumnUtil annotation = field.getAnnotation(ExcelColumnUtil.class);
if(annotation != null) {
col = annotation.col();
}
return col;
})).collect(Collectors.toList());
Workbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet();
AtomicInteger ai = new AtomicInteger();
{
Row row = sheet.createRow(ai.getAndIncrement());
AtomicInteger at = new AtomicInteger();
fieldList.forEach(field -> {
ExcelColumnUtil annotation = field.getAnnotation(ExcelColumnUtil.class);
String columnName = "";
if (annotation != null) {
columnName = annotation.value();
}
Cell cell = row.createCell(at.getAndIncrement());
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
cellStyle.setFont(font);
cell.setCellStyle(cellStyle);
cell.setCellValue(columnName);
});
if (list != null) {
list.forEach(data -> {
Row r = sheet.createRow(ai.getAndIncrement());
AtomicInteger a = new AtomicInteger();
fieldList.forEach(field -> {
try {
Class<?> type = field.getType();
Object value = field.get(data);
Cell cell = r.createCell(a.getAndIncrement());
if (value != null) {
cell.setCellValue(value.toString());
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
});
});
for (int i = 0; i < list.size(); i++) {
sheet.autoSizeColumn(i);
}
}
String fileName = String.valueOf(new Date().getTime());
buildExcelDocument(fileName + "." + EXCEL2007, wb, response);
}
}
private static void setStyle(CellStyle cellStyle) {
// 水平居中
cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
// 垂直居中
cellStyle.setVerticalAlignment(CellStyle.ALIGN_CENTER);
// 边框
cellStyle.setBorderTop(CellStyle.BORDER_THIN);
// 边框
cellStyle.setBorderLeft(CellStyle.BORDER_THIN);
// 边框
cellStyle.setBorderRight(CellStyle.BORDER_THIN);
// 边框
cellStyle.setBorderBottom(CellStyle.BORDER_THIN);
}
//也可用以下方法
public static void setBorderStyle(int border, CellRangeAddress region, SXSSFSheet sheet, SXSSFWorkbook wb) {
CellStyle cs = wb.createCellStyle(); // 样式对象
cs.setBorderBottom((short) border);
cs.setBorderTop((short) border);
cs.setBorderLeft((short) border);
cs.setBorderRight((short) border);
setRegionStyle(cs, region, sheet);
}
private static void setRegionStyle(CellStyle cs, CellRangeAddress region, SXSSFSheet sheet) {
for (int i = region.getFirstRow(); i <= region.getLastRow(); i++) {
SXSSFRow row = sheet.getRow(i);
if (row == null) {
row = sheet.createRow(i);
}
for (int j = region.getFirstColumn(); j <= region.getLastColumn(); j++) {
SXSSFCell cell = row.getCell(j);
if (cell == null) {
cell = row.createCell(j);
cell.setCellValue("");
}
cell.setCellStyle(cs);
}
}
}
private static <T> void handleField(T t, String value, Field field) throws Exception {
Class<?> type = field.getType();
if (type == null || type == void.class || StringUtils.isBlank(value)) {
return;
}
if (type == Object.class) {
field.set(t, value);
//数字类型
} else if (type.getSuperclass() == null || type.getSuperclass() == Number.class) {
if (type == int.class || type == Integer.class) {
field.set(t, NumberUtils.toInt(value));
} else if (type == long.class || type == Long.class) {
field.set(t, NumberUtils.toLong(value));
} else if (type == byte.class || type == Byte.class) {
field.set(t, NumberUtils.toByte(value));
} else if (type == short.class || type == Short.class) {
field.set(t, NumberUtils.toShort(value));
} else if (type == double.class || type == Double.class) {
field.set(t, NumberUtils.toDouble(value));
} else if (type == float.class || type == Float.class) {
field.set(t, NumberUtils.toFloat(value));
} else if (type == char.class || type == Character.class) {
field.set(t, CharUtils.toChar(value));
} else if (type == boolean.class) {
field.set(t, BooleanUtils.toBoolean(value));
} else if (type == BigDecimal.class) {
field.set(t, new BigDecimal(value));
}
} else if (type == Boolean.class) {
field.set(t, BooleanUtils.toBoolean(value));
} else if (type == Date.class) {
//
field.set(t, value);
} else if (type == String.class) {
field.set(t, value);
} else {
Constructor<?> constructor = type.getConstructor(String.class);
field.set(t, constructor.newInstance(value));
}
}
private static String getCellValue(Cell cell) {
if (cell == null) {
return "";
}
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
if (DateUtil.isCellDateFormatted(cell)) {
return HSSFDateUtil.getJavaDate(cell.getNumericCellValue()).toString();
} else {
return new BigDecimal(cell.getNumericCellValue()).toString();
}
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
return StringUtils.trimToEmpty(cell.getStringCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
return StringUtils.trimToEmpty(cell.getCellFormula());
} else if (cell.getCellType() == Cell.CELL_TYPE_BLANK) {
return "";
} else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
return String.valueOf(cell.getBooleanCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_ERROR) {
return "ERROR";
} else {
return cell.toString().trim();
}
}
private static void buildExcelDocument(String fileName, Workbook wb, HttpServletResponse response) {
try {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "utf-8"));
response.flushBuffer();
wb.write(response.getOutputStream());
} catch (IOException e) {
log.error(String.format("downLoad excel exception"), e);
}
}
private static void buildExcelFile(String path, Workbook wb) {
File file = new File(path);
if (file.exists()) {
file.delete();
}
try {
wb.write(new FileOutputStream(file));
} catch (Exception e) {
log.error(String.format("downLoad excel exception"), e);
}
}
}
package com.laowu.util;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.Claim;
import java.util.Date;
import java.util.Map;
/**
* <p>
* Token工具
* </p>
*
* @author DengMin
* @since 2021/4/14
*/
public class JwtUtil {
private static Long EXPIRE_TIME = 24 * 60 * 60 * 1000L;
private static String SECRET = "PBKDF2SHA256:64000:18:24:N:GFHZ6Y0PTEUDYCJI3K6SOOXWYEKPOZED:WBWFJMX5DF252E0HR3BF3P/D";
/**
* 生成Token
* @param id
* @return
*/
public static String generateToken(Long id, String type) {
Date expireDate = new Date(System.currentTimeMillis() + EXPIRE_TIME);
return JWT.create()
.withClaim("id", id)
.withClaim("type", type)
.withAudience()
.withExpiresAt(expireDate)
.withIssuedAt(new Date())
.sign(Algorithm.HMAC256(SECRET));
}
/**
* 检验token是否正确
* @param token
* @return
*/
public static boolean verifyToken(String token) {
try {
Algorithm algorithm = Algorithm.HMAC256(SECRET);
JWTVerifier verifier = JWT.require(algorithm).build();
verifier.verify(token);
return true;
} catch (Exception e) {
return false;
}
}
/**
* 获取用户自定义Claim集合
* @param token
* @return
*/
public static Map<String, Claim> getClaims(String token) {
Algorithm algorithm = Algorithm.HMAC256(SECRET);
JWTVerifier verifier = JWT.require(algorithm).build();
Map<String, Claim> claims = verifier.verify(token).getClaims();
return claims;
}
/**
* 获取过期时间
* @param token
* @return
*/
public static Date getExpiresAt(String token) {
Algorithm algorithm = Algorithm.HMAC256(SECRET);
return JWT
.require(algorithm)
.build()
.verify(token)
.getExpiresAt();
}
/**
* 验证token是否失效
* @param token
* @return true: 过期, false: 没过期
*/
public static boolean isExpired(String token) {
try {
final Date expiration = getExpiresAt(token);
return expiration.before(new Date());
} catch (Exception e) {
return true;
}
}
}
package com.laowu.util;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Localstorage {
private static final ThreadLocal<Object> local = ThreadLocal.withInitial(() -> null);
public static void setUser(Object admin) {
Localstorage.local.set(admin);
}
public static Object getUser() {
return Localstorage.local.get();
}
public static void remove() {
Localstorage.local.remove();
}
}
package com.laowu.util;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Random;
public class MathUtil {
/**
* 4位自增字符
*/
public static String getRandomCode(int randomLength) {
StringBuilder str = new StringBuilder();
Random random = new Random();
for (int i = 0; i < randomLength; i++) {
str.append(random.nextInt(10));
}
return str.toString();
}
public static String getRandomString(int length) {
StringBuilder val = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; ++i) {
String charOrNum = random.nextInt(3) % 3 == 0 ? "num" : "char";
if ("char".equalsIgnoreCase(charOrNum)) {
int temp = random.nextInt(2) % 2 == 0 ? 65 : 97;
val.append((char) (random.nextInt(26) + temp));
} else {
val.append(random.nextInt(10));
}
}
return val.toString();
}
//习题/视频 ==> 秒钟向上取整
public static String ceilSecond(int length) {
return String.valueOf((int) Math.ceil((double) length / 60));
}
//习题/视频 ==> 秒钟向下取整
public static String floorSecond(int length) {
return String.valueOf((int) Math.ceil((double) length / 60));
}
//视频秒数处理
public static String vodLength(int i) {
if (i > 60) {
if (i % 60 >= 10) {
return i / 60 + ":" + i % 60;
} else {
return i / 60 + ":0" + i % 60;
}
} else {
if (i % 60 >= 10) {
return "00:" + i;
} else {
return "00:0" + i;
}
}
}
//文件大小处理
public static String fileUnit(int i) {
if (i / 1024 > 1024) {
return String.format("%.2f", (double) i / 1024 / 1024) + "M";
} else {
return String.format("%.2f", (double) i / 1024) + "K";
}
}
//单个题目秒数处理
public static String exerciseLength(int i) {
if (i >= 60 * 60) {
return i / 60 / 60 + "时" + (i - 60 * 60) / 60 + "分" + i % 60 + "秒";
} else if (i >= 60) {
return i / 60 + "分" + i % 60 + "秒";
} else {
return i % 60 + "秒";
}
}
// 除法取整
public static String getAvgIndex(BigDecimal counts, BigDecimal total) {
if (BigDecimal.ZERO.equals(total)) {
return "0";
} else {
return counts.divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString();
}
}
//百分比 取整 返回字符串
public static String getPercentAvgIndex(BigDecimal counts, BigDecimal total) {
if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) {
return "0%";
} else {
return counts.multiply(new BigDecimal(100)).divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString() + "%";
}
}
//百分比 不带%输出
public static String getPercentAvgIndexWithPercent(BigDecimal counts, BigDecimal total) {
if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) {
return "0";
} else {
return counts.multiply(new BigDecimal(100)).divide(total, 2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
}
}
//百分比 不带%输出
public static String getPercentAvgIndexCeil(BigDecimal counts, BigDecimal total) {
if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) {
return "0";
} else {
return counts.multiply(new BigDecimal(100)).divide(total, 2, BigDecimal.ROUND_CEILING).stripTrailingZeros().toPlainString();
}
}
//习题序号生成规则 sid 从数据取出某科目某知识点的最大的序号
public static String getExeCode(String sid) {
Integer integer = Integer.valueOf(sid.substring(9));
return sid.substring(0, 9) + (++integer);
}
// 整型a 整型b a/b 向上取整
public static Integer intDivCeil(long a, int b) {
return (int) Math.ceil((double) a / b);
}
// 整型a 整型b a/b 向下取整
public static Integer intDivFloorPercent(long a, int b) {
return (int) Math.floor((double) a * 100 / b);
}
public static Integer getRandomNum(Integer i) {
Random random = new Random();
return random.nextInt(i);
}
// public static void main(String[] args) {
// for (int i= 1;i<100;i++){
// System.out.println(getRandomNum(2));
// }
// }
public static String secToTime(int time) {
String timeStr ;
int hour;
int minute;
int second;
if (time <= 0) {
return "00:00:00";
} else {
minute = time / 60;
if (minute < 60) {
second = time % 60;
timeStr = "00:"+unitFormat(minute) + ":" + unitFormat(second);
} else {
hour = minute / 60;
minute = minute % 60;
second = time - hour * 3600 - minute * 60;
timeStr = unitFormat(hour) + ":" + unitFormat(minute) + ":" + unitFormat(second);
}
}
return timeStr;
}
public static String unitFormat(int i) {
String retStr = null;
if (i >= 0 && i < 10) {
retStr = "0" + i;
} else {
retStr = "" + i;
}
return retStr;
}
}
package com.laowu.util;
import com.laowu.common.RemoteProperties;
import lombok.Data;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
/**
* 返回数据
*
* @author DengMin
* @date 2019/08/27 13:57
**/
@Data
@EnableConfigurationProperties(RemoteProperties.class)
public class ResponseData {
public static <T> ResponseVO<T> generateCreatedResponse(int code) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(RemoteProperties.getMessage(code))
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, String message) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(message)
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, T data) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(RemoteProperties.getMessage(code))
.data(data)
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, String message, T data) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(message)
.data(data)
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, String message, String path) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(message)
.path(path)
.build();
}
}
\ No newline at end of file
package com.laowu.util;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ResponseVO<T> {
private Integer code;
private String message;
private T data;
private String path;
}
\ No newline at end of file
package com.laowu.vo.admin;
import lombok.Data;
import java.util.List;
@Data
public class AdministerPermissionVO {
private Long id;
private String userName;
private Long role;
private String img;
private Boolean isRole;
private List<PermissionsVO> permissions;
}
package com.laowu.vo.admin;
import lombok.Data;
@Data
public class LoginVO {
// private Long id;
//
// private String account;
//
private String token;
}
package com.laowu.vo.admin;
import lombok.Data;
import java.util.List;
@Data
public class PermissionsVO {
private Long id;
private Long parentId;
private String name;
private List<PermissionsVO> children;
}
package com.laowu.vo.company;
import com.laowu.model.CompanyPhotoDO;
import lombok.Data;
import java.util.List;
@Data
public class CompanyVO {
private Long id;
private Long placeId;
private Long businessId;
private String companyName;
private String companyLogo;
private String place;
private String business;
private String companyCode;
private String account;
private String companyDesc;
private List<CompanyPhotoDO> companyPhotoDOS;
}
package com.laowu.vo.job;
import com.laowu.model.PositionDictDO;
import lombok.Data;
import java.util.List;
@Data
public class AllPositionVO extends PositionDictDO {
private List<PositionDictDO> positionDictDOS;
}
package com.laowu.vo.job;
import lombok.Data;
@Data
public class JobManagementVO {
private Long id;
private String companyLogo;
private String companyName;
private String recruitStatus;
private String jobName;
private String province;
private String city;
private String recruitType;
private String parentType;
private String sonType;
private String jobDesc;
private String startSalary;
private String endSalary;
private String jobId;
}
package com.laowu.vo.job;
import lombok.Data;
@Data
public class JobVO {
private Long id;
private String jobName;
private String companyName;
private String startSalary;
private String endSalary;
private String province;
private String city;
private String recruitType;
private String parentType;
private String sonType;
private String jobId;
}
package com.laowu.vo.job;
import com.laowu.model.JobPhotoDO;
import lombok.Data;
import java.util.List;
@Data
public class OneJobVO {
private Long id;
private Long positionId;
private String jobName;
private String companyName;
private String startSalary;
private String endSalary;
private String province;
private String city;
private String recruitType;
private String parentType;
private String sonType;
private String jobId;
private String jobDesc;
private String jobRequirement;
private String companyDesc;
private List<JobPhotoDO> jobPhotoDOS;
}
package com.laowu.vo.place;
import com.laowu.model.PlaceImgsDO;
import lombok.Data;
import java.util.List;
@Data
public class AllPlacesVO {
private Long id;
private String place;
private String secondTitle;
private String desc;
private Long cityId;
private String cityName;
private List<PlaceImgsDO> placeImgsDOS;
}
package com.laowu.vo.user;
import com.laowu.model.UserDO;
import lombok.Data;
@Data
public class UsersVO extends UserDO {
}
# 本地环境配置
spring.server.port=34567
# 数据源配置
spring.datasource.url=jdbc:mysql://116.62.57.92:3306/laowu?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#spring.datasource.url=jdbc:mysql://rm-uf6rab73w0qg843opxo.mysql.rds.aliyuncs.com:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.username=ykadmin_new
#spring.datasource.password=youkedb608@good
spring.datasource.username=devloper
spring.datasource.password=dev@1553$
spring.datasource.druid.initialSize=5
spring.datasource.druid.minIdle=5
spring.datasource.druid.maxActive=200
spring.datasource.druid.maxWait=60000
spring.datasource.druid.timeBetweenEvictionRunsMillis=60000
spring.datasource.druid.minEvictableIdleTimeMillis=300000
spring.datasource.druid.validationQuery=SELECT 1 FROM DUAL
spring.datasource.druid.testWhileIdle=true
spring.datasource.druid.testOnBorrow=false
spring.datasource.druid.testOnReturn=false
spring.datasource.druid.poolPreparedStatements=true
spring.datasource.druid.maxPoolPreparedStatementPerConnectionSize=20
spring.datasource.druid.useGlobalDataSourceStat=true
# 控制台日志打印
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
spring.redis.host=47.97.19.66
spring.redis.password=Ykhl@208
spring.redis.port=6389
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
# 生产环境配置
spring.server.port=34567
# 数据源配置
spring.datasource.url=jdbc:mysql://rm-uf69w46mo6agw0ahao.mysql.rds.aliyuncs.com:3306/laowu?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=ykadmin_new
spring.datasource.password=youkedb608@good
spring.datasource.druid.initialSize=5
spring.datasource.druid.minIdle=5
spring.datasource.druid.maxActive=20
spring.datasource.druid.maxWait=60000
spring.datasource.druid.timeBetweenEvictionRunsMillis=60000
spring.datasource.druid.minEvictableIdleTimeMillis=300000
spring.datasource.druid.validationQuery=SELECT 1 FROM DUAL
spring.datasource.druid.testWhileIdle=true
spring.datasource.druid.testOnBorrow=false
spring.datasource.druid.testOnReturn=false
spring.datasource.druid.poolPreparedStatements=true
spring.datasource.druid.maxPoolPreparedStatementPerConnectionSize=20
spring.datasource.druid.useGlobalDataSourceStat=true
# 控制台日志打印
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
spring.servlet.multipart.max-file-size=2048KB
spring.servlet.multipart.max-request-size=4098KB
spring.redis.host=sh-crs-hq5xbrsq.sql.tencentcdb.com
spring.redis.password=Ykhl@302
spring.redis.port=20260
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
# 环境配置
spring.profiles.active=dev
#和CPU数
spring.server.acceptorThreadCount=600
spring.server.minSpareThreads=100
spring.server.maxSpareThreads=500
spring.server.maxThreads=500
spring.server.maxConnections=1000
#10秒超时
spring.server.connectionTimeout=20000
spring.server.protocol=org.apache.coyote.http11.Http11AprProtocol
spring.server.redirectPort=8443
spring.server.compression=on
#文件请求大小
spring.server.MaxFileSize=300MB
spring.server.MaxRequestSize=500MB
# 文件编码 UTF8
spring.mandatory-file-encoding=UTF-8
spring.jackson.time-zone=GMT+8
# 404 交给异常处理器处理
spring.mvc.throw-exception-if-no-handler-found=true
# 关闭静态资源的映射
spring.resources.add-mappings=false
# 关闭banner打印
mybatis-plus.global-config.banner=false
# mybatis-plus相关配置
mybatis-plus.mapper-locations=classpath:mapper/*.xml
# 是否开启自动驼峰命名规则映射
mybatis-plus.configuration.map-underscore-to-camel-case=true
# 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段
mybatis-plus.configuration.call-setters-on-nulls=true
# 逻辑删除
mybatis-plus.global-config.db-config.logic-delete-value=NOW()
mybatis-plus.global-config.db-config.logic-not-delete-value=NULL
#日志配置
logging.config=classpath:logback-spring.xml
#ehcache缓存配置
spring.cache.type=ehcache
spring.cache.ehcache.config=classpath:ehcache.xml
# 阿里云短信
sms.product=Dysmsapi
sms.domain=dysmsapi.aliyuncs.com
sms.accessKeyId=LTAIOrpFKrDqsQ2c
sms.accessKeySecret=1Qp8huLETbWiBBJvHXJ7MOIhtKuA1G
#wechat.app-id=wx7785293ff5e31f14
#wechat.app-secret=25d57cad61fc1b45b3afa46d4c35e8f6
#wechat.agentId=1000008
vod.appId=1302252447
vod.secretId=AKIDOcePHvZ2C5VeYHQGSO5aqtlNxJQLqfz2
vod.secretKey=vjHYRmrfDbw0rWxA7oFcj7F8lDPKCm8E
vod.api=vod.tencentcloudapi.com
vod.region=ap-shanghai
vod.classId=848920
# quartz
# 数据持久化方式
spring.quartz.job-store-type=jdbc
# 初始化后是否自动启动计划程序
spring.quartz.auto-startup=true
# 初始化完成后启动计划程序的延迟时间
spring.quartz.startup-delay=10s
# 配置的作业是否应覆盖现有的作业定义
spring.quartz.overwrite-existing-jobs=false
# 自动建表,如果已经存在表请勿使用,会覆盖数据表
#spring.quartz.jdbc.initialize-schema=always
#spring.datasource.initialization-mode=embedded
#spring.redis.host=r-uf6m4cpkjrgpzywjm3pd.redis.rds.aliyuncs.com
#spring.redis.port=6379
#spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208
wechat=
#pro
appId=wx5e1ecb9c9bd33451
appSecret=4f5e1abb6fb4f68f5273820b6295ec6b
laowu.code-message[0]=成功
laowu.code-message[10001]=该地点已存在
laowu.code-message[20001]=该目录已存在
laowu.code-message[30001]=该公司已存在
laowu.code-message[40001]=该用户已存在
laowu.code-message[50001]=账号或密码错误
laowu.code-message[60001]=该经营范围已存在
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<property name="LOG_PATH" value="logs/" />
<property name="APP_NAME" value="springboot-logback" />
<contextName>${APP_NAME}</contextName>
<jmxConfigurator />
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>info</level>
</filter>
<encoder>
<pattern>%d [%t] %5p %c:%L - %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${LOG_PATH}${APP_NAME}-info.log</File>
<encoder>
<pattern>%d [%t] %5p %c:%L - %m%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<FileNamePattern>${LOG_PATH}${APP_NAME}/info/%d{yyyy-MM-dd}-%i.log.gz
</FileNamePattern>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
</appender>
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${LOG_PATH}${APP_NAME}-error.log</File>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>error</level>
</filter>
<encoder>
<pattern>%d [%t] %5p %c:%L - %m%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>256MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<FileNamePattern>${LOG_PATH}${APP_NAME}/error/%d{yyyy-MM-dd}-%i.log.gz
</FileNamePattern>
<MaxHistory>180</MaxHistory>
</rollingPolicy>
</appender>
<springProfile name="dev">
<logger name="com.laowu" level="debug" />
<logger name="com.laowu" level="error" />
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
</springProfile>
<springProfile name="prod">
<logger name="com.laowu" level="error" />
<root level="INFO">
<appender-ref ref="ERROR_FILE" />
</root>
</springProfile>
</configuration>
\ No newline at end of file
<?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.laowu.mapper.AdministerMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.AdministerDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="account" property="account" />
<result column="password" property="password" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, account, password
</sql>
<select id="getPermissions" resultType="com.laowu.vo.admin.PermissionsVO">
SELECT DISTINCT
t4.*
FROM
role_administer_mapping t
LEFT JOIN role_dict t2 ON t.role_id = t2.id
LEFT JOIN role_permission_mapping t3 ON t2.id = t3.role_id
LEFT JOIN permissions_dict t4 ON t3.permission_id = t4.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
<if test="id !=null and id !=''">
and t.administer_id = #{id}
</if>
</select>
</mapper>
<?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.laowu.mapper.BusinessDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.BusinessDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="business" property="business" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, business
</sql>
</mapper>
<?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.laowu.mapper.CityDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.CityDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="province_id" property="provinceId" />
<result column="city" property="city" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, province_id, city
</sql>
<select id="getCityName" parameterType="long" resultType="string">
SELECT
concat( t2.province, t.city ) AS cityName
FROM
city_dict t
LEFT JOIN province_dict t2 ON t.province_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.id = #{id}
</select>
</mapper>
<?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.laowu.mapper.CompanyDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.CompanyDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="company_name" property="companyName" />
<result column="place_id" property="placeId" />
<result column="position_id" property="positionId" />
<result column="company_code" property="companyCode" />
<result column="account" property="account" />
<result column="desc" property="desc" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_name, place_id, position_id, company_code, account, desc
</sql>
<select id="company" resultType="com.laowu.vo.company.CompanyVO">
SELECT
t.id,
t2.id as place_id,
t3.id as business_id,
t.company_name,
t.company_logo,
t2.place,
t3.business,
t.company_code,
t.account,
t.company_desc
FROM
company_dict t
LEFT JOIN place_dict t2 ON t.place_id = t2.id
LEFT JOIN business_dict t3 ON t.business_id = t3.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
<if test="placeId != null and placeId != ''">
and t.place_id = #{placeId}
</if>
<if test="businessId != null and businessId != ''">
and t.business_id = #{businessId}
</if>
<if test="companyName != null and companyName != ''">
AND t.company_name LIKE concat('%', #{companyName}, '%')
</if>
</select>
</mapper>
<?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.laowu.mapper.CompanyPhotoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.CompanyPhotoDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="company_id" property="companyId" />
<result column="photo" property="photo" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_id, photo
</sql>
</mapper>
<?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.laowu.mapper.JobDictMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, job_name, enterprise_name, province, city, recruit_id, start_salary, end_salary
</sql>
<select id="jobs" resultType="com.laowu.vo.job.JobVO">
SELECT
t.id,
t.job_id,
t.job_name,
t.company_name,
t.start_salary,
t.end_salary,
t4.province,
t3.city,
t2.recruit_type,
t6.position_type AS parentType,
t5.position_type AS sonType,
CONCAT( t6.position_code, t5.position_code, t.job_id ) AS jobId
FROM
job_dict t
LEFT JOIN recruit_dict t2 ON t.recruit_id = t2.id
LEFT JOIN city_dict t3 ON t.city_id = t3.id
LEFT JOIN province_dict t4 ON t3.province_id = t4.id
LEFT JOIN position_dict t5 ON t.position_id = t5.id
LEFT JOIN position_dict t6 ON t5.parent_id = t6.id
left join company_dict t7 ON t.company_id = t7.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
AND t6.delete_date IS NULL
and t.job_type = #{jobType}
<if test="recruitId != null and recruitId != ''">
AND t.recruit_id = #{recruitId}
</if>
<if test="cityId != null and cityId != ''">
AND t.city_id = #{cityId}
</if>
<if test="positions != null and positions != ''">
AND t.position_id IN
<foreach collection="positions" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
</select>
<select id="oneJob" parameterType="long" resultType="com.laowu.vo.job.OneJobVO">
SELECT
t.id,
t.position_id,
t.job_name,
t.company_name,
t.start_salary,
t.end_salary,
t4.province,
t3.city,
t2.recruit_type,
t6.position_type AS parentType,
t5.position_type AS sonType,
CONCAT( t6.position_code, t5.position_code, t.job_id ) AS jobId,
t.job_desc,
t.job_requirement,
t.company_desc
FROM
job_dict t
LEFT JOIN recruit_dict t2 ON t.recruit_id = t2.id
LEFT JOIN city_dict t3 ON t.city_id = t3.id
LEFT JOIN province_dict t4 ON t3.province_id = t4.id
LEFT JOIN position_dict t5 ON t.position_id = t5.id
LEFT JOIN position_dict t6 ON t5.parent_id = t6.id
left join company_name t7 ON t.company_name = t7.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
AND t6.delete_date IS NULL
and t.id = #{id}
</select>
<select id="relativeJobs" resultType="com.laowu.vo.job.JobVO">
SELECT
t.id,
t.job_name,
t7.company_name,
t.start_salary,
t.end_salary,
t4.province,
t3.city,
t2.recruit_type,
t6.position_type AS parentType,
t5.position_type AS sonType,
CONCAT( t6.position_code, t5.position_code, t.job_id ) AS jobId
FROM
job_dict t
LEFT JOIN recruit_dict t2 ON t.recruit_id = t2.id
LEFT JOIN city_dict t3 ON t.city_id = t3.id
LEFT JOIN province_dict t4 ON t3.province_id = t4.id
LEFT JOIN position_dict t5 ON t.position_id = t5.id
LEFT JOIN position_dict t6 ON t5.parent_id = t6.id
left JOIN company_dict t7 ON t.company_id = t7.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
AND t6.delete_date IS NULL
t.position_id =#{positionId}
limit 3
</select>
<select id="jobManagement" resultType="com.laowu.vo.job.JobManagementVO">
SELECT
t.id,
t7.company_logo,
t7.company_name,
t.recruit_status,
t.job_name,
t4.province,
t3.city,
t2.recruit_type,
t6.position_type AS parentType,
t5.position_type AS sonType,
t.job_desc,
t.start_salary,
t.end_salary,
CONCAT( t6.position_code, t5.position_code, t.job_id ) AS jobId
FROM
job_dict t
LEFT JOIN recruit_dict t2 ON t.recruit_id = t2.id
LEFT JOIN city_dict t3 ON t.city_id = t3.id
LEFT JOIN province_dict t4 ON t3.province_id = t4.id
LEFT JOIN position_dict t5 ON t.position_id = t5.id
LEFT JOIN position_dict t6 ON t5.parent_id = t6.id
left join company_dict t7 ON t.company_id = t7.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
AND t6.delete_date IS NULL
and t.job_type = #{jobType}
<if test="recruitStatus != null and recruitStatus != ''">
and t.recruit_status = #{recruitStatus}
</if>
<if test="recruitId != null and recruitId != ''">
AND t.recruit_id = #{recruitId}
</if>
<if test="cityId != null and cityId != ''">
AND t.city_id = #{cityId}
</if>
<if test="jobName != null and jobName != ''">
AND ( t.`job_name` LIKE concat('%', #{jobName}, '%') or t.enterprise_name like concat('%', #{jobName}, '%'))
</if>
<if test="positions != null and positions != ''">
AND t.position_id IN
<foreach collection="positions" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
</select>
</mapper>
<?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.laowu.mapper.JobPhotoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.JobPhotoDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="company_photos" property="companyPhotos" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_photos
</sql>
</mapper>
<?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.laowu.mapper.PermissionsDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.PermissionsDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="parent_id" property="parentId" />
<result column="name" property="name" />
<result column="children" property="children" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, parent_id, name, children
</sql>
</mapper>
<?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.laowu.mapper.PlaceDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.PlaceDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="place" property="place" />
<result column="second_title" property="secondTitle" />
<result column="desc" property="desc" />
<result column="city_id" property="cityId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, place, second_title, desc, city_id
</sql>
</mapper>
<?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.laowu.mapper.PlaceImgsMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.PlaceImgsDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="place_id" property="placeId" />
<result column="img" property="img" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, place_id, img
</sql>
</mapper>
<?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.laowu.mapper.PositionDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.PositionDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="position_type" property="positionType" />
<result column="parent_id" property="parentId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, position_type, parent_id
</sql>
<select id="jobCode" parameterType="long" resultType="string">
SELECT
CONCAT( t2.position_code, t2.position_code ) AS position_code
FROM
position_dict t
LEFT JOIN position_dict t2 ON t.parent_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.parent_id IS NOT NULL
AND t.id = #{positionId}
</select>
</mapper>
<?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.laowu.mapper.ProvinceDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.ProvinceDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="province" property="province" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, province
</sql>
</mapper>
<?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.laowu.mapper.QuestionContentMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.QuestionContentDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="content" property="content" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, content
</sql>
</mapper>
<?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.laowu.mapper.QuestionsMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.QuestionsDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="question" property="question" />
<result column="answer" property="answer" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, question, answer
</sql>
</mapper>
<?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.laowu.mapper.RecruitDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.RecruitDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="recruit_type" property="recruitType" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, recruit_type
</sql>
</mapper>
<?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.laowu.mapper.RoleAdministerMappingMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.RoleAdministerMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="administer_id" property="administerId" />
<result column="role_id" property="roleId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, administer_id, role_id
</sql>
</mapper>
<?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.laowu.mapper.RoleDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.RoleDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="role" property="role" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, role
</sql>
</mapper>
<?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.laowu.mapper.RolePermissionMappingMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.RolePermissionMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="role_id" property="roleId" />
<result column="permission_id" property="permissionId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, role_id, permission_id
</sql>
</mapper>
<?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.laowu.mapper.UserMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.UserDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="name" property="userName" />
<result column="telephone" property="telephone" />
<result column="email" property="email" />
<result column="id_card" property="idCard" />
<result column="area" property="area" />
<result column="address" property="address" />
<result column="to_city" property="toCity" />
<result column="school" property="school" />
<result column="study_period" property="studyPeriod" />
<result column="education" property="education" />
<result column="rank" property="rank" />
<result column="education_type" property="educationType" />
<result column="job_status" property="jobStatus" />
<result column="job" property="job" />
<result column="company_name" property="companyName" />
<result column="job_type" property="jobType" />
<result column="job_start_date" property="jobStartDate" />
<result column="job_end_date" property="jobEndDate" />
<result column="job_month" property="jobMonth" />
<result column="salary" property="salary" />
<result column="resume" property="resume" />
<result column="party_member" property="partyMember" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
id, name, telephone, email, id_card, area, address, to_city, school, study_period, education, rank, education_type, job_status, job, company_name, job_type, job_start_date, job_end_date, job_month, salary, resume, party_member, end_date
</sql>
<select id="users" resultType="com.laowu.vo.user.UsersVO">
SELECT
id,
user_type,
user_name,
telephone,
email,
id_card,
area,
address,
to_city,
school,
study_period,
education,
rank,
education_type,
job_status,
job,
company_name,
job_type,
job_start_date,
job_end_date,
job_month,
salary,
resume,
party_member
FROM
`user` t
WHERE
t.delete_date IS NULL
<if test="userType = null and userType != ''">
and t.user_type = #{userType}
</if>
<if test="education != null and education != ''">
AND t.education = #{education}
</if>
<if test="partyMember != null and partyMember != ''">
AND t.party_member = #{partyMember}
</if>
<if test="userName != null and userName != ''">
AND ( t.`name` LIKE concat('%', #{userName}, '%') or t.company_name like concat('%', #{userName}, '%'))
</if>
</select>
<select id="oneUser" parameterType="long" resultType="com.laowu.vo.user.UsersVO">
SELECT
id,
user_type,
user_name,
telephone,
email,
id_card,
area,
address,
to_city,
school,
study_period,
education,
rank,
education_type,
job_status,
job,
company_name,
job_type,
job_start_date,
job_end_date,
job_month,
salary,
resume,
party_member
FROM
`user` t
WHERE
t.delete_date IS NULL
and t.id = #{id}
</select>
</mapper>
# 此处为本项目src所在路径(代码生成器输出路径)
outputDir=/src/main/java
author=Tuyp
# 父的包名
setParent=com.laowu
# mapper.xml文件生成路径
mapperPath=/src/main/resources/mapper/
# 数据库地址
url=jdbc:mysql://116.62.57.92:3306/laowu?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true&useAffectedRows=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
driverName=com.mysql.cj.jdbc.Driver
userName=devloper
password=dev@1553$
\ No newline at end of file
<?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>
<setting name="logImpl" value="SLF4J"/>
<!-- 开启驼峰命名转换 Table(create_date) -> Entity(createTime) -->
<setting name="mapUnderscoreToCamelCase" value="true" />
</settings>
</configuration>
package ${package.Controller};
import org.springframework.web.bind.annotation.RequestMapping;
<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
</#if>
<#if superControllerClassPackage??>
import ${superControllerClassPackage};
</#if>
import io.swagger.annotations.Api;
/**
* <p>
* ${table.comment!} 前端控制器
* </p>
*
* @author ${author}
* @since ${date}
*/
<#if restControllerStyle>
@RestController
@Api(tags = "${table.comment!}")
<#else>
@Controller
</#if>
@RequestMapping("<#if package.ModuleName?? && package.ModuleName != "">/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} {
</#if>
}
</#if>
package ${package.Entity};
<#list table.importPackages as pkg>
import ${pkg};
</#list>
<#if swagger2>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
</#if>
<#if entityLombokModel>
import lombok.Data;
import lombok.EqualsAndHashCode;
<#if chainModel>
import lombok.experimental.Accessors;
</#if>
</#if>
/**
* <p>
* ${table.comment!}
* </p>
*
* @author ${author}
* @since ${date}
*/
<#if entityLombokModel>
@Data
<#if superEntityClass??>
@EqualsAndHashCode(callSuper = true)
<#else>
@EqualsAndHashCode(callSuper = false)
</#if>
<#if chainModel>
@Accessors(chain = true)
</#if>
</#if>
<#if table.convert>
@TableName("${table.name}")
</#if>
<#if swagger2>
@ApiModel(value="${entity}对象", description="${table.comment!}")
</#if>
<#if superEntityClass??>
public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
<#elseif activeRecord>
public class ${entity} extends Model<${entity}> {
<#else>
public class ${entity} implements Serializable {
</#if>
<#if entitySerialVersionUID>
private static final long serialVersionUID = 1L;
</#if>
<#-- ---------- BEGIN 字段循环遍历 ---------->
<#list table.fields as field>
<#if field.keyFlag>
<#assign keyPropertyName="${field.propertyName}"/>
</#if>
<#if field.comment!?length gt 0>
<#if swagger2>
@ApiModelProperty(value = "${field.comment}")
<#else>
/**
* ${field.comment}
*/
</#if>
</#if>
<#if field.keyFlag>
<#-- 主键 -->
<#if field.keyIdentityFlag>
@TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
<#elseif idType??>
@TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
<#elseif field.convert>
@TableId("${field.annotationColumnName}")
</#if>
<#-- 普通字段 -->
<#elseif field.fill??>
<#-- ----- 存在字段填充设置 ----->
<#if field.convert>
@TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
<#else>
@TableField(fill = FieldFill.${field.fill})
</#if>
<#elseif field.convert>
@TableField("${field.annotationColumnName}")
</#if>
<#-- 乐观锁注解 -->
<#if (versionFieldName!"") == field.name>
@Version
</#if>
<#-- 逻辑删除注解 -->
<#if (logicDeleteFieldName!"") == field.name>
@TableLogic
</#if>
private ${field.propertyType} ${field.propertyName};
</#list>
<#------------ END 字段循环遍历 ---------->
<#if !entityLombokModel>
<#list table.fields as field>
<#if field.propertyType == "boolean">
<#assign getprefix="is"/>
<#else>
<#assign getprefix="get"/>
</#if>
public ${field.propertyType} ${getprefix}${field.capitalName}() {
return ${field.propertyName};
}
<#if chainModel>
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
<#else>
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
</#if>
this.${field.propertyName} = ${field.propertyName};
<#if chainModel>
return this;
</#if>
}
</#list>
</#if>
<#if entityColumnConstant>
<#list table.fields as field>
public static final String ${field.name?upper_case} = "${field.name}";
</#list>
</#if>
<#if activeRecord>
@Override
protected Serializable pkVal() {
<#if keyPropertyName??>
return this.${keyPropertyName};
<#else>
return null;
</#if>
}
</#if>
<#if !entityLombokModel>
@Override
public String toString() {
return "${entity}{" +
<#list table.fields as field>
<#if field_index==0>
"${field.propertyName}=" + ${field.propertyName} +
<#else>
", ${field.propertyName}=" + ${field.propertyName} +
</#if>
</#list>
"}";
}
</#if>
}
package ${package.Mapper};
import ${package.Entity}.${entity};
import ${superMapperClassPackage};
import org.springframework.stereotype.Repository;
/**
* <p>
* ${table.comment!} Mapper 接口
* </p>
*
* @author ${author}
* @since ${date}
*/
<#if kotlin>
interface ${table.mapperName} : ${superMapperClass}<${entity}>
<#else>
@Repository
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
}
</#if>
<?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="${package.Mapper}.${table.mapperName}">
<#if enableCache>
<!-- 开启二级缓存 -->
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
</#if>
<#if baseResultMap>
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
<#list table.fields as field>
<#if field.keyFlag><#--生成主键排在第一位-->
<id column="${field.name}" property="${field.propertyName}" />
</#if>
</#list>
<#list table.commonFields as field><#--生成公共字段 -->
<result column="${field.name}" property="${field.propertyName}" />
</#list>
<#list table.fields as field>
<#if !field.keyFlag><#--生成普通字段 -->
<result column="${field.name}" property="${field.propertyName}" />
</#if>
</#list>
</resultMap>
</#if>
<#if baseColumnList>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
<#list table.commonFields as field>
${field.columnName},
</#list>
${table.fieldNames}
</sql>
</#if>
</mapper>
package ${package.Service};
import ${package.Entity}.${entity};
import ${superServiceClassPackage};
/**
* <p>
* ${table.comment!} 服务类
* </p>
*
* @author ${author}
* @since ${date}
*/
<#if kotlin>
interface ${table.serviceName} : ${superServiceClass}<${entity}>
<#else>
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
}
</#if>
package ${package.ServiceImpl};
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
/**
* <p>
* ${table.comment!} 服务实现类
* </p>
*
* @author ${author}
* @since ${date}
*/
@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
}
</#if>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!