diff --git b/.gitignore a/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ a/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git b/.mvn/wrapper/maven-wrapper.jar a/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..c1dd12f Binary files /dev/null and a/.mvn/wrapper/maven-wrapper.jar differ diff --git b/.mvn/wrapper/maven-wrapper.properties a/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..b74bf7f --- /dev/null +++ a/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +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 diff --git b/logs/springboot-logback-error.log a/logs/springboot-logback-error.log new file mode 100644 index 0000000..e69de29 --- /dev/null +++ a/logs/springboot-logback-error.log diff --git b/logs/springboot-logback-info.log a/logs/springboot-logback-info.log new file mode 100644 index 0000000..9726bb0 --- /dev/null +++ a/logs/springboot-logback-info.log @@ -0,0 +1,41 @@ +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.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.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 diff --git b/logs/springboot-logback/info/2023-02-14-0.log.gz a/logs/springboot-logback/info/2023-02-14-0.log.gz new file mode 100644 index 0000000..8193ca9 Binary files /dev/null and a/logs/springboot-logback/info/2023-02-14-0.log.gz differ diff --git b/logs/springboot-logback/info/2023-02-15-0.log.gz a/logs/springboot-logback/info/2023-02-15-0.log.gz new file mode 100644 index 0000000..92aa3a2 Binary files /dev/null and a/logs/springboot-logback/info/2023-02-15-0.log.gz differ diff --git b/logs/springboot-logback/info/2023-02-17-0.log.gz a/logs/springboot-logback/info/2023-02-17-0.log.gz new file mode 100644 index 0000000..0ef1eaf Binary files /dev/null and a/logs/springboot-logback/info/2023-02-17-0.log.gz differ diff --git b/logs/springboot-logback/info/2023-02-20-0.log.gz a/logs/springboot-logback/info/2023-02-20-0.log.gz new file mode 100644 index 0000000..6cdb8c6 Binary files /dev/null and a/logs/springboot-logback/info/2023-02-20-0.log.gz differ diff --git b/mvnw a/mvnw new file mode 100644 index 0000000..8a8fb22 --- /dev/null +++ a/mvnw @@ -0,0 +1,316 @@ +#!/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 "$@" diff --git b/mvnw.cmd a/mvnw.cmd new file mode 100644 index 0000000..1d8ab01 --- /dev/null +++ a/mvnw.cmd @@ -0,0 +1,188 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git b/pom.xml a/pom.xml new file mode 100644 index 0000000..d85fead --- /dev/null +++ a/pom.xml @@ -0,0 +1,152 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.7.RELEASE + + + com.laowu + demo + 0.0.1-SNAPSHOT + laowu + laowu + + + UTF-8 + UTF-8 + 1.8 + 3.3.0 + 3.3.2 + 2.9.2 + 1.1.22 + 3.10.3 + 3.13 + 3.9 + + + + + org.springframework.boot + spring-boot-starter + + + + org.freemarker + freemarker + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-aop + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + mysql + mysql-connector-java + runtime + + + + org.springframework.boot + spring-boot-starter-jdbc + + + + org.projectlombok + lombok + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.version} + + + + com.baomidou + mybatis-plus-generator + ${generator.version} + + + + io.springfox + springfox-swagger2 + ${swagger2.version} + + + + io.springfox + springfox-swagger-ui + ${swagger2.version} + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + org.springframework.boot + spring-boot-starter-websocket + + + + org.java-websocket + Java-WebSocket + 1.5.1 + + + + com.auth0 + java-jwt + ${java-jwt.version} + + + + org.apache.poi + poi-ooxml + ${poi-ooxml.version} + + + + org.apache.commons + commons-lang3 + ${lang3.version} + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git b/src/main/java/com/laowu/LaowuApplication.java a/src/main/java/com/laowu/LaowuApplication.java new file mode 100644 index 0000000..6790eab --- /dev/null +++ a/src/main/java/com/laowu/LaowuApplication.java @@ -0,0 +1,17 @@ +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); + } + +} diff --git b/src/main/java/com/laowu/common/MyTomcat.java a/src/main/java/com/laowu/common/MyTomcat.java new file mode 100644 index 0000000..55ff7de --- /dev/null +++ a/src/main/java/com/laowu/common/MyTomcat.java @@ -0,0 +1,89 @@ +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"); + } + } + +} diff --git b/src/main/java/com/laowu/common/MybatisPlusConfig.java a/src/main/java/com/laowu/common/MybatisPlusConfig.java new file mode 100644 index 0000000..2ae5e97 --- /dev/null +++ a/src/main/java/com/laowu/common/MybatisPlusConfig.java @@ -0,0 +1,54 @@ +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; + } + +} diff --git b/src/main/java/com/laowu/common/RemoteProperties.java a/src/main/java/com/laowu/common/RemoteProperties.java new file mode 100644 index 0000000..a879777 --- /dev/null +++ a/src/main/java/com/laowu/common/RemoteProperties.java @@ -0,0 +1,36 @@ +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; + +/** + *

+ * 读取状态码 + *

+ * + * @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 codeMessage = new HashMap<>(); + + public static String getMessage(Integer code) { + return codeMessage.get(code); + } + + public Map getCodeMessage() { + return codeMessage; + } + + public void setCodeMessage(Map codeMessage) { + RemoteProperties.codeMessage = codeMessage; + } +} \ No newline at end of file diff --git b/src/main/java/com/laowu/common/SwaggerConfig.java a/src/main/java/com/laowu/common/SwaggerConfig.java new file mode 100644 index 0000000..c6a10c1 --- /dev/null +++ a/src/main/java/com/laowu/common/SwaggerConfig.java @@ -0,0 +1,31 @@ +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()); + } +} diff --git b/src/main/java/com/laowu/common/WebConfig.java a/src/main/java/com/laowu/common/WebConfig.java new file mode 100644 index 0000000..f796f71 --- /dev/null +++ a/src/main/java/com/laowu/common/WebConfig.java @@ -0,0 +1,78 @@ +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 diff --git b/src/main/java/com/laowu/common/constant/Code.java a/src/main/java/com/laowu/common/constant/Code.java new file mode 100644 index 0000000..1c5b34d --- /dev/null +++ a/src/main/java/com/laowu/common/constant/Code.java @@ -0,0 +1,33 @@ +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; + } +} diff --git b/src/main/java/com/laowu/common/exception/GlobalExceptionHandler.java a/src/main/java/com/laowu/common/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000..b6ac3a4 --- /dev/null +++ a/src/main/java/com/laowu/common/exception/GlobalExceptionHandler.java @@ -0,0 +1,118 @@ +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 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 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 diff --git b/src/main/java/com/laowu/common/exception/HttpException.java a/src/main/java/com/laowu/common/exception/HttpException.java new file mode 100644 index 0000000..0172fd1 --- /dev/null +++ a/src/main/java/com/laowu/common/exception/HttpException.java @@ -0,0 +1,45 @@ +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; + } +} diff --git b/src/main/java/com/laowu/common/handler/MetaHandler.java a/src/main/java/com/laowu/common/handler/MetaHandler.java new file mode 100644 index 0000000..b4dd878 --- /dev/null +++ a/src/main/java/com/laowu/common/handler/MetaHandler.java @@ -0,0 +1,26 @@ +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); + } +} diff --git b/src/main/java/com/laowu/common/interceptor/AuthenticationInterceptor.java a/src/main/java/com/laowu/common/interceptor/AuthenticationInterceptor.java new file mode 100644 index 0000000..42c724a --- /dev/null +++ a/src/main/java/com/laowu/common/interceptor/AuthenticationInterceptor.java @@ -0,0 +1,98 @@ +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; + +/** + *

+ * 鉴权拦截器 + *

+ * + * @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 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() +// .lambda() +// .eq(MemberTokensDO::getMemberId,memberDO.getId())); +// if (count==0){ +// throw new HttpException(1011); +// } + + else { + throw new HttpException(1010); + } + } + } + throw new HttpException(1010); + } + return true; + } + +} diff --git b/src/main/java/com/laowu/common/interceptor/LoginRequired.java a/src/main/java/com/laowu/common/interceptor/LoginRequired.java new file mode 100644 index 0000000..3b409f0 --- /dev/null +++ a/src/main/java/com/laowu/common/interceptor/LoginRequired.java @@ -0,0 +1,20 @@ +package com.laowu.common.interceptor; + +import java.lang.annotation.*; + +/** + *

+ * 自定义验证登陆注解 + *

+ * + * @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 diff --git b/src/main/java/com/laowu/common/interceptor/TimeRequired.java a/src/main/java/com/laowu/common/interceptor/TimeRequired.java new file mode 100644 index 0000000..eae6322 --- /dev/null +++ a/src/main/java/com/laowu/common/interceptor/TimeRequired.java @@ -0,0 +1,10 @@ +package com.laowu.common.interceptor; + +import java.lang.annotation.*; + +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +public @interface TimeRequired { +} diff --git b/src/main/java/com/laowu/common/interceptor/WebSocketInterceptor.java a/src/main/java/com/laowu/common/interceptor/WebSocketInterceptor.java new file mode 100644 index 0000000..3cb1fdf --- /dev/null +++ a/src/main/java/com/laowu/common/interceptor/WebSocketInterceptor.java @@ -0,0 +1,44 @@ +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; + +/** + *

+ * WebSocket握手拦截器 + *

+ * + * @author DengMin + * @since 2022/7/14 + */ +@Component +public class WebSocketInterceptor implements HandshakeInterceptor { + + + /** + * 自定义验证规则, 如果该用户不存在数据表中,拒绝此次连接 + */ + @Override + public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Map 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) { + + } +} diff --git b/src/main/java/com/laowu/controller/AdministerController.java a/src/main/java/com/laowu/controller/AdministerController.java new file mode 100644 index 0000000..6b00347 --- /dev/null +++ a/src/main/java/com/laowu/controller/AdministerController.java @@ -0,0 +1,48 @@ +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; + +/** + *

+ * 管理后台用户 前端控制器 + *

+ * + * @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()); + } + + + +} diff --git b/src/main/java/com/laowu/controller/BusinessDictController.java a/src/main/java/com/laowu/controller/BusinessDictController.java new file mode 100644 index 0000000..356a1f0 --- /dev/null +++ a/src/main/java/com/laowu/controller/BusinessDictController.java @@ -0,0 +1,56 @@ +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; + +/** + *

+ * 经营范围 前端控制器 + *

+ * + * @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()); + } +} diff --git b/src/main/java/com/laowu/controller/CityDictController.java a/src/main/java/com/laowu/controller/CityDictController.java new file mode 100644 index 0000000..1344ac0 --- /dev/null +++ a/src/main/java/com/laowu/controller/CityDictController.java @@ -0,0 +1,22 @@ +package com.laowu.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 城市字典表 前端控制器 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@RestController +@Api(tags = "城市字典表") +@RequestMapping("/city-dict-do") +public class CityDictController { + +} diff --git b/src/main/java/com/laowu/controller/CompanyDictController.java a/src/main/java/com/laowu/controller/CompanyDictController.java new file mode 100644 index 0000000..07dc44e --- /dev/null +++ a/src/main/java/com/laowu/controller/CompanyDictController.java @@ -0,0 +1,64 @@ +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; + +/** + *

+ * 企业管理表 前端控制器 + *

+ * + * @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)); + } + +} diff --git b/src/main/java/com/laowu/controller/CompanyPhotoController.java a/src/main/java/com/laowu/controller/CompanyPhotoController.java new file mode 100644 index 0000000..c502bf3 --- /dev/null +++ a/src/main/java/com/laowu/controller/CompanyPhotoController.java @@ -0,0 +1,22 @@ +package com.laowu.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 企业展示 前端控制器 + *

+ * + * @author Tuyp + * @since 2023-02-16 + */ +@RestController +@Api(tags = "企业展示") +@RequestMapping("/companyPhoto") +public class CompanyPhotoController { + +} diff --git b/src/main/java/com/laowu/controller/JobDictController.java a/src/main/java/com/laowu/controller/JobDictController.java new file mode 100644 index 0000000..72dd69f --- /dev/null +++ a/src/main/java/com/laowu/controller/JobDictController.java @@ -0,0 +1,82 @@ +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; + +/** + *

+ * 职位字典表 前端控制器 + *

+ * + * @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)); + } + + +} diff --git b/src/main/java/com/laowu/controller/JobPhotoController.java a/src/main/java/com/laowu/controller/JobPhotoController.java new file mode 100644 index 0000000..9201454 --- /dev/null +++ a/src/main/java/com/laowu/controller/JobPhotoController.java @@ -0,0 +1,22 @@ +package com.laowu.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 公司介绍 前端控制器 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@RestController +@Api(tags = "公司介绍") +@RequestMapping("/job-photo-do") +public class JobPhotoController { + +} diff --git b/src/main/java/com/laowu/controller/PermissionsDictController.java a/src/main/java/com/laowu/controller/PermissionsDictController.java new file mode 100644 index 0000000..ea8a289 --- /dev/null +++ a/src/main/java/com/laowu/controller/PermissionsDictController.java @@ -0,0 +1,22 @@ +package com.laowu.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 权限表 前端控制器 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@RestController +@Api(tags = "权限表") +@RequestMapping("/permissions-dict-do") +public class PermissionsDictController { + +} diff --git b/src/main/java/com/laowu/controller/PlaceDictController.java a/src/main/java/com/laowu/controller/PlaceDictController.java new file mode 100644 index 0000000..7b8be24 --- /dev/null +++ a/src/main/java/com/laowu/controller/PlaceDictController.java @@ -0,0 +1,64 @@ +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; + +/** + *

+ * 地区字典表 前端控制器 + *

+ * + * @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)); + } + + +} diff --git b/src/main/java/com/laowu/controller/PlaceImgsController.java a/src/main/java/com/laowu/controller/PlaceImgsController.java new file mode 100644 index 0000000..8d68350 --- /dev/null +++ a/src/main/java/com/laowu/controller/PlaceImgsController.java @@ -0,0 +1,22 @@ +package com.laowu.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 地点图片 前端控制器 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@RestController +@Api(tags = "地点图片") +@RequestMapping("/place-imgs-do") +public class PlaceImgsController { + +} diff --git b/src/main/java/com/laowu/controller/PositionDictController.java a/src/main/java/com/laowu/controller/PositionDictController.java new file mode 100644 index 0000000..bba62a7 --- /dev/null +++ a/src/main/java/com/laowu/controller/PositionDictController.java @@ -0,0 +1,35 @@ +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; + +/** + *

+ * 职位类别 前端控制器 + *

+ * + * @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()); + } + +} diff --git b/src/main/java/com/laowu/controller/ProvinceDictController.java a/src/main/java/com/laowu/controller/ProvinceDictController.java new file mode 100644 index 0000000..d51db54 --- /dev/null +++ a/src/main/java/com/laowu/controller/ProvinceDictController.java @@ -0,0 +1,35 @@ +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; + +/** + *

+ * 城市字典表 前端控制器 + *

+ * + * @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()); + } + +} diff --git b/src/main/java/com/laowu/controller/QuestionContentController.java a/src/main/java/com/laowu/controller/QuestionContentController.java new file mode 100644 index 0000000..f6448ff --- /dev/null +++ a/src/main/java/com/laowu/controller/QuestionContentController.java @@ -0,0 +1,56 @@ +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; + +/** + *

+ * 答疑目录 前端控制器 + *

+ * + * @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)); + } + +} diff --git b/src/main/java/com/laowu/controller/QuestionsController.java a/src/main/java/com/laowu/controller/QuestionsController.java new file mode 100644 index 0000000..1c40707 --- /dev/null +++ a/src/main/java/com/laowu/controller/QuestionsController.java @@ -0,0 +1,56 @@ +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; + +/** + *

+ * Q && A 前端控制器 + *

+ * + * @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)); + } + +} diff --git b/src/main/java/com/laowu/controller/RecruitDictController.java a/src/main/java/com/laowu/controller/RecruitDictController.java new file mode 100644 index 0000000..790d6de --- /dev/null +++ a/src/main/java/com/laowu/controller/RecruitDictController.java @@ -0,0 +1,38 @@ +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; + +/** + *

+ * 招聘类型 前端控制器 + *

+ * + * @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()); + } + + +} diff --git b/src/main/java/com/laowu/controller/RoleAdministerMappingController.java a/src/main/java/com/laowu/controller/RoleAdministerMappingController.java new file mode 100644 index 0000000..3a86f21 --- /dev/null +++ a/src/main/java/com/laowu/controller/RoleAdministerMappingController.java @@ -0,0 +1,22 @@ +package com.laowu.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 前端控制器 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@RestController +@Api(tags = "") +@RequestMapping("/role-administer-mapping-do") +public class RoleAdministerMappingController { + +} diff --git b/src/main/java/com/laowu/controller/RoleDictController.java a/src/main/java/com/laowu/controller/RoleDictController.java new file mode 100644 index 0000000..5972e51 --- /dev/null +++ a/src/main/java/com/laowu/controller/RoleDictController.java @@ -0,0 +1,22 @@ +package com.laowu.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 角色表 前端控制器 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@RestController +@Api(tags = "角色表") +@RequestMapping("/role-dict-do") +public class RoleDictController { + +} diff --git b/src/main/java/com/laowu/controller/RolePermissionMappingController.java a/src/main/java/com/laowu/controller/RolePermissionMappingController.java new file mode 100644 index 0000000..6d23803 --- /dev/null +++ a/src/main/java/com/laowu/controller/RolePermissionMappingController.java @@ -0,0 +1,22 @@ +package com.laowu.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 系统用户角色表 前端控制器 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@RestController +@Api(tags = "系统用户角色表") +@RequestMapping("/role-permission-mapping-do") +public class RolePermissionMappingController { + +} diff --git b/src/main/java/com/laowu/controller/UserController.java a/src/main/java/com/laowu/controller/UserController.java new file mode 100644 index 0000000..021e8db --- /dev/null +++ a/src/main/java/com/laowu/controller/UserController.java @@ -0,0 +1,71 @@ +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; + +/** + *

+ * 用户表 前端控制器 + *

+ * + * @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)); + } + +} diff --git b/src/main/java/com/laowu/dto/company/AddCompanyDTO.java a/src/main/java/com/laowu/dto/company/AddCompanyDTO.java new file mode 100644 index 0000000..dabb533 --- /dev/null +++ a/src/main/java/com/laowu/dto/company/AddCompanyDTO.java @@ -0,0 +1,14 @@ +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 companyPhotoDOS; + +} diff --git b/src/main/java/com/laowu/dto/company/CompanyDTO.java a/src/main/java/com/laowu/dto/company/CompanyDTO.java new file mode 100644 index 0000000..e1753c0 --- /dev/null +++ a/src/main/java/com/laowu/dto/company/CompanyDTO.java @@ -0,0 +1,20 @@ +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; + +} diff --git b/src/main/java/com/laowu/dto/job/BatchAddJobDTO.java a/src/main/java/com/laowu/dto/job/BatchAddJobDTO.java new file mode 100644 index 0000000..3b9d902 --- /dev/null +++ a/src/main/java/com/laowu/dto/job/BatchAddJobDTO.java @@ -0,0 +1,25 @@ +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; + +} diff --git b/src/main/java/com/laowu/dto/job/JobDTO.java a/src/main/java/com/laowu/dto/job/JobDTO.java new file mode 100644 index 0000000..e2e79ca --- /dev/null +++ a/src/main/java/com/laowu/dto/job/JobDTO.java @@ -0,0 +1,22 @@ +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 positions; + +} diff --git b/src/main/java/com/laowu/dto/job/JobManagementDTO.java a/src/main/java/com/laowu/dto/job/JobManagementDTO.java new file mode 100644 index 0000000..bf3ee86 --- /dev/null +++ a/src/main/java/com/laowu/dto/job/JobManagementDTO.java @@ -0,0 +1,26 @@ +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 positions; + +} diff --git b/src/main/java/com/laowu/dto/place/AddPlaceDTO.java a/src/main/java/com/laowu/dto/place/AddPlaceDTO.java new file mode 100644 index 0000000..f7940b9 --- /dev/null +++ a/src/main/java/com/laowu/dto/place/AddPlaceDTO.java @@ -0,0 +1,15 @@ +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 placeImgsDOS; + +} diff --git b/src/main/java/com/laowu/dto/user/ImportUsersDTO.java a/src/main/java/com/laowu/dto/user/ImportUsersDTO.java new file mode 100644 index 0000000..01b509e --- /dev/null +++ a/src/main/java/com/laowu/dto/user/ImportUsersDTO.java @@ -0,0 +1,84 @@ +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; + +} diff --git b/src/main/java/com/laowu/dto/user/UsersDTO.java a/src/main/java/com/laowu/dto/user/UsersDTO.java new file mode 100644 index 0000000..c9997d6 --- /dev/null +++ a/src/main/java/com/laowu/dto/user/UsersDTO.java @@ -0,0 +1,21 @@ +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; + + +} diff --git b/src/main/java/com/laowu/mapper/AdministerMapper.java a/src/main/java/com/laowu/mapper/AdministerMapper.java new file mode 100644 index 0000000..9482cfe --- /dev/null +++ a/src/main/java/com/laowu/mapper/AdministerMapper.java @@ -0,0 +1,24 @@ +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; + +/** + *

+ * 管理后台用户 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@Repository +public interface AdministerMapper extends BaseMapper { + + List getPermissions(Long id); + + +} diff --git b/src/main/java/com/laowu/mapper/BusinessDictMapper.java a/src/main/java/com/laowu/mapper/BusinessDictMapper.java new file mode 100644 index 0000000..6cde043 --- /dev/null +++ a/src/main/java/com/laowu/mapper/BusinessDictMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.BusinessDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 经营范围 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ + @Repository +public interface BusinessDictMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/CityDictMapper.java a/src/main/java/com/laowu/mapper/CityDictMapper.java new file mode 100644 index 0000000..1218884 --- /dev/null +++ a/src/main/java/com/laowu/mapper/CityDictMapper.java @@ -0,0 +1,23 @@ +package com.laowu.mapper; + +import com.laowu.model.CityDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 城市字典表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Repository +public interface CityDictMapper extends BaseMapper { + + /** + * 通过cityId查询省-市 + */ + String getCityName(Long cityId); + +} diff --git b/src/main/java/com/laowu/mapper/CompanyDictMapper.java a/src/main/java/com/laowu/mapper/CompanyDictMapper.java new file mode 100644 index 0000000..9f1d4d3 --- /dev/null +++ a/src/main/java/com/laowu/mapper/CompanyDictMapper.java @@ -0,0 +1,25 @@ +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; + +/** + *

+ * 企业管理表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-16 + */ +@Repository +public interface CompanyDictMapper extends BaseMapper { + + /** + * 查询企业 + */ + IPage company(IPage page, String companyName, Long placeId,Long businessId); + +} diff --git b/src/main/java/com/laowu/mapper/CompanyPhotoMapper.java a/src/main/java/com/laowu/mapper/CompanyPhotoMapper.java new file mode 100644 index 0000000..05c4c90 --- /dev/null +++ a/src/main/java/com/laowu/mapper/CompanyPhotoMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.CompanyPhotoDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 企业展示 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-16 + */ + @Repository +public interface CompanyPhotoMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/JobDictMapper.java a/src/main/java/com/laowu/mapper/JobDictMapper.java new file mode 100644 index 0000000..b7eea0e --- /dev/null +++ a/src/main/java/com/laowu/mapper/JobDictMapper.java @@ -0,0 +1,44 @@ +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; + +/** + *

+ * 职位字典表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Repository +public interface JobDictMapper extends BaseMapper { + + /** + * 查询工作 分页 + */ + IPage jobs(IPage page, Long recruitId, Long cityId, List positions,Integer jobType); + + /** + * 查询 一个工作 + */ + OneJobVO oneJob(Long id); + + /** + * 相关推荐 + */ + List relativeJobs(Long positionId); + + /** + * 职位管理 + */ + IPage jobManagement(IPage page,Long recruitId, Long cityId, List positions,Integer jobType,String recruitStatus); + +} diff --git b/src/main/java/com/laowu/mapper/JobPhotoMapper.java a/src/main/java/com/laowu/mapper/JobPhotoMapper.java new file mode 100644 index 0000000..cbb9578 --- /dev/null +++ a/src/main/java/com/laowu/mapper/JobPhotoMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.JobPhotoDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 公司介绍 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ + @Repository +public interface JobPhotoMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/PermissionsDictMapper.java a/src/main/java/com/laowu/mapper/PermissionsDictMapper.java new file mode 100644 index 0000000..b8c8147 --- /dev/null +++ a/src/main/java/com/laowu/mapper/PermissionsDictMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.PermissionsDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 权限表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ + @Repository +public interface PermissionsDictMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/PlaceDictMapper.java a/src/main/java/com/laowu/mapper/PlaceDictMapper.java new file mode 100644 index 0000000..3ddc857 --- /dev/null +++ a/src/main/java/com/laowu/mapper/PlaceDictMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.PlaceDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 地区字典表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ + @Repository +public interface PlaceDictMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/PlaceImgsMapper.java a/src/main/java/com/laowu/mapper/PlaceImgsMapper.java new file mode 100644 index 0000000..cb439e0 --- /dev/null +++ a/src/main/java/com/laowu/mapper/PlaceImgsMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.PlaceImgsDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 地点图片 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ + @Repository +public interface PlaceImgsMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/PositionDictMapper.java a/src/main/java/com/laowu/mapper/PositionDictMapper.java new file mode 100644 index 0000000..ceff8cc --- /dev/null +++ a/src/main/java/com/laowu/mapper/PositionDictMapper.java @@ -0,0 +1,23 @@ +package com.laowu.mapper; + +import com.laowu.model.PositionDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 职位类别 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Repository +public interface PositionDictMapper extends BaseMapper { + + /** + * 通过子职位生成父子职位编码 + */ + String jobCode(Long positionId); + +} diff --git b/src/main/java/com/laowu/mapper/ProvinceDictMapper.java a/src/main/java/com/laowu/mapper/ProvinceDictMapper.java new file mode 100644 index 0000000..0b8ebb1 --- /dev/null +++ a/src/main/java/com/laowu/mapper/ProvinceDictMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.ProvinceDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 城市字典表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ + @Repository +public interface ProvinceDictMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/QuestionContentMapper.java a/src/main/java/com/laowu/mapper/QuestionContentMapper.java new file mode 100644 index 0000000..6506c1d --- /dev/null +++ a/src/main/java/com/laowu/mapper/QuestionContentMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.QuestionContentDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 答疑目录 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ + @Repository +public interface QuestionContentMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/QuestionsMapper.java a/src/main/java/com/laowu/mapper/QuestionsMapper.java new file mode 100644 index 0000000..05f23b9 --- /dev/null +++ a/src/main/java/com/laowu/mapper/QuestionsMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.QuestionsDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Q && A Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ + @Repository +public interface QuestionsMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/RecruitDictMapper.java a/src/main/java/com/laowu/mapper/RecruitDictMapper.java new file mode 100644 index 0000000..fe31fb7 --- /dev/null +++ a/src/main/java/com/laowu/mapper/RecruitDictMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.RecruitDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 招聘类型 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ + @Repository +public interface RecruitDictMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/RoleAdministerMappingMapper.java a/src/main/java/com/laowu/mapper/RoleAdministerMappingMapper.java new file mode 100644 index 0000000..52e73a1 --- /dev/null +++ a/src/main/java/com/laowu/mapper/RoleAdministerMappingMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.RoleAdministerMappingDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ + @Repository +public interface RoleAdministerMappingMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/RoleDictMapper.java a/src/main/java/com/laowu/mapper/RoleDictMapper.java new file mode 100644 index 0000000..cdbebd0 --- /dev/null +++ a/src/main/java/com/laowu/mapper/RoleDictMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.RoleDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 角色表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ + @Repository +public interface RoleDictMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/RolePermissionMappingMapper.java a/src/main/java/com/laowu/mapper/RolePermissionMappingMapper.java new file mode 100644 index 0000000..a7354e7 --- /dev/null +++ a/src/main/java/com/laowu/mapper/RolePermissionMappingMapper.java @@ -0,0 +1,18 @@ +package com.laowu.mapper; + +import com.laowu.model.RolePermissionMappingDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 系统用户角色表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ + @Repository +public interface RolePermissionMappingMapper extends BaseMapper { + +} diff --git b/src/main/java/com/laowu/mapper/UserMapper.java a/src/main/java/com/laowu/mapper/UserMapper.java new file mode 100644 index 0000000..d16ebb9 --- /dev/null +++ a/src/main/java/com/laowu/mapper/UserMapper.java @@ -0,0 +1,24 @@ +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; + +/** + *

+ * 用户表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-16 + */ +@Repository +public interface UserMapper extends BaseMapper { + + IPage users(IPage page, Long userType, String education, String partyMember, String userName); + + UsersVO oneUser(Long id); + +} diff --git b/src/main/java/com/laowu/model/AdministerDO.java a/src/main/java/com/laowu/model/AdministerDO.java new file mode 100644 index 0000000..a36bcbf --- /dev/null +++ a/src/main/java/com/laowu/model/AdministerDO.java @@ -0,0 +1,33 @@ +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; + +/** + *

+ * 管理后台用户 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/BusinessDictDO.java a/src/main/java/com/laowu/model/BusinessDictDO.java new file mode 100644 index 0000000..e3439cc --- /dev/null +++ a/src/main/java/com/laowu/model/BusinessDictDO.java @@ -0,0 +1,31 @@ +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; + +/** + *

+ * 经营范围 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/CityDictDO.java a/src/main/java/com/laowu/model/CityDictDO.java new file mode 100644 index 0000000..d03b9c9 --- /dev/null +++ a/src/main/java/com/laowu/model/CityDictDO.java @@ -0,0 +1,39 @@ +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; + +/** + *

+ * 城市字典表 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/CompanyDictDO.java a/src/main/java/com/laowu/model/CompanyDictDO.java new file mode 100644 index 0000000..21ca228 --- /dev/null +++ a/src/main/java/com/laowu/model/CompanyDictDO.java @@ -0,0 +1,64 @@ +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; + +/** + *

+ * 企业管理表 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/CompanyPhotoDO.java a/src/main/java/com/laowu/model/CompanyPhotoDO.java new file mode 100644 index 0000000..bb23410 --- /dev/null +++ a/src/main/java/com/laowu/model/CompanyPhotoDO.java @@ -0,0 +1,39 @@ +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; + +/** + *

+ * 企业展示 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/JobDictDO.java a/src/main/java/com/laowu/model/JobDictDO.java new file mode 100644 index 0000000..d32e186 --- /dev/null +++ a/src/main/java/com/laowu/model/JobDictDO.java @@ -0,0 +1,94 @@ +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; + +/** + *

+ * 职位字典表 + *

+ * + * @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; + +} diff --git b/src/main/java/com/laowu/model/JobPhotoDO.java a/src/main/java/com/laowu/model/JobPhotoDO.java new file mode 100644 index 0000000..5bfc1dd --- /dev/null +++ a/src/main/java/com/laowu/model/JobPhotoDO.java @@ -0,0 +1,39 @@ +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; + +/** + *

+ * 公司介绍 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/PermissionsDictDO.java a/src/main/java/com/laowu/model/PermissionsDictDO.java new file mode 100644 index 0000000..dd16ea4 --- /dev/null +++ a/src/main/java/com/laowu/model/PermissionsDictDO.java @@ -0,0 +1,41 @@ +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; + +/** + *

+ * 权限表 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/PlaceDictDO.java a/src/main/java/com/laowu/model/PlaceDictDO.java new file mode 100644 index 0000000..67f6ee5 --- /dev/null +++ a/src/main/java/com/laowu/model/PlaceDictDO.java @@ -0,0 +1,49 @@ +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; + +/** + *

+ * 地区字典表 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/PlaceImgsDO.java a/src/main/java/com/laowu/model/PlaceImgsDO.java new file mode 100644 index 0000000..4ca0cb0 --- /dev/null +++ a/src/main/java/com/laowu/model/PlaceImgsDO.java @@ -0,0 +1,33 @@ +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; + +/** + *

+ * 地点图片 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/PositionDictDO.java a/src/main/java/com/laowu/model/PositionDictDO.java new file mode 100644 index 0000000..a3c2c94 --- /dev/null +++ a/src/main/java/com/laowu/model/PositionDictDO.java @@ -0,0 +1,33 @@ +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; + +/** + *

+ * 职位类别 + *

+ * + * @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; +} diff --git b/src/main/java/com/laowu/model/ProvinceDictDO.java a/src/main/java/com/laowu/model/ProvinceDictDO.java new file mode 100644 index 0000000..6e1a079 --- /dev/null +++ a/src/main/java/com/laowu/model/ProvinceDictDO.java @@ -0,0 +1,34 @@ +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; + +/** + *

+ * 城市字典表 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/QuestionContentDO.java a/src/main/java/com/laowu/model/QuestionContentDO.java new file mode 100644 index 0000000..f9ddd5e --- /dev/null +++ a/src/main/java/com/laowu/model/QuestionContentDO.java @@ -0,0 +1,31 @@ +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; + +/** + *

+ * 答疑目录 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/QuestionsDO.java a/src/main/java/com/laowu/model/QuestionsDO.java new file mode 100644 index 0000000..78ef453 --- /dev/null +++ a/src/main/java/com/laowu/model/QuestionsDO.java @@ -0,0 +1,44 @@ +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; + +/** + *

+ * Q && A + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/RecruitDictDO.java a/src/main/java/com/laowu/model/RecruitDictDO.java new file mode 100644 index 0000000..d5f1ee4 --- /dev/null +++ a/src/main/java/com/laowu/model/RecruitDictDO.java @@ -0,0 +1,34 @@ +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; + +/** + *

+ * 招聘类型 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/RoleAdministerMappingDO.java a/src/main/java/com/laowu/model/RoleAdministerMappingDO.java new file mode 100644 index 0000000..a961503 --- /dev/null +++ a/src/main/java/com/laowu/model/RoleAdministerMappingDO.java @@ -0,0 +1,33 @@ +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; + +/** + *

+ * + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/RoleDictDO.java a/src/main/java/com/laowu/model/RoleDictDO.java new file mode 100644 index 0000000..b269b99 --- /dev/null +++ a/src/main/java/com/laowu/model/RoleDictDO.java @@ -0,0 +1,34 @@ +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; + +/** + *

+ * 角色表 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/RolePermissionMappingDO.java a/src/main/java/com/laowu/model/RolePermissionMappingDO.java new file mode 100644 index 0000000..b10a4bf --- /dev/null +++ a/src/main/java/com/laowu/model/RolePermissionMappingDO.java @@ -0,0 +1,39 @@ +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; + +/** + *

+ * 系统用户角色表 + *

+ * + * @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; + + +} diff --git b/src/main/java/com/laowu/model/UserDO.java a/src/main/java/com/laowu/model/UserDO.java new file mode 100644 index 0000000..3a92e2e --- /dev/null +++ a/src/main/java/com/laowu/model/UserDO.java @@ -0,0 +1,158 @@ +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; + +/** + *

+ * 用户表 + *

+ * + * @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; + +} diff --git b/src/main/java/com/laowu/service/AdministerService.java a/src/main/java/com/laowu/service/AdministerService.java new file mode 100644 index 0000000..91d6e72 --- /dev/null +++ a/src/main/java/com/laowu/service/AdministerService.java @@ -0,0 +1,22 @@ +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; + +/** + *

+ * 管理后台用户 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +public interface AdministerService extends IService { + + LoginVO login(AdministerDO administerDO); + + AdministerPermissionVO getPermissions(); + +} diff --git b/src/main/java/com/laowu/service/BusinessDictService.java a/src/main/java/com/laowu/service/BusinessDictService.java new file mode 100644 index 0000000..e8829d5 --- /dev/null +++ a/src/main/java/com/laowu/service/BusinessDictService.java @@ -0,0 +1,25 @@ +package com.laowu.service; + +import com.laowu.model.BusinessDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 经营范围 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +public interface BusinessDictService extends IService { + + String addBusiness(BusinessDictDO businessDictDO); + + String updateBusiness(BusinessDictDO businessDictDO); + + String deleteBusiness(BusinessDictDO businessDictDO); + + List queryBusiness(); +} diff --git b/src/main/java/com/laowu/service/CityDictService.java a/src/main/java/com/laowu/service/CityDictService.java new file mode 100644 index 0000000..15d791d --- /dev/null +++ a/src/main/java/com/laowu/service/CityDictService.java @@ -0,0 +1,16 @@ +package com.laowu.service; + +import com.laowu.model.CityDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 城市字典表 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +public interface CityDictService extends IService { + +} diff --git b/src/main/java/com/laowu/service/CompanyDictService.java a/src/main/java/com/laowu/service/CompanyDictService.java new file mode 100644 index 0000000..9b43162 --- /dev/null +++ a/src/main/java/com/laowu/service/CompanyDictService.java @@ -0,0 +1,30 @@ +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; + +/** + *

+ * 企业管理表 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-16 + */ +public interface CompanyDictService extends IService { + + IPage company(CompanyDTO companyDTO); + + String deleteCompany(CompanyDictDO companyDictDO); + + String addCompany(AddCompanyDTO addCompanyDTO); + + String updateCompany(AddCompanyDTO addCompanyDTO); + + CompanyVO oneCompany(CompanyDictDO companyDictDO); + +} diff --git b/src/main/java/com/laowu/service/CompanyPhotoService.java a/src/main/java/com/laowu/service/CompanyPhotoService.java new file mode 100644 index 0000000..93fe7a3 --- /dev/null +++ a/src/main/java/com/laowu/service/CompanyPhotoService.java @@ -0,0 +1,16 @@ +package com.laowu.service; + +import com.laowu.model.CompanyPhotoDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 企业展示 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-16 + */ +public interface CompanyPhotoService extends IService { + +} diff --git b/src/main/java/com/laowu/service/JobDictService.java a/src/main/java/com/laowu/service/JobDictService.java new file mode 100644 index 0000000..0a4741f --- /dev/null +++ a/src/main/java/com/laowu/service/JobDictService.java @@ -0,0 +1,40 @@ +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; + +/** + *

+ * 职位字典表 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +public interface JobDictService extends IService { + + IPage jobs(JobDTO jobDTO); + + OneJobVO oneJob(JobDictDO jobDictDO); + + List relativeJobs(JobDictDO jobDictDO); + + IPage jobManagement(JobManagementDTO jobManagementDTO); + + String deleteJob(JobDictDO jobDictDO); + + String updateJob(JobDictDO jobDictDO); + + String addJob(JobDictDO jobDictDO); + + String batchAddJob(Integer jobType, MultipartFile multipartFile); +} diff --git b/src/main/java/com/laowu/service/JobPhotoService.java a/src/main/java/com/laowu/service/JobPhotoService.java new file mode 100644 index 0000000..3adcc84 --- /dev/null +++ a/src/main/java/com/laowu/service/JobPhotoService.java @@ -0,0 +1,16 @@ +package com.laowu.service; + +import com.laowu.model.JobPhotoDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 公司介绍 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +public interface JobPhotoService extends IService { + +} diff --git b/src/main/java/com/laowu/service/PermissionsDictService.java a/src/main/java/com/laowu/service/PermissionsDictService.java new file mode 100644 index 0000000..e9f48fa --- /dev/null +++ a/src/main/java/com/laowu/service/PermissionsDictService.java @@ -0,0 +1,16 @@ +package com.laowu.service; + +import com.laowu.model.PermissionsDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 权限表 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +public interface PermissionsDictService extends IService { + +} diff --git b/src/main/java/com/laowu/service/PlaceDictService.java a/src/main/java/com/laowu/service/PlaceDictService.java new file mode 100644 index 0000000..ca6c849 --- /dev/null +++ a/src/main/java/com/laowu/service/PlaceDictService.java @@ -0,0 +1,30 @@ +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; + +/** + *

+ * 地区字典表 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +public interface PlaceDictService extends IService { + + List allPlaces(); + + String deletePlace(PlaceDictDO placeDictDO); + + String addPlace(AddPlaceDTO addPlaceDTO); + + String updatePlace(AddPlaceDTO addPlaceDTO); + + AllPlacesVO onePlace(PlaceDictDO placeDictDO); + +} diff --git b/src/main/java/com/laowu/service/PlaceImgsService.java a/src/main/java/com/laowu/service/PlaceImgsService.java new file mode 100644 index 0000000..0e5a4f3 --- /dev/null +++ a/src/main/java/com/laowu/service/PlaceImgsService.java @@ -0,0 +1,16 @@ +package com.laowu.service; + +import com.laowu.model.PlaceImgsDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 地点图片 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +public interface PlaceImgsService extends IService { + +} diff --git b/src/main/java/com/laowu/service/PositionDictService.java a/src/main/java/com/laowu/service/PositionDictService.java new file mode 100644 index 0000000..1797119 --- /dev/null +++ a/src/main/java/com/laowu/service/PositionDictService.java @@ -0,0 +1,21 @@ +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; + +/** + *

+ * 职位类别 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +public interface PositionDictService extends IService { + + List allPosition(); + +} diff --git b/src/main/java/com/laowu/service/ProvinceDictService.java a/src/main/java/com/laowu/service/ProvinceDictService.java new file mode 100644 index 0000000..bf4562e --- /dev/null +++ a/src/main/java/com/laowu/service/ProvinceDictService.java @@ -0,0 +1,20 @@ +package com.laowu.service; + +import com.laowu.model.ProvinceDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 城市字典表 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +public interface ProvinceDictService extends IService { + + List allProvince(); + +} diff --git b/src/main/java/com/laowu/service/QuestionContentService.java a/src/main/java/com/laowu/service/QuestionContentService.java new file mode 100644 index 0000000..f063c36 --- /dev/null +++ a/src/main/java/com/laowu/service/QuestionContentService.java @@ -0,0 +1,25 @@ +package com.laowu.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.laowu.model.QuestionContentDO; + +import java.util.List; + +/** + *

+ * 答疑目录 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +public interface QuestionContentService extends IService { + + List contents(); + + String addContent(QuestionContentDO questionContentDO); + + String deleteContent(QuestionContentDO questionContentDO); + + String updateContent(QuestionContentDO questionContentDO); +} diff --git b/src/main/java/com/laowu/service/QuestionsService.java a/src/main/java/com/laowu/service/QuestionsService.java new file mode 100644 index 0000000..05e308a --- /dev/null +++ a/src/main/java/com/laowu/service/QuestionsService.java @@ -0,0 +1,25 @@ +package com.laowu.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.laowu.model.QuestionsDO; + +import java.util.List; + +/** + *

+ * Q && A 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +public interface QuestionsService extends IService { + + List contentQuestions(QuestionsDO questionsDO); + + String deleteQuestion(QuestionsDO questionsDO); + + String addQuestion(QuestionsDO questionsDO); + + String updateQuestion(QuestionsDO questionsDO); +} diff --git b/src/main/java/com/laowu/service/RecruitDictService.java a/src/main/java/com/laowu/service/RecruitDictService.java new file mode 100644 index 0000000..647913d --- /dev/null +++ a/src/main/java/com/laowu/service/RecruitDictService.java @@ -0,0 +1,20 @@ +package com.laowu.service; + +import com.laowu.model.RecruitDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 招聘类型 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +public interface RecruitDictService extends IService { + + List types(); + +} diff --git b/src/main/java/com/laowu/service/RoleAdministerMappingService.java a/src/main/java/com/laowu/service/RoleAdministerMappingService.java new file mode 100644 index 0000000..271c8fc --- /dev/null +++ a/src/main/java/com/laowu/service/RoleAdministerMappingService.java @@ -0,0 +1,16 @@ +package com.laowu.service; + +import com.laowu.model.RoleAdministerMappingDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +public interface RoleAdministerMappingService extends IService { + +} diff --git b/src/main/java/com/laowu/service/RoleDictService.java a/src/main/java/com/laowu/service/RoleDictService.java new file mode 100644 index 0000000..f8e4f8f --- /dev/null +++ a/src/main/java/com/laowu/service/RoleDictService.java @@ -0,0 +1,16 @@ +package com.laowu.service; + +import com.laowu.model.RoleDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 角色表 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +public interface RoleDictService extends IService { + +} diff --git b/src/main/java/com/laowu/service/RolePermissionMappingService.java a/src/main/java/com/laowu/service/RolePermissionMappingService.java new file mode 100644 index 0000000..ed1ccb1 --- /dev/null +++ a/src/main/java/com/laowu/service/RolePermissionMappingService.java @@ -0,0 +1,16 @@ +package com.laowu.service; + +import com.laowu.model.RolePermissionMappingDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 系统用户角色表 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +public interface RolePermissionMappingService extends IService { + +} diff --git b/src/main/java/com/laowu/service/UserService.java a/src/main/java/com/laowu/service/UserService.java new file mode 100644 index 0000000..4aaa53e --- /dev/null +++ a/src/main/java/com/laowu/service/UserService.java @@ -0,0 +1,32 @@ +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; + +/** + *

+ * 用户表 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-16 + */ +public interface UserService extends IService { + + 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); + +} diff --git b/src/main/java/com/laowu/service/impl/AdministerServiceImpl.java a/src/main/java/com/laowu/service/impl/AdministerServiceImpl.java new file mode 100644 index 0000000..d10b8b6 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/AdministerServiceImpl.java @@ -0,0 +1,95 @@ +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; + +/** + *

+ * 管理后台用户 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@Service +public class AdministerServiceImpl extends ServiceImpl implements AdministerService { + + @Autowired + private RoleAdministerMappingMapper roleAdministerMappingMapper; + + public LoginVO login(AdministerDO administerDO) { + + LoginVO login = new LoginVO(); + + AdministerDO administerDO1 = this.baseMapper.selectOne(new QueryWrapper() + .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 list = this.baseMapper.getPermissions(administerDO.getId()); + List 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() + .lambda() + .eq(RoleAdministerMappingDO::getAdministerId, administerDO.getId())); + if (null != roleAdministerMappingDO){ + administerPermissionVO.setRole(roleAdministerMappingDO.getRoleId()); + } + return administerPermissionVO; + } +} diff --git b/src/main/java/com/laowu/service/impl/BusinessDictServiceImpl.java a/src/main/java/com/laowu/service/impl/BusinessDictServiceImpl.java new file mode 100644 index 0000000..c209ad2 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/BusinessDictServiceImpl.java @@ -0,0 +1,58 @@ +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; + +/** + *

+ * 经营范围 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@Service +public class BusinessDictServiceImpl extends ServiceImpl implements BusinessDictService { + + public String addBusiness(BusinessDictDO businessDictDO) { + + int count = this.baseMapper.selectCount(new QueryWrapper() + .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() + .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 queryBusiness() { + return this.baseMapper.selectList(null); + } +} diff --git b/src/main/java/com/laowu/service/impl/CityDictServiceImpl.java a/src/main/java/com/laowu/service/impl/CityDictServiceImpl.java new file mode 100644 index 0000000..e142309 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/CityDictServiceImpl.java @@ -0,0 +1,20 @@ +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; + +/** + *

+ * 城市字典表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Service +public class CityDictServiceImpl extends ServiceImpl implements CityDictService { + +} diff --git b/src/main/java/com/laowu/service/impl/CompanyDictServiceImpl.java a/src/main/java/com/laowu/service/impl/CompanyDictServiceImpl.java new file mode 100644 index 0000000..2605f10 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/CompanyDictServiceImpl.java @@ -0,0 +1,118 @@ +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; + +/** + *

+ * 企业管理表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-16 + */ +@Service +public class CompanyDictServiceImpl extends ServiceImpl implements CompanyDictService { + + @Autowired + private CompanyPhotoMapper companyPhotoMapper; + + public IPage company(CompanyDTO companyDTO) { + + Page pager = new Page(companyDTO.getPageNum(), companyDTO.getPageSize()); + + IPage company = this.baseMapper.company(pager, companyDTO.getCompanyName(), companyDTO.getPlaceId(), companyDTO.getBusinessId()); + + List records = company.getRecords(); + for (CompanyVO companyVO : records) { + List companyPhotoDOS = companyPhotoMapper.selectList(new QueryWrapper() + .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() + .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 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 companyPhotoDOS = addCompanyDTO.getCompanyPhotoDOS(); + + if (companyPhotoDOS.size() > 0) { + + companyPhotoMapper.delete(new QueryWrapper() + .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 companyPhotoDOS = companyPhotoMapper.selectList(new QueryWrapper() + .lambda() + .eq(CompanyPhotoDO::getCompanyId, companyDictDO1.getId())); + companyVO.setCompanyPhotoDOS(companyPhotoDOS); + + return companyVO; + } + + +} diff --git b/src/main/java/com/laowu/service/impl/CompanyPhotoServiceImpl.java a/src/main/java/com/laowu/service/impl/CompanyPhotoServiceImpl.java new file mode 100644 index 0000000..1212645 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/CompanyPhotoServiceImpl.java @@ -0,0 +1,20 @@ +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; + +/** + *

+ * 企业展示 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-16 + */ +@Service +public class CompanyPhotoServiceImpl extends ServiceImpl implements CompanyPhotoService { + +} diff --git b/src/main/java/com/laowu/service/impl/JobDictServiceImpl.java a/src/main/java/com/laowu/service/impl/JobDictServiceImpl.java new file mode 100644 index 0000000..7c100a7 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/JobDictServiceImpl.java @@ -0,0 +1,127 @@ +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; + +/** + *

+ * 职位字典表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Service +public class JobDictServiceImpl extends ServiceImpl implements JobDictService { + + @Autowired + private JobPhotoMapper jobPhotoMapper; + + @Autowired + private PositionDictMapper positionDictMapper; + + public IPage 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 jobPhotoDOS = jobPhotoMapper.selectList(new QueryWrapper() + .lambda() + .eq(JobPhotoDO::getJobId, jobDictDO.getId())); + oneJob.setJobPhotoDOS(jobPhotoDOS); + return oneJob; + } + + public List relativeJobs(JobDictDO jobDictDO) { + return this.baseMapper.relativeJobs(jobDictDO.getPositionId()); + } + + public IPage 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 jobDictDOS = this.baseMapper.selectList(new QueryWrapper() + .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); + + } + +} diff --git b/src/main/java/com/laowu/service/impl/JobPhotoServiceImpl.java a/src/main/java/com/laowu/service/impl/JobPhotoServiceImpl.java new file mode 100644 index 0000000..cceaf14 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/JobPhotoServiceImpl.java @@ -0,0 +1,20 @@ +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; + +/** + *

+ * 公司介绍 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Service +public class JobPhotoServiceImpl extends ServiceImpl implements JobPhotoService { + +} diff --git b/src/main/java/com/laowu/service/impl/PermissionsDictServiceImpl.java a/src/main/java/com/laowu/service/impl/PermissionsDictServiceImpl.java new file mode 100644 index 0000000..652ad5d --- /dev/null +++ a/src/main/java/com/laowu/service/impl/PermissionsDictServiceImpl.java @@ -0,0 +1,20 @@ +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; + +/** + *

+ * 权限表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@Service +public class PermissionsDictServiceImpl extends ServiceImpl implements PermissionsDictService { + +} diff --git b/src/main/java/com/laowu/service/impl/PlaceDictServiceImpl.java a/src/main/java/com/laowu/service/impl/PlaceDictServiceImpl.java new file mode 100644 index 0000000..8010e2d --- /dev/null +++ a/src/main/java/com/laowu/service/impl/PlaceDictServiceImpl.java @@ -0,0 +1,140 @@ +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; + +/** + *

+ * 地区字典表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Service +public class PlaceDictServiceImpl extends ServiceImpl implements PlaceDictService { + + @Autowired + private PlaceImgsMapper placeImgsMapper; + + @Autowired + private CityDictMapper cityDictMapper; + + public List allPlaces() { + + List allPlacesVOS = new ArrayList(); + + List placeDictDOS = this.baseMapper.selectList(null); + + for (PlaceDictDO placeDictDO : placeDictDOS) { + + AllPlacesVO allPlacesVO = new AllPlacesVO(); + BeanUtils.copyProperties(placeDictDO, allPlacesVO); + + List placeImgsDOS = placeImgsMapper.selectList(new QueryWrapper() + .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() + .lambda() + .eq(PlaceImgsDO::getPlaceId, placeDictDO.getId())); + + return ConstantUtils.DELETE_SUCCESS; + } + + public String addPlace(AddPlaceDTO addPlaceDTO) { + + int count = this.baseMapper.selectCount(new QueryWrapper() + .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 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() + .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 placeImgsDOS = addPlaceDTO.getPlaceImgsDOS(); + if (placeImgsDOS.size() > 0) { + placeImgsMapper.delete(new QueryWrapper() + .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 placeImgsDOS = placeImgsMapper.selectList(new QueryWrapper() + .lambda() + .eq(PlaceImgsDO::getPlaceId, placeDictDO1.getId())); + allPlacesVO.setPlaceImgsDOS(placeImgsDOS); + + return null; + } + + +} diff --git b/src/main/java/com/laowu/service/impl/PlaceImgsServiceImpl.java a/src/main/java/com/laowu/service/impl/PlaceImgsServiceImpl.java new file mode 100644 index 0000000..b4361d1 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/PlaceImgsServiceImpl.java @@ -0,0 +1,20 @@ +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; + +/** + *

+ * 地点图片 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Service +public class PlaceImgsServiceImpl extends ServiceImpl implements PlaceImgsService { + +} diff --git b/src/main/java/com/laowu/service/impl/PositionDictServiceImpl.java a/src/main/java/com/laowu/service/impl/PositionDictServiceImpl.java new file mode 100644 index 0000000..ce0bb93 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/PositionDictServiceImpl.java @@ -0,0 +1,47 @@ +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; + +/** + *

+ * 职位类别 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Service +public class PositionDictServiceImpl extends ServiceImpl implements PositionDictService { + + public List allPosition() { + + List allPosition = new ArrayList<>(); + + List positionDictDOS = this.baseMapper.selectList(new QueryWrapper() + .lambda() + .isNull(PositionDictDO::getParentId)); + for (PositionDictDO positionDictDO : positionDictDOS) { + + AllPositionVO allPositionVO = new AllPositionVO(); + BeanUtils.copyProperties(positionDictDO,allPositionVO); + + List positionDictDOS1 = this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(PositionDictDO::getParentId,positionDictDO.getId())); + allPositionVO.setPositionDictDOS(positionDictDOS1); + allPosition.add(allPositionVO); + } + return allPosition; + } + +} diff --git b/src/main/java/com/laowu/service/impl/ProvinceDictServiceImpl.java a/src/main/java/com/laowu/service/impl/ProvinceDictServiceImpl.java new file mode 100644 index 0000000..8c5b415 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/ProvinceDictServiceImpl.java @@ -0,0 +1,26 @@ +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; + +/** + *

+ * 城市字典表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Service +public class ProvinceDictServiceImpl extends ServiceImpl implements ProvinceDictService { + + public List allProvince() { + return this.baseMapper.selectList(null); + } + +} diff --git b/src/main/java/com/laowu/service/impl/QuestionContentServiceImpl.java a/src/main/java/com/laowu/service/impl/QuestionContentServiceImpl.java new file mode 100644 index 0000000..2e94254 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/QuestionContentServiceImpl.java @@ -0,0 +1,72 @@ +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; + +/** + *

+ * 答疑目录 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Service +public class QuestionContentServiceImpl extends ServiceImpl implements QuestionContentService { + + @Autowired + private QuestionsMapper questionsMapper; + + public List contents() { + return this.baseMapper.selectList(null); + } + + @Transactional(rollbackFor = Exception.class) + public String addContent(QuestionContentDO questionContentDO) { + + int count = this.baseMapper.selectCount(new QueryWrapper() + .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() + .lambda() + .eq(QuestionsDO::getContentId, questionContentDO.getId())); + + return ConstantUtils.DELETE_SUCCESS; + } + + public String updateContent(QuestionContentDO questionContentDO){ + this.baseMapper.updateById(questionContentDO); + return ConstantUtils.SUCCESS_UPDATE; + } + +} diff --git b/src/main/java/com/laowu/service/impl/QuestionsServiceImpl.java a/src/main/java/com/laowu/service/impl/QuestionsServiceImpl.java new file mode 100644 index 0000000..4a6e887 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/QuestionsServiceImpl.java @@ -0,0 +1,49 @@ +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; + +/** + *

+ * Q && A 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Service +public class QuestionsServiceImpl extends ServiceImpl implements QuestionsService { + + public List contentQuestions(QuestionsDO questionsDO) { + return this.baseMapper.selectList(new QueryWrapper() + .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; + } + + +} diff --git b/src/main/java/com/laowu/service/impl/RecruitDictServiceImpl.java a/src/main/java/com/laowu/service/impl/RecruitDictServiceImpl.java new file mode 100644 index 0000000..cf173a5 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/RecruitDictServiceImpl.java @@ -0,0 +1,26 @@ +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; + +/** + *

+ * 招聘类型 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-15 + */ +@Service +public class RecruitDictServiceImpl extends ServiceImpl implements RecruitDictService { + + public List types() { + return this.baseMapper.selectList(null); + } + +} diff --git b/src/main/java/com/laowu/service/impl/RoleAdministerMappingServiceImpl.java a/src/main/java/com/laowu/service/impl/RoleAdministerMappingServiceImpl.java new file mode 100644 index 0000000..ec2a67a --- /dev/null +++ a/src/main/java/com/laowu/service/impl/RoleAdministerMappingServiceImpl.java @@ -0,0 +1,20 @@ +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; + +/** + *

+ * 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@Service +public class RoleAdministerMappingServiceImpl extends ServiceImpl implements RoleAdministerMappingService { + +} diff --git b/src/main/java/com/laowu/service/impl/RoleDictServiceImpl.java a/src/main/java/com/laowu/service/impl/RoleDictServiceImpl.java new file mode 100644 index 0000000..bc33c13 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/RoleDictServiceImpl.java @@ -0,0 +1,20 @@ +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; + +/** + *

+ * 角色表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@Service +public class RoleDictServiceImpl extends ServiceImpl implements RoleDictService { + +} diff --git b/src/main/java/com/laowu/service/impl/RolePermissionMappingServiceImpl.java a/src/main/java/com/laowu/service/impl/RolePermissionMappingServiceImpl.java new file mode 100644 index 0000000..3b1893a --- /dev/null +++ a/src/main/java/com/laowu/service/impl/RolePermissionMappingServiceImpl.java @@ -0,0 +1,20 @@ +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; + +/** + *

+ * 系统用户角色表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-20 + */ +@Service +public class RolePermissionMappingServiceImpl extends ServiceImpl implements RolePermissionMappingService { + +} diff --git b/src/main/java/com/laowu/service/impl/UserServiceImpl.java a/src/main/java/com/laowu/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..b765ff9 --- /dev/null +++ a/src/main/java/com/laowu/service/impl/UserServiceImpl.java @@ -0,0 +1,121 @@ +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; + +/** + *

+ * 用户表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-16 + */ +@Service +public class UserServiceImpl extends ServiceImpl implements UserService { + + public IPage users(UsersDTO usersDTO) { + Page pager = new Page(usersDTO.getPageNum(), usersDTO.getPageSize()); + IPage 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() + .lambda() + .eq(UserDO::getTelephone, userDO.getTelephone())); + + if (count > 0) { + throw new HttpException(40001); + } + + int count1 = this.baseMapper.selectCount(new QueryWrapper() + .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() + .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() + .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() + .lambda() + .eq(UserDO::getTelephone, s.getTelephone())); + if (cnt > 0) { + throw new HttpException(40001); + } + + int cnt1 = this.baseMapper.selectCount(new QueryWrapper() + .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()); + } +} diff --git b/src/main/java/com/laowu/util/BaseModel.java a/src/main/java/com/laowu/util/BaseModel.java new file mode 100644 index 0000000..37026c9 --- /dev/null +++ a/src/main/java/com/laowu/util/BaseModel.java @@ -0,0 +1,35 @@ +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; +} diff --git b/src/main/java/com/laowu/util/CodeGenerator.java a/src/main/java/com/laowu/util/CodeGenerator.java new file mode 100644 index 0000000..c2325ae --- /dev/null +++ a/src/main/java/com/laowu/util/CodeGenerator.java @@ -0,0 +1,124 @@ +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 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 diff --git b/src/main/java/com/laowu/util/ConstantUtils.java a/src/main/java/com/laowu/util/ConstantUtils.java new file mode 100644 index 0000000..5a8620e --- /dev/null +++ a/src/main/java/com/laowu/util/ConstantUtils.java @@ -0,0 +1,39 @@ +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"; + + +} diff --git b/src/main/java/com/laowu/util/ExcelColumnUtil.java a/src/main/java/com/laowu/util/ExcelColumnUtil.java new file mode 100644 index 0000000..02074af --- /dev/null +++ a/src/main/java/com/laowu/util/ExcelColumnUtil.java @@ -0,0 +1,22 @@ +package com.laowu.util; + + +import java.lang.annotation.*; + +/** + *

+ * excel 字段 + *

+ * + * @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; +} diff --git b/src/main/java/com/laowu/util/ExcelUtil.java a/src/main/java/com/laowu/util/ExcelUtil.java new file mode 100644 index 0000000..253fea0 --- /dev/null +++ a/src/main/java/com/laowu/util/ExcelUtil.java @@ -0,0 +1,503 @@ +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 + * @return + */ + public static List readExcel(String path, Class cls, MultipartFile file) { + String fileName = file.getOriginalFilename(); + if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) { + log.info("上传文件格式不正确"); +// throw new HTTPException(10022); + } + + List 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> classMap = new HashMap<>(); + List 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> 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 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 + * @return + */ + public static List readExcelWithoutTitle(String path, Class cls, MultipartFile file) { + String fileName = file.getOriginalFilename(); + if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) { + log.info("上传文件格式不正确"); +// throw new HTTPException(10022); + } + + List 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> classMap = new HashMap<>(); + List 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> 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 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 + */ + public static void writeExcel(List list, Class cls) { + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletResponse response = servletRequestAttributes.getResponse(); + Field[] fields = cls.getDeclaredFields(); + List 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 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); + } + } +} diff --git b/src/main/java/com/laowu/util/JwtUtil.java a/src/main/java/com/laowu/util/JwtUtil.java new file mode 100644 index 0000000..31abf2e --- /dev/null +++ a/src/main/java/com/laowu/util/JwtUtil.java @@ -0,0 +1,96 @@ +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; + +/** + *

+ * Token工具 + *

+ * + * @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 getClaims(String token) { + Algorithm algorithm = Algorithm.HMAC256(SECRET); + JWTVerifier verifier = JWT.require(algorithm).build(); + Map 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; + } + } +} diff --git b/src/main/java/com/laowu/util/Localstorage.java a/src/main/java/com/laowu/util/Localstorage.java new file mode 100644 index 0000000..3bee193 --- /dev/null +++ a/src/main/java/com/laowu/util/Localstorage.java @@ -0,0 +1,21 @@ +package com.laowu.util; + +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class Localstorage { + + private static final ThreadLocal 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(); + } +} diff --git b/src/main/java/com/laowu/util/MathUtil.java a/src/main/java/com/laowu/util/MathUtil.java new file mode 100644 index 0000000..a2a4f8d --- /dev/null +++ a/src/main/java/com/laowu/util/MathUtil.java @@ -0,0 +1,179 @@ +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; + } +} diff --git b/src/main/java/com/laowu/util/ResponseData.java a/src/main/java/com/laowu/util/ResponseData.java new file mode 100644 index 0000000..4860b78 --- /dev/null +++ a/src/main/java/com/laowu/util/ResponseData.java @@ -0,0 +1,54 @@ +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 ResponseVO generateCreatedResponse(int code) { + return (ResponseVO) ResponseVO.builder() + .code(code) + .message(RemoteProperties.getMessage(code)) + .build(); + } + + public static ResponseVO generateCreatedResponse(int code, String message) { + return (ResponseVO) ResponseVO.builder() + .code(code) + .message(message) + .build(); + } + + public static ResponseVO generateCreatedResponse(int code, T data) { + return (ResponseVO) ResponseVO.builder() + .code(code) + .message(RemoteProperties.getMessage(code)) + .data(data) + .build(); + } + + public static ResponseVO generateCreatedResponse(int code, String message, T data) { + return (ResponseVO) ResponseVO.builder() + .code(code) + .message(message) + .data(data) + .build(); + } + + public static ResponseVO generateCreatedResponse(int code, String message, String path) { + return (ResponseVO) ResponseVO.builder() + .code(code) + .message(message) + .path(path) + .build(); + } +} \ No newline at end of file diff --git b/src/main/java/com/laowu/util/ResponseVO.java a/src/main/java/com/laowu/util/ResponseVO.java new file mode 100644 index 0000000..b3309af --- /dev/null +++ a/src/main/java/com/laowu/util/ResponseVO.java @@ -0,0 +1,21 @@ +package com.laowu.util; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ResponseVO { + + private Integer code; + + private String message; + + private T data; + + private String path; +} \ No newline at end of file diff --git b/src/main/java/com/laowu/vo/admin/AdministerPermissionVO.java a/src/main/java/com/laowu/vo/admin/AdministerPermissionVO.java new file mode 100644 index 0000000..5dd99b1 --- /dev/null +++ a/src/main/java/com/laowu/vo/admin/AdministerPermissionVO.java @@ -0,0 +1,21 @@ +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 permissions; +} diff --git b/src/main/java/com/laowu/vo/admin/LoginVO.java a/src/main/java/com/laowu/vo/admin/LoginVO.java new file mode 100644 index 0000000..b9c8ed3 --- /dev/null +++ a/src/main/java/com/laowu/vo/admin/LoginVO.java @@ -0,0 +1,14 @@ +package com.laowu.vo.admin; + +import lombok.Data; + +@Data +public class LoginVO { + +// private Long id; +// +// private String account; +// + private String token; + +} diff --git b/src/main/java/com/laowu/vo/admin/PermissionsVO.java a/src/main/java/com/laowu/vo/admin/PermissionsVO.java new file mode 100644 index 0000000..b98e50b --- /dev/null +++ a/src/main/java/com/laowu/vo/admin/PermissionsVO.java @@ -0,0 +1,17 @@ +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 children; +} diff --git b/src/main/java/com/laowu/vo/company/CompanyVO.java a/src/main/java/com/laowu/vo/company/CompanyVO.java new file mode 100644 index 0000000..be1d82d --- /dev/null +++ a/src/main/java/com/laowu/vo/company/CompanyVO.java @@ -0,0 +1,33 @@ +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 companyPhotoDOS; + +} diff --git b/src/main/java/com/laowu/vo/job/AllPositionVO.java a/src/main/java/com/laowu/vo/job/AllPositionVO.java new file mode 100644 index 0000000..546e7fe --- /dev/null +++ a/src/main/java/com/laowu/vo/job/AllPositionVO.java @@ -0,0 +1,13 @@ +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 positionDictDOS; + +} diff --git b/src/main/java/com/laowu/vo/job/JobManagementVO.java a/src/main/java/com/laowu/vo/job/JobManagementVO.java new file mode 100644 index 0000000..34a6748 --- /dev/null +++ a/src/main/java/com/laowu/vo/job/JobManagementVO.java @@ -0,0 +1,36 @@ +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; + +} diff --git b/src/main/java/com/laowu/vo/job/JobVO.java a/src/main/java/com/laowu/vo/job/JobVO.java new file mode 100644 index 0000000..7db29e0 --- /dev/null +++ a/src/main/java/com/laowu/vo/job/JobVO.java @@ -0,0 +1,30 @@ +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; + +} diff --git b/src/main/java/com/laowu/vo/job/OneJobVO.java a/src/main/java/com/laowu/vo/job/OneJobVO.java new file mode 100644 index 0000000..d801492 --- /dev/null +++ a/src/main/java/com/laowu/vo/job/OneJobVO.java @@ -0,0 +1,42 @@ +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 jobPhotoDOS; +} diff --git b/src/main/java/com/laowu/vo/place/AllPlacesVO.java a/src/main/java/com/laowu/vo/place/AllPlacesVO.java new file mode 100644 index 0000000..5fd775e --- /dev/null +++ a/src/main/java/com/laowu/vo/place/AllPlacesVO.java @@ -0,0 +1,25 @@ +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 placeImgsDOS; + +} diff --git b/src/main/java/com/laowu/vo/user/UsersVO.java a/src/main/java/com/laowu/vo/user/UsersVO.java new file mode 100644 index 0000000..13d0f48 --- /dev/null +++ a/src/main/java/com/laowu/vo/user/UsersVO.java @@ -0,0 +1,9 @@ +package com.laowu.vo.user; + +import com.laowu.model.UserDO; +import lombok.Data; + +@Data +public class UsersVO extends UserDO { + +} diff --git b/src/main/resources/application-dev.properties a/src/main/resources/application-dev.properties new file mode 100644 index 0000000..ee85a4f --- /dev/null +++ a/src/main/resources/application-dev.properties @@ -0,0 +1,36 @@ +# 本地环境配置 +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 diff --git b/src/main/resources/application-prod.properties a/src/main/resources/application-prod.properties new file mode 100644 index 0000000..7a18458 --- /dev/null +++ a/src/main/resources/application-prod.properties @@ -0,0 +1,36 @@ +# 生产环境配置 +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 diff --git b/src/main/resources/application.properties a/src/main/resources/application.properties new file mode 100644 index 0000000..e37d7d8 --- /dev/null +++ a/src/main/resources/application.properties @@ -0,0 +1,72 @@ +# +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 diff --git b/src/main/resources/code.properties a/src/main/resources/code.properties new file mode 100644 index 0000000..114e5aa --- /dev/null +++ a/src/main/resources/code.properties @@ -0,0 +1,14 @@ +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]=þӪΧѴ + diff --git b/src/main/resources/logback-spring.xml a/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..a9f66a4 --- /dev/null +++ a/src/main/resources/logback-spring.xml @@ -0,0 +1,66 @@ + + + + + ${APP_NAME} + + + + + info + + + %d [%t] %5p %c:%L - %m%n + UTF-8 + + + + ${LOG_PATH}${APP_NAME}-info.log + + %d [%t] %5p %c:%L - %m%n + + + + 100MB + + ${LOG_PATH}${APP_NAME}/info/%d{yyyy-MM-dd}-%i.log.gz + + 30 + + + + ${LOG_PATH}${APP_NAME}-error.log + + error + + + %d [%t] %5p %c:%L - %m%n + + + + 256MB + + ${LOG_PATH}${APP_NAME}/error/%d{yyyy-MM-dd}-%i.log.gz + + 180 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git b/src/main/resources/mapper/AdministerMapper.xml a/src/main/resources/mapper/AdministerMapper.xml new file mode 100644 index 0000000..a8b7891 --- /dev/null +++ a/src/main/resources/mapper/AdministerMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, account, password + + + + + diff --git b/src/main/resources/mapper/BusinessDictMapper.xml a/src/main/resources/mapper/BusinessDictMapper.xml new file mode 100644 index 0000000..74adccd --- /dev/null +++ a/src/main/resources/mapper/BusinessDictMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, business + + + diff --git b/src/main/resources/mapper/CityDictMapper.xml a/src/main/resources/mapper/CityDictMapper.xml new file mode 100644 index 0000000..378126f --- /dev/null +++ a/src/main/resources/mapper/CityDictMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, province_id, city + + + + diff --git b/src/main/resources/mapper/CompanyDictMapper.xml a/src/main/resources/mapper/CompanyDictMapper.xml new file mode 100644 index 0000000..ba670ff --- /dev/null +++ a/src/main/resources/mapper/CompanyDictMapper.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, company_name, place_id, position_id, company_code, account, desc + + + + + diff --git b/src/main/resources/mapper/CompanyPhotoMapper.xml a/src/main/resources/mapper/CompanyPhotoMapper.xml new file mode 100644 index 0000000..5c60251 --- /dev/null +++ a/src/main/resources/mapper/CompanyPhotoMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, company_id, photo + + + diff --git b/src/main/resources/mapper/JobDictMapper.xml a/src/main/resources/mapper/JobDictMapper.xml new file mode 100644 index 0000000..e5bfad1 --- /dev/null +++ a/src/main/resources/mapper/JobDictMapper.xml @@ -0,0 +1,176 @@ + + + + + + + create_date, + update_date, + delete_date, + id, job_name, enterprise_name, province, city, recruit_id, start_salary, end_salary + + + + + + + + + + + diff --git b/src/main/resources/mapper/JobPhotoMapper.xml a/src/main/resources/mapper/JobPhotoMapper.xml new file mode 100644 index 0000000..8776f62 --- /dev/null +++ a/src/main/resources/mapper/JobPhotoMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, company_photos + + + diff --git b/src/main/resources/mapper/PermissionsDictMapper.xml a/src/main/resources/mapper/PermissionsDictMapper.xml new file mode 100644 index 0000000..ea9bb32 --- /dev/null +++ a/src/main/resources/mapper/PermissionsDictMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, parent_id, name, children + + + diff --git b/src/main/resources/mapper/PlaceDictMapper.xml a/src/main/resources/mapper/PlaceDictMapper.xml new file mode 100644 index 0000000..10942f3 --- /dev/null +++ a/src/main/resources/mapper/PlaceDictMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, place, second_title, desc, city_id + + + diff --git b/src/main/resources/mapper/PlaceImgsMapper.xml a/src/main/resources/mapper/PlaceImgsMapper.xml new file mode 100644 index 0000000..f99ae8d --- /dev/null +++ a/src/main/resources/mapper/PlaceImgsMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, place_id, img + + + diff --git b/src/main/resources/mapper/PositionDictMapper.xml a/src/main/resources/mapper/PositionDictMapper.xml new file mode 100644 index 0000000..00abbb1 --- /dev/null +++ a/src/main/resources/mapper/PositionDictMapper.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, position_type, parent_id + + + + + + diff --git b/src/main/resources/mapper/ProvinceDictMapper.xml a/src/main/resources/mapper/ProvinceDictMapper.xml new file mode 100644 index 0000000..ed02318 --- /dev/null +++ a/src/main/resources/mapper/ProvinceDictMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, province + + + diff --git b/src/main/resources/mapper/QuestionContentMapper.xml a/src/main/resources/mapper/QuestionContentMapper.xml new file mode 100644 index 0000000..a48571e --- /dev/null +++ a/src/main/resources/mapper/QuestionContentMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, content + + + diff --git b/src/main/resources/mapper/QuestionsMapper.xml a/src/main/resources/mapper/QuestionsMapper.xml new file mode 100644 index 0000000..2f45e55 --- /dev/null +++ a/src/main/resources/mapper/QuestionsMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, question, answer + + + diff --git b/src/main/resources/mapper/RecruitDictMapper.xml a/src/main/resources/mapper/RecruitDictMapper.xml new file mode 100644 index 0000000..a756e11 --- /dev/null +++ a/src/main/resources/mapper/RecruitDictMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, recruit_type + + + diff --git b/src/main/resources/mapper/RoleAdministerMappingMapper.xml a/src/main/resources/mapper/RoleAdministerMappingMapper.xml new file mode 100644 index 0000000..803d87d --- /dev/null +++ a/src/main/resources/mapper/RoleAdministerMappingMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, administer_id, role_id + + + diff --git b/src/main/resources/mapper/RoleDictMapper.xml a/src/main/resources/mapper/RoleDictMapper.xml new file mode 100644 index 0000000..74b3b00 --- /dev/null +++ a/src/main/resources/mapper/RoleDictMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, role + + + diff --git b/src/main/resources/mapper/RolePermissionMappingMapper.xml a/src/main/resources/mapper/RolePermissionMappingMapper.xml new file mode 100644 index 0000000..68ec6b5 --- /dev/null +++ a/src/main/resources/mapper/RolePermissionMappingMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, role_id, permission_id + + + diff --git b/src/main/resources/mapper/UserMapper.xml a/src/main/resources/mapper/UserMapper.xml new file mode 100644 index 0000000..5478916 --- /dev/null +++ a/src/main/resources/mapper/UserMapper.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + diff --git b/src/main/resources/mybatis-plus.properties a/src/main/resources/mybatis-plus.properties new file mode 100644 index 0000000..44205ee --- /dev/null +++ a/src/main/resources/mybatis-plus.properties @@ -0,0 +1,12 @@ +# 此处为本项目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 diff --git b/src/main/resources/mybatis.xml a/src/main/resources/mybatis.xml new file mode 100644 index 0000000..f4495b4 --- /dev/null +++ a/src/main/resources/mybatis.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git b/src/main/resources/templates/controller.java.ftl a/src/main/resources/templates/controller.java.ftl new file mode 100644 index 0000000..28e7070 --- /dev/null +++ a/src/main/resources/templates/controller.java.ftl @@ -0,0 +1,41 @@ +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 superControllerClassPackage??> +import ${superControllerClassPackage}; + +import io.swagger.annotations.Api; + +/** + *

+ * ${table.comment!} 前端控制器 + *

+ * + * @author ${author} + * @since ${date} + */ +<#if restControllerStyle> +@RestController +@Api(tags = "${table.comment!}") +<#else> +@Controller + +@RequestMapping("<#if package.ModuleName?? && package.ModuleName != "">/${package.ModuleName}/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}") +<#if kotlin> +class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}() +<#else> +<#if superControllerClass??> +public class ${table.controllerName} extends ${superControllerClass} { +<#else> +public class ${table.controllerName} { + + +} + diff --git b/src/main/resources/templates/entity.java.ftl a/src/main/resources/templates/entity.java.ftl new file mode 100644 index 0000000..c63bcc4 --- /dev/null +++ a/src/main/resources/templates/entity.java.ftl @@ -0,0 +1,156 @@ +package ${package.Entity}; + +<#list table.importPackages as pkg> +import ${pkg}; + +<#if swagger2> +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +<#if entityLombokModel> +import lombok.Data; +import lombok.EqualsAndHashCode; + <#if chainModel> +import lombok.experimental.Accessors; + + + +/** + *

+ * ${table.comment!} + *

+ * + * @author ${author} + * @since ${date} + */ +<#if entityLombokModel> +@Data + <#if superEntityClass??> +@EqualsAndHashCode(callSuper = true) + <#else> +@EqualsAndHashCode(callSuper = false) + + <#if chainModel> +@Accessors(chain = true) + + +<#if table.convert> +@TableName("${table.name}") + +<#if swagger2> +@ApiModel(value="${entity}对象", description="${table.comment!}") + +<#if superEntityClass??> +public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}> { +<#elseif activeRecord> +public class ${entity} extends Model<${entity}> { +<#else> +public class ${entity} implements Serializable { + + +<#if entitySerialVersionUID> + private static final long serialVersionUID = 1L; + +<#-- ---------- BEGIN 字段循环遍历 ----------> +<#list table.fields as field> + <#if field.keyFlag> + <#assign keyPropertyName="${field.propertyName}"/> + + + <#if field.comment!?length gt 0> + <#if swagger2> + @ApiModelProperty(value = "${field.comment}") + <#else> + /** + * ${field.comment} + */ + + + <#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}") + + <#-- 普通字段 --> + <#elseif field.fill??> + <#-- ----- 存在字段填充设置 -----> + <#if field.convert> + @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill}) + <#else> + @TableField(fill = FieldFill.${field.fill}) + + <#elseif field.convert> + @TableField("${field.annotationColumnName}") + + <#-- 乐观锁注解 --> + <#if (versionFieldName!"") == field.name> + @Version + + <#-- 逻辑删除注解 --> + <#if (logicDeleteFieldName!"") == field.name> + @TableLogic + + private ${field.propertyType} ${field.propertyName}; + +<#------------ END 字段循环遍历 ----------> + +<#if !entityLombokModel> + <#list table.fields as field> + <#if field.propertyType == "boolean"> + <#assign getprefix="is"/> + <#else> + <#assign getprefix="get"/> + + 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}) { + + this.${field.propertyName} = ${field.propertyName}; + <#if chainModel> + return this; + + } + + + +<#if entityColumnConstant> + <#list table.fields as field> + public static final String ${field.name?upper_case} = "${field.name}"; + + + +<#if activeRecord> + @Override + protected Serializable pkVal() { + <#if keyPropertyName??> + return this.${keyPropertyName}; + <#else> + return null; + + } + + +<#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} + + + + "}"; + } + +} diff --git b/src/main/resources/templates/mapper.java.ftl a/src/main/resources/templates/mapper.java.ftl new file mode 100644 index 0000000..be08c59 --- /dev/null +++ a/src/main/resources/templates/mapper.java.ftl @@ -0,0 +1,22 @@ +package ${package.Mapper}; + +import ${package.Entity}.${entity}; +import ${superMapperClassPackage}; +import org.springframework.stereotype.Repository; + +/** + *

+ * ${table.comment!} Mapper 接口 + *

+ * + * @author ${author} + * @since ${date} + */ +<#if kotlin> +interface ${table.mapperName} : ${superMapperClass}<${entity}> +<#else> + @Repository +public interface ${table.mapperName} extends ${superMapperClass}<${entity}> { + +} + diff --git b/src/main/resources/templates/mapper.xml.ftl a/src/main/resources/templates/mapper.xml.ftl new file mode 100644 index 0000000..04c2359 --- /dev/null +++ a/src/main/resources/templates/mapper.xml.ftl @@ -0,0 +1,39 @@ + + + + +<#if enableCache> + + + + +<#if baseResultMap> + + +<#list table.fields as field> +<#if field.keyFlag><#--生成主键排在第一位--> + + + +<#list table.commonFields as field><#--生成公共字段 --> + + +<#list table.fields as field> +<#if !field.keyFlag><#--生成普通字段 --> + + + + + + +<#if baseColumnList> + + +<#list table.commonFields as field> + ${field.columnName}, + + ${table.fieldNames} + + + + diff --git b/src/main/resources/templates/service.java.ftl a/src/main/resources/templates/service.java.ftl new file mode 100644 index 0000000..e3232f3 --- /dev/null +++ a/src/main/resources/templates/service.java.ftl @@ -0,0 +1,20 @@ +package ${package.Service}; + +import ${package.Entity}.${entity}; +import ${superServiceClassPackage}; + +/** + *

+ * ${table.comment!} 服务类 + *

+ * + * @author ${author} + * @since ${date} + */ +<#if kotlin> +interface ${table.serviceName} : ${superServiceClass}<${entity}> +<#else> +public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { + +} + diff --git b/src/main/resources/templates/serviceImpl.java.ftl a/src/main/resources/templates/serviceImpl.java.ftl new file mode 100644 index 0000000..aeebd14 --- /dev/null +++ a/src/main/resources/templates/serviceImpl.java.ftl @@ -0,0 +1,26 @@ +package ${package.ServiceImpl}; + +import ${package.Entity}.${entity}; +import ${package.Mapper}.${table.mapperName}; +import ${package.Service}.${table.serviceName}; +import ${superServiceImplClassPackage}; +import org.springframework.stereotype.Service; + +/** + *

+ * ${table.comment!} 服务实现类 + *

+ * + * @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} { + +} +