commit 40fe74af2587c4ea07c8c9b0510403e41d8a6acb Author: zhangye <654600784@qq.com> Date: Sat Apr 9 09:46:36 2022 +0800 新建项目 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..c1dd12f Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..b7cb93e --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..841f63a --- /dev/null +++ b/mvnw @@ -0,0 +1,331 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ]; then + + if [ -f /usr/local/etc/mavenrc ]; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ]; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ]; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false +darwin=false +mingw=false +case "$(uname)" in +CYGWIN*) cygwin=true ;; +MINGW*) mingw=true ;; +Darwin*) + darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="$(/usr/libexec/java_home)" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ]; then + if [ -r /etc/gentoo-release ]; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +if [ -z "$M2_HOME" ]; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ]; do + ls=$(ls -ld "$PRG") + link=$(expr "$ls" : '.*-> \(.*\)$') + if expr "$link" : '/.*' >/dev/null; then + PRG="$link" + else + PRG="$(dirname "$PRG")/$link" + fi + done + + saveddir=$(pwd) + + M2_HOME=$(dirname "$PRG")/.. + + # make it fully qualified + M2_HOME=$(cd "$M2_HOME" && pwd) + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=$(cygpath --unix "$M2_HOME") + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw; then + [ -n "$M2_HOME" ] && + M2_HOME="$( ( + cd "$M2_HOME" + pwd + ))" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="$( ( + cd "$JAVA_HOME" + pwd + ))" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr \"$javaExecutable\" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! $(expr "$readLink" : '\([^ ]*\)') = "no" ]; then + if $darwin; then + javaHome="$(dirname \"$javaExecutable\")" + javaExecutable="$(cd \"$javaHome\" && pwd -P)/javac" + else + javaExecutable="$(readlink -f \"$javaExecutable\")" + fi + javaHome="$(dirname \"$javaExecutable\")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ]; then + if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$( + \unset -f command + \command -v java + )" + fi +fi + +if [ ! -x "$JAVACMD" ]; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ]; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ]; then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ]; do + if [ -d "$wdir"/.mvn ]; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$( + cd "$wdir/.." + pwd + ) + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' <"$1")" + fi +} + +BASE_DIR=$(find_maven_basedir "$(pwd)") +if [ -z "$BASE_DIR" ]; then + exit 1 +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in wrapperUrl) + jarUrl="$value" + break + ;; + esac + done <"$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget >/dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl >/dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=$(cygpath --path --windows "$M2_HOME") + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..1d8ab01 --- /dev/null +++ b/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 a/pom.xml b/pom.xml new file mode 100644 index 0000000..3c603e8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,286 @@ + + + 4.0.0 + + com.ccsens + delivery + 1.0-SNAPSHOT + + + 1.8 + + + org.springframework.boot + spring-boot-starter-parent + 2.1.8.RELEASE + + + + + + + + + + + com.ccsensptos + wechatutil + 1.0-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-starter-amqp + + + com.ccsensptos + cloudutil + + + + + org.aspectj + aspectjweaver + + + + + io.netty + netty-all + 4.1.32.Final + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + org.springframework.boot + spring-boot-starter-cache + + + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + + + com.vaadin.external.google + android-json + + + test + + + org.springframework.boot + spring-boot-starter-actuator + + + + + cn.hutool + hutool-all + 4.1.21 + + + + + org.apache.poi + poi + 3.17 + + + org.apache.poi + poi-ooxml + 3.17 + + + + org.springframework.boot + spring-boot-starter-websocket + + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 1.1.1 + + + + com.github.pagehelper + pagehelper + 4.1.4 + + + + mysql + mysql-connector-java + + + + com.alibaba + druid + 1.1.10 + + + + io.jsonwebtoken + jjwt + 0.7.0 + + + + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + 2.9.0 + + + + + + + org.apache.shiro + shiro-spring + 1.4.0 + + + + org.apache.shiro + shiro-ehcache + 1.4.0 + + + + net.sourceforge.htmlcleaner + htmlcleaner + 2.22 + + + + org.apache.commons + commons-lang3 + 3.8.1 + + + + + + io.springfox + springfox-swagger2 + 2.9.2 + + + + io.springfox + springfox-swagger-ui + 2.9.2 + + + + org.mybatis.generator + mybatis-generator-core + 1.3.7 + + + + + org.beanshell + bsh + 2.0b5 + + + + org.apache.httpcomponents + httpclient + 4.5.1 + + + + org.apache.httpcomponents + httpcore + 4.4.3 + + + + + + + + + com.alibaba + fastjson + 1.2.62 + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.7 + + ${basedir}/src/main/resources/mbg.xml + true + + + + mysql + mysql-connector-java + 5.1.34 + + + + + + \ No newline at end of file diff --git a/src/main/java/com/ccsens/delivery/DeliveryApplication.java b/src/main/java/com/ccsens/delivery/DeliveryApplication.java new file mode 100644 index 0000000..037e399 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/DeliveryApplication.java @@ -0,0 +1,23 @@ +package com.ccsens.delivery; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableAsync; + +@MapperScan(basePackages = {"com.ccsens.delivery.persist.*"}) +@ServletComponentScan +@EnableCaching +@EnableAsync +@SpringBootApplication +@ComponentScan(basePackages = {"com.ccsens"}) +public class DeliveryApplication { + + public static void main(String[] args) { + SpringApplication.run(DeliveryApplication.class, args); + } + +} diff --git a/src/main/java/com/ccsens/delivery/annotation/MustLogin.java b/src/main/java/com/ccsens/delivery/annotation/MustLogin.java new file mode 100644 index 0000000..1e06c0e --- /dev/null +++ b/src/main/java/com/ccsens/delivery/annotation/MustLogin.java @@ -0,0 +1,24 @@ +package com.ccsens.delivery.annotation; + +import java.lang.annotation.*; + +/** + * @description: 用于标识方法需要登录,获取userId + * 如果未登录,直接返回用户未登录 + * @author: wuHuiJuan + * @create: 2019/12/09 09:48 + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface MustLogin { + /** + * -1 不处理 + * 0: 数组 + * 1:List + * 2:Set + * 3: Map + * */ + byte type() default -1; + +} diff --git a/src/main/java/com/ccsens/delivery/api/UserController.java b/src/main/java/com/ccsens/delivery/api/UserController.java new file mode 100644 index 0000000..af41a61 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/api/UserController.java @@ -0,0 +1,113 @@ +package com.ccsens.delivery.api; + +import cn.hutool.extra.servlet.ServletUtil; +import com.ccsens.delivery.annotation.MustLogin; +import com.ccsens.delivery.bean.dto.UserDto; +import com.ccsens.delivery.bean.vo.UserVo; +import com.ccsens.delivery.service.IUserService; +import com.ccsens.util.JsonResponse; +import com.ccsens.util.WebConstant; +import com.ccsens.util.bean.dto.QueryDto; +import io.jsonwebtoken.Claims; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * @author 逗 + */ +@Api(tags = "user" , description = "用户信息相关接口") +@RestController +@RequestMapping("/users") +@Slf4j +public class UserController { + @Resource + private IUserService userService; + + @ApiOperation(value = "登录", notes = "") + @RequestMapping(value = "/signin", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse userSignin(HttpServletRequest request, @ApiParam @Validated @RequestBody UserDto.SigninDto params) throws Exception{ + log.info("登录:{}",params); + UserVo.TokenBean tokenBean = userService.userSignin(params,request.getHeader("deviceId"), ServletUtil.getClientIP(request)); + log.info("返回用户信息"); + return JsonResponse.newInstance().ok(tokenBean,tokenBean.getToken(),tokenBean.getRefreshToken()); + } + +// @ApiOperation(value = "根据token换取用户信息", notes = "") +// @RequestMapping(value = "/businessToken", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) +// public JsonResponse userByBusinessToken(HttpServletRequest request, @ApiParam @Validated @RequestBody UserDto.BusinessToken params) throws Exception{ +// log.info("根据token换取用户信息:{}",params); +// UserVo.TokenToUserId userInfo = userService.userByBusinessToken(request.getHeader("accessToken"),params); +// log.info("返回用户信息"); +// return JsonResponse.newInstance().ok(userInfo); +// } + + @ApiOperation(value = "/发送验证码", notes = "") + @RequestMapping(value = "/smscode", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) + public JsonResponse getSmsCode(@ApiParam @RequestParam String phone, + @RequestParam(required = true) String verificationCodeId, String verificationCodeValue) throws Exception { + log.info("发送验证码,手机号:{},图形验证码id:{},值:{}",phone,verificationCodeId,verificationCodeValue); + UserVo.SmsCode smsCodeVo = userService.getSignInSmsCode(phone,verificationCodeId,verificationCodeValue); + return JsonResponse.newInstance().ok(smsCodeVo); + } + + @ApiOperation(value = "图片验证码") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/code", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) + public JsonResponse vertifyCode() throws Exception { + UserVo.VerificationCode vertifyCode = userService.getVertifyCode(); + return JsonResponse.newInstance().ok(vertifyCode); + } + + @ApiOperation(value = "根据refreshToken重新获取token",notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "refreshToken",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) + public JsonResponse getTokenByRefreshToken(@RequestParam(required = true) String refreshToken) throws Exception { + log.info("根据refreshToken重新获取token:{}",refreshToken); + UserVo.TokenBean tokenBean = userService.getTokenByRefreshToken(refreshToken); + return JsonResponse.newInstance().ok(tokenBean,tokenBean.getToken(),tokenBean.getRefreshToken()); + } + + + @ApiOperation(value = "根据token/deviceId获取用户信息",notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "token",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) + public JsonResponse getUserByToken(@ApiParam @Validated @RequestBody UserDto.UserInfoByToken params) throws Exception { + log.info("MustLogin根据token查找用户信息:{}",params); + UserVo.TokenToUserId tokenToUserId = userService.getUserByToken(params); + return JsonResponse.newInstance().ok(tokenToUserId); + } + + @ApiOperation(value = "通过手机号获取userId",notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "userIdByPhone",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) + public JsonResponse> getUserIdByPhone(@ApiParam @Validated @RequestBody List phoneList) throws Exception { + log.info("通过手机号获取userId:{}",phoneList); + List userIdList = userService.getUserIdByPhone(phoneList); + return JsonResponse.newInstance().ok(userIdList); + } + + @MustLogin + @ApiOperation(value = "/修改用户信息", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse updateUserInfo(@ApiParam @RequestBody QueryDto params) throws Exception { + log.info("修改用户信息,{}",params); + UserVo.TokenBean tokenBean = userService.updateUserInfo(params.getUserId(), params.getParam()); + return JsonResponse.newInstance().ok(tokenBean); + } + +} diff --git a/src/main/java/com/ccsens/delivery/aspect/MustLoginAspect.java b/src/main/java/com/ccsens/delivery/aspect/MustLoginAspect.java new file mode 100644 index 0000000..a4cda83 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/aspect/MustLoginAspect.java @@ -0,0 +1,119 @@ +package com.ccsens.delivery.aspect; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.ccsens.delivery.annotation.MustLogin; +import com.ccsens.delivery.bean.dto.UserDto; +import com.ccsens.delivery.bean.vo.UserVo; +import com.ccsens.delivery.service.IUserService; +import com.ccsens.util.CodeEnum; +import com.ccsens.util.JsonResponse; +import com.ccsens.util.WebConstant; +import com.ccsens.util.bean.dto.QueryDto; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.Signature; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Array; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +/** + * @description: + * @author: wuHuiJuan + * @create: 2019/12/09 09:54 + */ +@Order(0) +@Slf4j +@Aspect +@Component +public class MustLoginAspect { + @Resource + private IUserService userService; + + @Pointcut("@annotation(com.ccsens.delivery.annotation.MustLogin)") + public void loginAdvice(){} + + @Around("loginAdvice()") + public Object around(ProceedingJoinPoint pjp) throws Throwable { + + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + + final String authHeader = request.getHeader(WebConstant.HEADER_KEY_TOKEN); + + Object[] args = pjp.getArgs(); + QueryDto dto = args == null || args.length < 1 ? null : (QueryDto) args[0]; + + //获取userId + Long userId = null; + if(StrUtil.isNotEmpty(authHeader)){ + log.info("MustLogin————token:{}", authHeader); + //通过token查找用户信息 + //TODO 根据token获取用户信息 + UserVo.TokenToUserId userByToken = userService.getUserByToken(new UserDto.UserInfoByToken(authHeader)); + if(ObjectUtil.isNull(userByToken)){ + return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN); + } + userId = userByToken.getId(); + } + Signature signature = pjp.getSignature(); + MethodSignature methodSignature = (MethodSignature) signature; + Method targetMethod = methodSignature.getMethod(); + + MustLogin mustLoginAnnotation = targetMethod.getAnnotation(MustLogin.class); + fillSpecial(dto, mustLoginAnnotation); + + //必须登录,未登录直接返回未登录相关信息 + if (ObjectUtil.isNull(userId)) { + return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN); + } + + if (dto != null) { + dto.setUserId(userId); + } + + Object result = pjp.proceed(); + return result; + } + + private void fillSpecial(QueryDto dto, MustLogin mustLoginAnnotation) { + if (mustLoginAnnotation == null) { + return; + } + if (dto != null && mustLoginAnnotation.type() > -1) { + switch (mustLoginAnnotation.type()) { + case 0: + Object obj = dto.getParam(); + if (obj!= null && !obj.getClass().isArray()) { + Class aClass = dto.getParam().getClass(); + Object o = Array.newInstance(aClass, 1); + Array.set(o, 0, dto.getParam()); + dto.setParam(o); + } + break; + case 1: + Object obj1 = dto.getParam(); + if (obj1!= null && !(obj1 instanceof List)) { + ArrayList arrayList = new ArrayList(); + arrayList.add(dto.getParam()); + dto.setParam(arrayList); + } + break; + } + + } + } + +} diff --git a/src/main/java/com/ccsens/delivery/bean/dto/UserDto.java b/src/main/java/com/ccsens/delivery/bean/dto/UserDto.java new file mode 100644 index 0000000..afdeeb9 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/bean/dto/UserDto.java @@ -0,0 +1,98 @@ +package com.ccsens.delivery.bean.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author 逗 + */ +@Data +public class UserDto { + + @Data + @ApiModel("登录") + public static class SigninDto{ + @ApiModelProperty("登录客户端:0-H5,1-小程序") + @NotNull(message = "客户端类型异常") + private Integer client; + @ApiModelProperty("登录类型:0-wxmp(小程序),1-phone(手机),2-email(邮箱),3-accounts(账号),4-OAUTH2_Wx(微信),5-Wx_H5(网页微信),6-OAUTH2_WeiBo, 7-Wx_Enterprise(企业微信),8-公众号登录(关注公众号)") + @NotNull(message = "登录类型异常") + private Integer type; + @ApiModelProperty("登录信息") + @NotNull(message = "登录信息不能为空") + private SigninData data; + } + @Data + @ApiModel("登录信息") + public static class SigninData{ + @ApiModelProperty("用户标识|用户名|手机号") + private String identifier; + @ApiModelProperty("用户凭据|密码|验证码") + private String credential; + } + + @Data + @ApiModel("业务根据token获取用户信息") + public static class BusinessToken{ + @ApiModelProperty("token") + private String token; + } + + + + @Data + @ApiModel("通过token获取用户信息") + public static class UserInfoByToken{ + @ApiModelProperty("token") + private String token; + @ApiModelProperty("设备id") + private String deviceId; + @ApiModelProperty("ip地址") + private String clientIp; + @ApiModelProperty("客户端类型 0-H5 1-App") + private Byte clientType; + + public UserInfoByToken() { + } + + public UserInfoByToken(String token) { + this.token = token; + } + + public UserInfoByToken(String token, String deviceId, String clientIp, byte clientType) { + this.token = token; + this.deviceId = deviceId; + this.clientIp = clientIp; + this.clientType = clientType; + } + } + + @Data + @ApiModel("公众号的设备id") + public static class Official{ + @ApiModelProperty("设备id") + private String appId; + } + + @Data + @ApiModel + public static class WxInfo{ + @ApiModelProperty("微信名") + private String nickname; + @ApiModelProperty("微信头像") + private String headImgUrl; + @ApiModelProperty("性别") + private Byte sex; + @ApiModelProperty("省") + private String province; + @ApiModelProperty("市") + private String city; + @ApiModelProperty("国家") + private String country; + @ApiModelProperty("语言") + private String language; + } +} diff --git a/src/main/java/com/ccsens/delivery/bean/po/SysAuth.java b/src/main/java/com/ccsens/delivery/bean/po/SysAuth.java new file mode 100644 index 0000000..df3327d --- /dev/null +++ b/src/main/java/com/ccsens/delivery/bean/po/SysAuth.java @@ -0,0 +1,128 @@ +package com.ccsens.delivery.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class SysAuth implements Serializable { + private Long id; + + private Long userId; + + private Byte identifyType; + + private String identifier; + + private String credential; + + private String salt; + + private Long operator; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Byte getIdentifyType() { + return identifyType; + } + + public void setIdentifyType(Byte identifyType) { + this.identifyType = identifyType; + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier == null ? null : identifier.trim(); + } + + public String getCredential() { + return credential; + } + + public void setCredential(String credential) { + this.credential = credential == null ? null : credential.trim(); + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt == null ? null : salt.trim(); + } + + public Long getOperator() { + return operator; + } + + public void setOperator(Long operator) { + this.operator = operator; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", userId=").append(userId); + sb.append(", identifyType=").append(identifyType); + sb.append(", identifier=").append(identifier); + sb.append(", credential=").append(credential); + sb.append(", salt=").append(salt); + sb.append(", operator=").append(operator); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/delivery/bean/po/SysAuthExample.java b/src/main/java/com/ccsens/delivery/bean/po/SysAuthExample.java new file mode 100644 index 0000000..cd5b940 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/bean/po/SysAuthExample.java @@ -0,0 +1,831 @@ +package com.ccsens.delivery.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class SysAuthExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SysAuthExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(Long value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(Long value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(Long value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(Long value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(Long value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(Long value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(Long value1, Long value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(Long value1, Long value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeIsNull() { + addCriterion("identify_type is null"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeIsNotNull() { + addCriterion("identify_type is not null"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeEqualTo(Byte value) { + addCriterion("identify_type =", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeNotEqualTo(Byte value) { + addCriterion("identify_type <>", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeGreaterThan(Byte value) { + addCriterion("identify_type >", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeGreaterThanOrEqualTo(Byte value) { + addCriterion("identify_type >=", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeLessThan(Byte value) { + addCriterion("identify_type <", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeLessThanOrEqualTo(Byte value) { + addCriterion("identify_type <=", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeIn(List values) { + addCriterion("identify_type in", values, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeNotIn(List values) { + addCriterion("identify_type not in", values, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeBetween(Byte value1, Byte value2) { + addCriterion("identify_type between", value1, value2, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeNotBetween(Byte value1, Byte value2) { + addCriterion("identify_type not between", value1, value2, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifierIsNull() { + addCriterion("identifier is null"); + return (Criteria) this; + } + + public Criteria andIdentifierIsNotNull() { + addCriterion("identifier is not null"); + return (Criteria) this; + } + + public Criteria andIdentifierEqualTo(String value) { + addCriterion("identifier =", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierNotEqualTo(String value) { + addCriterion("identifier <>", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierGreaterThan(String value) { + addCriterion("identifier >", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierGreaterThanOrEqualTo(String value) { + addCriterion("identifier >=", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierLessThan(String value) { + addCriterion("identifier <", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierLessThanOrEqualTo(String value) { + addCriterion("identifier <=", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierLike(String value) { + addCriterion("identifier like", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierNotLike(String value) { + addCriterion("identifier not like", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierIn(List values) { + addCriterion("identifier in", values, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierNotIn(List values) { + addCriterion("identifier not in", values, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierBetween(String value1, String value2) { + addCriterion("identifier between", value1, value2, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierNotBetween(String value1, String value2) { + addCriterion("identifier not between", value1, value2, "identifier"); + return (Criteria) this; + } + + public Criteria andCredentialIsNull() { + addCriterion("credential is null"); + return (Criteria) this; + } + + public Criteria andCredentialIsNotNull() { + addCriterion("credential is not null"); + return (Criteria) this; + } + + public Criteria andCredentialEqualTo(String value) { + addCriterion("credential =", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialNotEqualTo(String value) { + addCriterion("credential <>", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialGreaterThan(String value) { + addCriterion("credential >", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialGreaterThanOrEqualTo(String value) { + addCriterion("credential >=", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialLessThan(String value) { + addCriterion("credential <", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialLessThanOrEqualTo(String value) { + addCriterion("credential <=", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialLike(String value) { + addCriterion("credential like", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialNotLike(String value) { + addCriterion("credential not like", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialIn(List values) { + addCriterion("credential in", values, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialNotIn(List values) { + addCriterion("credential not in", values, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialBetween(String value1, String value2) { + addCriterion("credential between", value1, value2, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialNotBetween(String value1, String value2) { + addCriterion("credential not between", value1, value2, "credential"); + return (Criteria) this; + } + + public Criteria andSaltIsNull() { + addCriterion("salt is null"); + return (Criteria) this; + } + + public Criteria andSaltIsNotNull() { + addCriterion("salt is not null"); + return (Criteria) this; + } + + public Criteria andSaltEqualTo(String value) { + addCriterion("salt =", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotEqualTo(String value) { + addCriterion("salt <>", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltGreaterThan(String value) { + addCriterion("salt >", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltGreaterThanOrEqualTo(String value) { + addCriterion("salt >=", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltLessThan(String value) { + addCriterion("salt <", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltLessThanOrEqualTo(String value) { + addCriterion("salt <=", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltLike(String value) { + addCriterion("salt like", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotLike(String value) { + addCriterion("salt not like", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltIn(List values) { + addCriterion("salt in", values, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotIn(List values) { + addCriterion("salt not in", values, "salt"); + return (Criteria) this; + } + + public Criteria andSaltBetween(String value1, String value2) { + addCriterion("salt between", value1, value2, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotBetween(String value1, String value2) { + addCriterion("salt not between", value1, value2, "salt"); + return (Criteria) this; + } + + public Criteria andOperatorIsNull() { + addCriterion("operator is null"); + return (Criteria) this; + } + + public Criteria andOperatorIsNotNull() { + addCriterion("operator is not null"); + return (Criteria) this; + } + + public Criteria andOperatorEqualTo(Long value) { + addCriterion("operator =", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorNotEqualTo(Long value) { + addCriterion("operator <>", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorGreaterThan(Long value) { + addCriterion("operator >", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorGreaterThanOrEqualTo(Long value) { + addCriterion("operator >=", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorLessThan(Long value) { + addCriterion("operator <", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorLessThanOrEqualTo(Long value) { + addCriterion("operator <=", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorIn(List values) { + addCriterion("operator in", values, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorNotIn(List values) { + addCriterion("operator not in", values, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorBetween(Long value1, Long value2) { + addCriterion("operator between", value1, value2, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorNotBetween(Long value1, Long value2) { + addCriterion("operator not between", value1, value2, "operator"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/delivery/bean/po/SysUser.java b/src/main/java/com/ccsens/delivery/bean/po/SysUser.java new file mode 100644 index 0000000..bcccbc8 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/bean/po/SysUser.java @@ -0,0 +1,194 @@ +package com.ccsens.delivery.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class SysUser implements Serializable { + private Long id; + + private String name; + + private Byte gender; + + private String avatarUrl; + + private String country; + + private String province; + + private String city; + + private String phone; + + private String idCard; + + private Byte power; + + private String deviceId; + + private Byte authType; + + private Long operator; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + public Byte getGender() { + return gender; + } + + public void setGender(Byte gender) { + this.gender = gender; + } + + public String getAvatarUrl() { + return avatarUrl; + } + + public void setAvatarUrl(String avatarUrl) { + this.avatarUrl = avatarUrl == null ? null : avatarUrl.trim(); + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country == null ? null : country.trim(); + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province == null ? null : province.trim(); + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city == null ? null : city.trim(); + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone == null ? null : phone.trim(); + } + + public String getIdCard() { + return idCard; + } + + public void setIdCard(String idCard) { + this.idCard = idCard == null ? null : idCard.trim(); + } + + public Byte getPower() { + return power; + } + + public void setPower(Byte power) { + this.power = power; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId == null ? null : deviceId.trim(); + } + + public Byte getAuthType() { + return authType; + } + + public void setAuthType(Byte authType) { + this.authType = authType; + } + + public Long getOperator() { + return operator; + } + + public void setOperator(Long operator) { + this.operator = operator; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", name=").append(name); + sb.append(", gender=").append(gender); + sb.append(", avatarUrl=").append(avatarUrl); + sb.append(", country=").append(country); + sb.append(", province=").append(province); + sb.append(", city=").append(city); + sb.append(", phone=").append(phone); + sb.append(", idCard=").append(idCard); + sb.append(", power=").append(power); + sb.append(", deviceId=").append(deviceId); + sb.append(", authType=").append(authType); + sb.append(", operator=").append(operator); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/delivery/bean/po/SysUserExample.java b/src/main/java/com/ccsens/delivery/bean/po/SysUserExample.java new file mode 100644 index 0000000..b7b5cd6 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/bean/po/SysUserExample.java @@ -0,0 +1,1241 @@ +package com.ccsens.delivery.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class SysUserExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SysUserExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("name is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("name is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("name =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("name <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("name >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("name >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("name <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("name <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("name like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("name not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("name in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("name not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("name between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("name not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andGenderIsNull() { + addCriterion("gender is null"); + return (Criteria) this; + } + + public Criteria andGenderIsNotNull() { + addCriterion("gender is not null"); + return (Criteria) this; + } + + public Criteria andGenderEqualTo(Byte value) { + addCriterion("gender =", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderNotEqualTo(Byte value) { + addCriterion("gender <>", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderGreaterThan(Byte value) { + addCriterion("gender >", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderGreaterThanOrEqualTo(Byte value) { + addCriterion("gender >=", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderLessThan(Byte value) { + addCriterion("gender <", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderLessThanOrEqualTo(Byte value) { + addCriterion("gender <=", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderIn(List values) { + addCriterion("gender in", values, "gender"); + return (Criteria) this; + } + + public Criteria andGenderNotIn(List values) { + addCriterion("gender not in", values, "gender"); + return (Criteria) this; + } + + public Criteria andGenderBetween(Byte value1, Byte value2) { + addCriterion("gender between", value1, value2, "gender"); + return (Criteria) this; + } + + public Criteria andGenderNotBetween(Byte value1, Byte value2) { + addCriterion("gender not between", value1, value2, "gender"); + return (Criteria) this; + } + + public Criteria andAvatarUrlIsNull() { + addCriterion("avatar_url is null"); + return (Criteria) this; + } + + public Criteria andAvatarUrlIsNotNull() { + addCriterion("avatar_url is not null"); + return (Criteria) this; + } + + public Criteria andAvatarUrlEqualTo(String value) { + addCriterion("avatar_url =", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlNotEqualTo(String value) { + addCriterion("avatar_url <>", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlGreaterThan(String value) { + addCriterion("avatar_url >", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlGreaterThanOrEqualTo(String value) { + addCriterion("avatar_url >=", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlLessThan(String value) { + addCriterion("avatar_url <", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlLessThanOrEqualTo(String value) { + addCriterion("avatar_url <=", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlLike(String value) { + addCriterion("avatar_url like", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlNotLike(String value) { + addCriterion("avatar_url not like", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlIn(List values) { + addCriterion("avatar_url in", values, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlNotIn(List values) { + addCriterion("avatar_url not in", values, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlBetween(String value1, String value2) { + addCriterion("avatar_url between", value1, value2, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlNotBetween(String value1, String value2) { + addCriterion("avatar_url not between", value1, value2, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andCountryIsNull() { + addCriterion("country is null"); + return (Criteria) this; + } + + public Criteria andCountryIsNotNull() { + addCriterion("country is not null"); + return (Criteria) this; + } + + public Criteria andCountryEqualTo(String value) { + addCriterion("country =", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotEqualTo(String value) { + addCriterion("country <>", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryGreaterThan(String value) { + addCriterion("country >", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryGreaterThanOrEqualTo(String value) { + addCriterion("country >=", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryLessThan(String value) { + addCriterion("country <", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryLessThanOrEqualTo(String value) { + addCriterion("country <=", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryLike(String value) { + addCriterion("country like", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotLike(String value) { + addCriterion("country not like", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryIn(List values) { + addCriterion("country in", values, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotIn(List values) { + addCriterion("country not in", values, "country"); + return (Criteria) this; + } + + public Criteria andCountryBetween(String value1, String value2) { + addCriterion("country between", value1, value2, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotBetween(String value1, String value2) { + addCriterion("country not between", value1, value2, "country"); + return (Criteria) this; + } + + public Criteria andProvinceIsNull() { + addCriterion("province is null"); + return (Criteria) this; + } + + public Criteria andProvinceIsNotNull() { + addCriterion("province is not null"); + return (Criteria) this; + } + + public Criteria andProvinceEqualTo(String value) { + addCriterion("province =", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotEqualTo(String value) { + addCriterion("province <>", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceGreaterThan(String value) { + addCriterion("province >", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceGreaterThanOrEqualTo(String value) { + addCriterion("province >=", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceLessThan(String value) { + addCriterion("province <", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceLessThanOrEqualTo(String value) { + addCriterion("province <=", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceLike(String value) { + addCriterion("province like", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotLike(String value) { + addCriterion("province not like", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceIn(List values) { + addCriterion("province in", values, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotIn(List values) { + addCriterion("province not in", values, "province"); + return (Criteria) this; + } + + public Criteria andProvinceBetween(String value1, String value2) { + addCriterion("province between", value1, value2, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotBetween(String value1, String value2) { + addCriterion("province not between", value1, value2, "province"); + return (Criteria) this; + } + + public Criteria andCityIsNull() { + addCriterion("city is null"); + return (Criteria) this; + } + + public Criteria andCityIsNotNull() { + addCriterion("city is not null"); + return (Criteria) this; + } + + public Criteria andCityEqualTo(String value) { + addCriterion("city =", value, "city"); + return (Criteria) this; + } + + public Criteria andCityNotEqualTo(String value) { + addCriterion("city <>", value, "city"); + return (Criteria) this; + } + + public Criteria andCityGreaterThan(String value) { + addCriterion("city >", value, "city"); + return (Criteria) this; + } + + public Criteria andCityGreaterThanOrEqualTo(String value) { + addCriterion("city >=", value, "city"); + return (Criteria) this; + } + + public Criteria andCityLessThan(String value) { + addCriterion("city <", value, "city"); + return (Criteria) this; + } + + public Criteria andCityLessThanOrEqualTo(String value) { + addCriterion("city <=", value, "city"); + return (Criteria) this; + } + + public Criteria andCityLike(String value) { + addCriterion("city like", value, "city"); + return (Criteria) this; + } + + public Criteria andCityNotLike(String value) { + addCriterion("city not like", value, "city"); + return (Criteria) this; + } + + public Criteria andCityIn(List values) { + addCriterion("city in", values, "city"); + return (Criteria) this; + } + + public Criteria andCityNotIn(List values) { + addCriterion("city not in", values, "city"); + return (Criteria) this; + } + + public Criteria andCityBetween(String value1, String value2) { + addCriterion("city between", value1, value2, "city"); + return (Criteria) this; + } + + public Criteria andCityNotBetween(String value1, String value2) { + addCriterion("city not between", value1, value2, "city"); + return (Criteria) this; + } + + public Criteria andPhoneIsNull() { + addCriterion("phone is null"); + return (Criteria) this; + } + + public Criteria andPhoneIsNotNull() { + addCriterion("phone is not null"); + return (Criteria) this; + } + + public Criteria andPhoneEqualTo(String value) { + addCriterion("phone =", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotEqualTo(String value) { + addCriterion("phone <>", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneGreaterThan(String value) { + addCriterion("phone >", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneGreaterThanOrEqualTo(String value) { + addCriterion("phone >=", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLessThan(String value) { + addCriterion("phone <", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLessThanOrEqualTo(String value) { + addCriterion("phone <=", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLike(String value) { + addCriterion("phone like", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotLike(String value) { + addCriterion("phone not like", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneIn(List values) { + addCriterion("phone in", values, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotIn(List values) { + addCriterion("phone not in", values, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneBetween(String value1, String value2) { + addCriterion("phone between", value1, value2, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotBetween(String value1, String value2) { + addCriterion("phone not between", value1, value2, "phone"); + return (Criteria) this; + } + + public Criteria andIdCardIsNull() { + addCriterion("id_card is null"); + return (Criteria) this; + } + + public Criteria andIdCardIsNotNull() { + addCriterion("id_card is not null"); + return (Criteria) this; + } + + public Criteria andIdCardEqualTo(String value) { + addCriterion("id_card =", value, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardNotEqualTo(String value) { + addCriterion("id_card <>", value, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardGreaterThan(String value) { + addCriterion("id_card >", value, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardGreaterThanOrEqualTo(String value) { + addCriterion("id_card >=", value, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardLessThan(String value) { + addCriterion("id_card <", value, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardLessThanOrEqualTo(String value) { + addCriterion("id_card <=", value, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardLike(String value) { + addCriterion("id_card like", value, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardNotLike(String value) { + addCriterion("id_card not like", value, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardIn(List values) { + addCriterion("id_card in", values, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardNotIn(List values) { + addCriterion("id_card not in", values, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardBetween(String value1, String value2) { + addCriterion("id_card between", value1, value2, "idCard"); + return (Criteria) this; + } + + public Criteria andIdCardNotBetween(String value1, String value2) { + addCriterion("id_card not between", value1, value2, "idCard"); + return (Criteria) this; + } + + public Criteria andPowerIsNull() { + addCriterion("power is null"); + return (Criteria) this; + } + + public Criteria andPowerIsNotNull() { + addCriterion("power is not null"); + return (Criteria) this; + } + + public Criteria andPowerEqualTo(Byte value) { + addCriterion("power =", value, "power"); + return (Criteria) this; + } + + public Criteria andPowerNotEqualTo(Byte value) { + addCriterion("power <>", value, "power"); + return (Criteria) this; + } + + public Criteria andPowerGreaterThan(Byte value) { + addCriterion("power >", value, "power"); + return (Criteria) this; + } + + public Criteria andPowerGreaterThanOrEqualTo(Byte value) { + addCriterion("power >=", value, "power"); + return (Criteria) this; + } + + public Criteria andPowerLessThan(Byte value) { + addCriterion("power <", value, "power"); + return (Criteria) this; + } + + public Criteria andPowerLessThanOrEqualTo(Byte value) { + addCriterion("power <=", value, "power"); + return (Criteria) this; + } + + public Criteria andPowerIn(List values) { + addCriterion("power in", values, "power"); + return (Criteria) this; + } + + public Criteria andPowerNotIn(List values) { + addCriterion("power not in", values, "power"); + return (Criteria) this; + } + + public Criteria andPowerBetween(Byte value1, Byte value2) { + addCriterion("power between", value1, value2, "power"); + return (Criteria) this; + } + + public Criteria andPowerNotBetween(Byte value1, Byte value2) { + addCriterion("power not between", value1, value2, "power"); + return (Criteria) this; + } + + public Criteria andDeviceIdIsNull() { + addCriterion("device_id is null"); + return (Criteria) this; + } + + public Criteria andDeviceIdIsNotNull() { + addCriterion("device_id is not null"); + return (Criteria) this; + } + + public Criteria andDeviceIdEqualTo(String value) { + addCriterion("device_id =", value, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdNotEqualTo(String value) { + addCriterion("device_id <>", value, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdGreaterThan(String value) { + addCriterion("device_id >", value, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdGreaterThanOrEqualTo(String value) { + addCriterion("device_id >=", value, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdLessThan(String value) { + addCriterion("device_id <", value, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdLessThanOrEqualTo(String value) { + addCriterion("device_id <=", value, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdLike(String value) { + addCriterion("device_id like", value, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdNotLike(String value) { + addCriterion("device_id not like", value, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdIn(List values) { + addCriterion("device_id in", values, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdNotIn(List values) { + addCriterion("device_id not in", values, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdBetween(String value1, String value2) { + addCriterion("device_id between", value1, value2, "deviceId"); + return (Criteria) this; + } + + public Criteria andDeviceIdNotBetween(String value1, String value2) { + addCriterion("device_id not between", value1, value2, "deviceId"); + return (Criteria) this; + } + + public Criteria andAuthTypeIsNull() { + addCriterion("auth_type is null"); + return (Criteria) this; + } + + public Criteria andAuthTypeIsNotNull() { + addCriterion("auth_type is not null"); + return (Criteria) this; + } + + public Criteria andAuthTypeEqualTo(Byte value) { + addCriterion("auth_type =", value, "authType"); + return (Criteria) this; + } + + public Criteria andAuthTypeNotEqualTo(Byte value) { + addCriterion("auth_type <>", value, "authType"); + return (Criteria) this; + } + + public Criteria andAuthTypeGreaterThan(Byte value) { + addCriterion("auth_type >", value, "authType"); + return (Criteria) this; + } + + public Criteria andAuthTypeGreaterThanOrEqualTo(Byte value) { + addCriterion("auth_type >=", value, "authType"); + return (Criteria) this; + } + + public Criteria andAuthTypeLessThan(Byte value) { + addCriterion("auth_type <", value, "authType"); + return (Criteria) this; + } + + public Criteria andAuthTypeLessThanOrEqualTo(Byte value) { + addCriterion("auth_type <=", value, "authType"); + return (Criteria) this; + } + + public Criteria andAuthTypeIn(List values) { + addCriterion("auth_type in", values, "authType"); + return (Criteria) this; + } + + public Criteria andAuthTypeNotIn(List values) { + addCriterion("auth_type not in", values, "authType"); + return (Criteria) this; + } + + public Criteria andAuthTypeBetween(Byte value1, Byte value2) { + addCriterion("auth_type between", value1, value2, "authType"); + return (Criteria) this; + } + + public Criteria andAuthTypeNotBetween(Byte value1, Byte value2) { + addCriterion("auth_type not between", value1, value2, "authType"); + return (Criteria) this; + } + + public Criteria andOperatorIsNull() { + addCriterion("operator is null"); + return (Criteria) this; + } + + public Criteria andOperatorIsNotNull() { + addCriterion("operator is not null"); + return (Criteria) this; + } + + public Criteria andOperatorEqualTo(Long value) { + addCriterion("operator =", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorNotEqualTo(Long value) { + addCriterion("operator <>", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorGreaterThan(Long value) { + addCriterion("operator >", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorGreaterThanOrEqualTo(Long value) { + addCriterion("operator >=", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorLessThan(Long value) { + addCriterion("operator <", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorLessThanOrEqualTo(Long value) { + addCriterion("operator <=", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorIn(List values) { + addCriterion("operator in", values, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorNotIn(List values) { + addCriterion("operator not in", values, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorBetween(Long value1, Long value2) { + addCriterion("operator between", value1, value2, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorNotBetween(Long value1, Long value2) { + addCriterion("operator not between", value1, value2, "operator"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/delivery/bean/vo/UserVo.java b/src/main/java/com/ccsens/delivery/bean/vo/UserVo.java new file mode 100644 index 0000000..ecd77d2 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/bean/vo/UserVo.java @@ -0,0 +1,123 @@ +package com.ccsens.delivery.bean.vo; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author 逗 + */ +@Data +public class UserVo { + @Data + @ApiModel("登录后返回用户和token信息") + public static class TokenBean { + @ApiModelProperty("用户id") + private Long id; + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty("昵称") + private String name; + @ApiModelProperty("头像") + private String avatarUrl; + @ApiModelProperty("token") + private String token; + @ApiModelProperty("刷新token") + private String refreshToken; + } + + @Data + @ApiModel("业务请求用户信息") + public static class BusinessUserInfo { + @ApiModelProperty("用户id") + private Long id; + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty("认证状态") + private String type; + } + + @Data + public static class UserSign{ + private Long userId; + private Long authId; + private String phone; + private String avatarUrl; + } + + @Data + @ApiModel("获取手机验证码") + public static class SmsCode{ + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty("有效时间(秒)") + private Integer expiredInSeconds; + @JsonIgnore + private String smsCode; + } + + @Data + @ApiModel("返回图片验证码") + public static class VerificationCode{ + @ApiModelProperty("图片验证码Id") + private String verificationCodeId; + @ApiModelProperty("图片的Base64字符串") + private String imageBase64; + } + + @Data + @ApiModel("根据token获取用户信息") + public static class TokenToUserId{ + @ApiModelProperty("用户id") + private Long id; + @ApiModelProperty("用户名") + private String userName; + @ApiModelProperty("头像") + private String avatarUrl; + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty("用户类型 0未认证 1已认证") + private byte authType; + @ApiModelProperty("token") + private String token; + @ApiModelProperty("刷新token") + private String refreshToken; + @ApiModelProperty("性别 偶数--女 奇数--男") + private byte gender; + @ApiModelProperty("国家") + private String country; + @ApiModelProperty("省份") + private String province; + @ApiModelProperty("城市") + private String city; + } + + + @Data + @ApiModel("生成关注公众号二维码") + public static class AttentionOfficial{ + @ApiModelProperty("二维码路径") + private String qrCodeUrl; + @ApiModelProperty("eventKey") + private String eventKey; + } + + @Data + @ApiModel("用户是否关注公众号") + public static class UserOfficial{ + @ApiModelProperty("用户id") + private Long userId; + @ApiModelProperty("openId") + private String openId; + @ApiModelProperty("是否关注公众号 0未关注 1已关注") + private byte status; + } + + @Data + @ApiModel("用户在公众号里的openId") + public static class UserOpenId{ + @ApiModelProperty("openId") + private String openId; + } +} diff --git a/src/main/java/com/ccsens/delivery/config/BeanConfig.java b/src/main/java/com/ccsens/delivery/config/BeanConfig.java new file mode 100644 index 0000000..1c06de3 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/config/BeanConfig.java @@ -0,0 +1,44 @@ +package com.ccsens.delivery.config; + +import com.ccsens.delivery.intercept.MybatisInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +/** + * @description: + * @author: wuHuiJuan + * @create: 2019/12/03 18:01 + */ +@Configuration +public class BeanConfig { + /** + * 注册拦截器 + */ + @Bean + public MybatisInterceptor mybatisInterceptor() { + MybatisInterceptor interceptor = new MybatisInterceptor(); + return interceptor; + } + private CorsConfiguration buildConfig() { + CorsConfiguration corsConfiguration = new CorsConfiguration(); + corsConfiguration.addAllowedOrigin("*"); + corsConfiguration.addAllowedHeader("*"); + corsConfiguration.addAllowedMethod("*"); + // 预检请求的有效期,单位为秒。 + corsConfiguration.setMaxAge(3600L); + // 是否支持安全证书(必需参数) + corsConfiguration.setAllowCredentials(true); + return corsConfiguration; + } + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", buildConfig()); + return new CorsFilter(source); + } + +} diff --git a/src/main/java/com/ccsens/delivery/config/SpringConfig.java b/src/main/java/com/ccsens/delivery/config/SpringConfig.java new file mode 100644 index 0000000..2825937 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/config/SpringConfig.java @@ -0,0 +1,141 @@ +package com.ccsens.delivery.config; + + +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; +import com.ccsens.util.PropUtil; +import com.ccsens.util.config.DruidProps; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.servlet.config.annotation.*; + +import javax.annotation.Resource; +import javax.sql.DataSource; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; +import java.util.TimeZone; + +/** + * @author whj + */ +@Configuration +public class SpringConfig implements WebMvcConfigurer { + @Resource + private DruidProps druidPropsUtil; + @Value("${spring.snowflake.workerId}") + private String workerId; + @Value("${spring.snowflake.dataCenterId}") + private String dataCenterId; + + + /** + * 配置Converter + * @return + */ + @Bean + public HttpMessageConverter responseStringConverter() { + return new StringHttpMessageConverter( + Charset.forName("UTF-8")); + } + + @Bean + public HttpMessageConverter responseJsonConverter(){ + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + List mediaTypeList = new ArrayList<>(); + mediaTypeList.add(MediaType.TEXT_HTML); + mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8); + converter.setSupportedMediaTypes(mediaTypeList); + + ObjectMapper objectMapper = new ObjectMapper(); + SimpleModule simpleModule = new SimpleModule(); + simpleModule.addSerializer(Long.class, ToStringSerializer.instance); + simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); + objectMapper.registerModule(simpleModule); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8")); + converter.setObjectMapper(objectMapper); + + return converter; + } + + @Override + public void configureMessageConverters(List> converters) { + converters.add(responseStringConverter()); + converters.add(responseJsonConverter()); + } + + @Override + public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { + configurer.favorPathExtension(false); + } + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") + // 允许提交请求的方法,*表示全部允许 + .allowedMethods("*") + // #允许向该服务器提交请求的URI,*表示全部允许 + .allowedOrigins("*") + // 允许cookies跨域 + .allowCredentials(true) + // #允许访问的头信息,*表示全部 + .allowedHeaders("*") + // 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了 + .maxAge(18000L); + + } + + + + + /** + * 配置静态资源 + */ + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("swagger-ui.html") + .addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/"); + + registry.addResourceHandler("/uploads/**") +// .addResourceLocations("file:D:/datang_soft/project/uploads/"); + .addResourceLocations("file:" + PropUtil.path); + + registry.addResourceHandler("/static/**") + .addResourceLocations("classpath:/static/"); + } + + /** + * 配置拦截器 + * @param registry 拦截器 + */ + @Override + public void addInterceptors(InterceptorRegistry registry) { + + } + + + /** + * 配置数据源(单数据源) + */ + @Bean + public DataSource dataSource(){ + return druidPropsUtil.createDruidDataSource(); + } + + @Bean + public Snowflake snowflake(){ + return IdUtil.createSnowflake(Long.parseLong(workerId),Long.parseLong(dataCenterId)); + } +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/delivery/config/SwaggerConfigure.java b/src/main/java/com/ccsens/delivery/config/SwaggerConfigure.java new file mode 100644 index 0000000..5b12800 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/config/SwaggerConfigure.java @@ -0,0 +1,58 @@ +package com.ccsens.delivery.config; + +import com.ccsens.util.WebConstant; +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author whj + */ +@Configuration +@EnableSwagger2 +@ConditionalOnExpression("${swagger.enable}") +public class SwaggerConfigure { + @Bean + public Docket customDocket() { + // + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors + .basePackage("com.ccsens.delivery.api")) + .build() + .globalOperationParameters(setHeaderToken()); + } + + private ApiInfo apiInfo() { + return new ApiInfo("Swagger Delivery", + "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", + "1.0.0", + "http://swagger.io/terms/", + "wu", + "Apache 2.0", + "http://www.apache.org/licenses/LICENSE-2.0.html" + ); + } + + private List setHeaderToken() { + ParameterBuilder tokenPar = new ParameterBuilder(); + List pars = new ArrayList<>(); + tokenPar.name(WebConstant.HEADER_KEY_TOKEN).description("token") + .defaultValue(WebConstant.HEADER_KEY_TOKEN_PREFIX) + .modelRef(new ModelRef("string")).parameterType("header").required(false).build(); + pars.add(tokenPar.build()); + return pars; + } +} diff --git a/src/main/java/com/ccsens/delivery/intercept/MybatisInterceptor.java b/src/main/java/com/ccsens/delivery/intercept/MybatisInterceptor.java new file mode 100644 index 0000000..baeb374 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/intercept/MybatisInterceptor.java @@ -0,0 +1,159 @@ +package com.ccsens.delivery.intercept; + +import cn.hutool.core.collection.CollectionUtil; +import com.ccsens.util.WebConstant; +import org.apache.ibatis.executor.Executor; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.ResultMap; +import org.apache.ibatis.mapping.SqlSource; +import org.apache.ibatis.plugin.*; +import org.apache.ibatis.reflection.DefaultReflectorFactory; +import org.apache.ibatis.reflection.MetaObject; +import org.apache.ibatis.reflection.factory.DefaultObjectFactory; +import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory; +import org.apache.ibatis.session.ResultHandler; +import org.apache.ibatis.session.RowBounds; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +/** + * @description: 查询添加rec_status = 0 + * @author: wuHuiJuan + * @create: 2019/12/11 10:58 + */ +@Intercepts({ + @Signature( + type = Executor.class, + method = "query", + args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class} + ) +}) +public class MybatisInterceptor implements Interceptor { + @Override + public Object intercept(Invocation invocation) throws Throwable { + + + String selectByExample = "selectByExample"; + String countByExample = "countByExample"; + String countByExample2 = "selectByExample_COUNT"; + String selectByPrimaryKey = "selectByPrimaryKey"; + + Object[] args = invocation.getArgs(); + MappedStatement statement = (MappedStatement) args[0]; + if (statement.getId().endsWith(selectByExample) + || statement.getId().endsWith(countByExample) + || statement.getId().endsWith(countByExample2)) { + //XXXExample + Object example = args[1]; + + addCondition(statement, example); + + + + + } else if (statement.getId().endsWith(selectByPrimaryKey)) { + BoundSql boundSql = statement.getBoundSql(args[1]); + String sql = boundSql.getSql() + " and rec_status = 0"; + MappedStatement newStatement = newMappedStatement(statement, new BoundSqlSqlSource(boundSql)); + MetaObject msObject = MetaObject.forObject(newStatement, new DefaultObjectFactory(), new DefaultObjectWrapperFactory(),new DefaultReflectorFactory()); + msObject.setValue("sqlSource.boundSql.sql", sql); + args[0] = newStatement; + } + + return invocation.proceed(); + } + + private void addCondition(MappedStatement statement, Object example) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException { + if (example instanceof Map) { + example = ((Map) example).get("_ORIGINAL_PARAMETER_OBJECT"); + } + + + Method method = example.getClass().getMethod("getOredCriteria", null); + //获取到条件数组,第一个是Criteria + List list = (List) method.invoke(example); + if (CollectionUtil.isEmpty(list)) { + Class clazz = ((ResultMap) statement.getResultMaps().get(0)).getType(); + String exampleName = clazz.getName() + "Example"; + Object paramExample = Class.forName(exampleName).newInstance(); + Method createCriteria = paramExample.getClass().getMethod("createCriteria"); + Object criteria = createCriteria.invoke(paramExample); + Method andIsDelEqualTo = criteria.getClass().getMethod("andRecStatusEqualTo", Byte.class); + andIsDelEqualTo.invoke(criteria, WebConstant.REC_STATUS.Normal.value); + list.add(criteria); + } else { + Object criteria = list.get(0); + Method getCriteria = criteria.getClass().getMethod("getCriteria"); + List params = (List) getCriteria.invoke(criteria); + boolean hasDel = false; + for (Object param : params) { + Method getCondition = param.getClass().getMethod("getCondition"); + Object condition = getCondition.invoke(param); + if ("rec_status =".equals(condition)) { + hasDel = true; + } + } + if (!hasDel) { + Method andIsDelEqualTo = criteria.getClass().getMethod("andRecStatusEqualTo", Byte.class); + andIsDelEqualTo.invoke(criteria, WebConstant.REC_STATUS.Normal.value); + } + + } + + } + + @Override + public Object plugin(Object target) { + return Plugin.wrap(target, this); + } + + @Override + public void setProperties(Properties properties) { + + } + + private MappedStatement newMappedStatement(MappedStatement ms, SqlSource newSqlSource) { + MappedStatement.Builder builder = + new MappedStatement.Builder(ms.getConfiguration(), ms.getId(), newSqlSource, ms.getSqlCommandType()); + builder.resource(ms.getResource()); + builder.fetchSize(ms.getFetchSize()); + builder.statementType(ms.getStatementType()); + builder.keyGenerator(ms.getKeyGenerator()); + if (ms.getKeyProperties() != null && ms.getKeyProperties().length != 0) { + StringBuilder keyProperties = new StringBuilder(); + for (String keyProperty : ms.getKeyProperties()) { + keyProperties.append(keyProperty).append(","); + } + keyProperties.delete(keyProperties.length() - 1, keyProperties.length()); + builder.keyProperty(keyProperties.toString()); + } + builder.timeout(ms.getTimeout()); + builder.parameterMap(ms.getParameterMap()); + builder.resultMaps(ms.getResultMaps()); + builder.resultSetType(ms.getResultSetType()); + builder.cache(ms.getCache()); + builder.flushCacheRequired(ms.isFlushCacheRequired()); + builder.useCache(ms.isUseCache()); + + return builder.build(); + } + + + // 定义一个内部辅助类,作用是包装sq + class BoundSqlSqlSource implements SqlSource { + private BoundSql boundSql; + public BoundSqlSqlSource(BoundSql boundSql) { + this.boundSql = boundSql; + } + @Override + public BoundSql getBoundSql(Object parameterObject) { + return boundSql; + } + } + +} diff --git a/src/main/java/com/ccsens/delivery/persist/dao/SysAuthDao.java b/src/main/java/com/ccsens/delivery/persist/dao/SysAuthDao.java new file mode 100644 index 0000000..b28d95c --- /dev/null +++ b/src/main/java/com/ccsens/delivery/persist/dao/SysAuthDao.java @@ -0,0 +1,26 @@ +package com.ccsens.delivery.persist.dao; + + +import com.ccsens.delivery.bean.po.SysAuth; +import com.ccsens.delivery.persist.mapper.SysAuthMapper; +import org.apache.ibatis.annotations.Param; + +/** + * @author 逗 + */ +public interface SysAuthDao extends SysAuthMapper { + + /** + * 根据手机号查看认证方式 + * @param phone 手机号 + * @return 返回认证信息 + */ + SysAuth getByPhone(@Param("phone") String phone); + + /** + * 根据userId获取手机号 + * @param userId userId + * @return 返回手机号 + */ + String getPhoneByUserId(@Param("userId") Long userId); +} diff --git a/src/main/java/com/ccsens/delivery/persist/dao/SysUserDao.java b/src/main/java/com/ccsens/delivery/persist/dao/SysUserDao.java new file mode 100644 index 0000000..a3af72c --- /dev/null +++ b/src/main/java/com/ccsens/delivery/persist/dao/SysUserDao.java @@ -0,0 +1,35 @@ +package com.ccsens.delivery.persist.dao; + +import com.ccsens.delivery.bean.po.SysUser; +import com.ccsens.delivery.bean.vo.UserVo; +import com.ccsens.delivery.persist.mapper.SysUserMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author 逗 + */ +public interface SysUserDao extends SysUserMapper { + /** + * 通过设备id获取关联的临时用户 + * @param deviceId 设备id + * @return 返回用户信息 + */ + SysUser getVisitorUser(@Param("deviceId") String deviceId); + + /** + * 通过手机号获取userId + * @param phoneList 手机号列表 + * @return userId列表 + */ + List getUserIdByPhone(@Param("phoneList") List phoneList); + + /** + * 根据identifier获取用户信息 + * @param identifyType 认证类型 + * @param identifier 用户标识 + * @return 返回用户信息 + */ + UserVo.UserSign getUserByIdentifier(@Param("identifyType") int identifyType, @Param("identifier") String identifier); +} diff --git a/src/main/java/com/ccsens/delivery/persist/mapper/SysAuthMapper.java b/src/main/java/com/ccsens/delivery/persist/mapper/SysAuthMapper.java new file mode 100644 index 0000000..861bf40 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/persist/mapper/SysAuthMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.delivery.persist.mapper; + +import com.ccsens.delivery.bean.po.SysAuth; +import com.ccsens.delivery.bean.po.SysAuthExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SysAuthMapper { + long countByExample(SysAuthExample example); + + int deleteByExample(SysAuthExample example); + + int deleteByPrimaryKey(Long id); + + int insert(SysAuth record); + + int insertSelective(SysAuth record); + + List selectByExample(SysAuthExample example); + + SysAuth selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") SysAuth record, @Param("example") SysAuthExample example); + + int updateByExample(@Param("record") SysAuth record, @Param("example") SysAuthExample example); + + int updateByPrimaryKeySelective(SysAuth record); + + int updateByPrimaryKey(SysAuth record); +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/delivery/persist/mapper/SysUserMapper.java b/src/main/java/com/ccsens/delivery/persist/mapper/SysUserMapper.java new file mode 100644 index 0000000..e7c4800 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/persist/mapper/SysUserMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.delivery.persist.mapper; + +import com.ccsens.delivery.bean.po.SysUser; +import com.ccsens.delivery.bean.po.SysUserExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SysUserMapper { + long countByExample(SysUserExample example); + + int deleteByExample(SysUserExample example); + + int deleteByPrimaryKey(Long id); + + int insert(SysUser record); + + int insertSelective(SysUser record); + + List selectByExample(SysUserExample example); + + SysUser selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") SysUser record, @Param("example") SysUserExample example); + + int updateByExample(@Param("record") SysUser record, @Param("example") SysUserExample example); + + int updateByPrimaryKeySelective(SysUser record); + + int updateByPrimaryKey(SysUser record); +} \ No newline at end of file diff --git a/src/main/java/com/ccsens/delivery/service/IUserService.java b/src/main/java/com/ccsens/delivery/service/IUserService.java new file mode 100644 index 0000000..21f1e83 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/service/IUserService.java @@ -0,0 +1,77 @@ +package com.ccsens.delivery.service; + + + +import com.ccsens.delivery.bean.dto.UserDto; +import com.ccsens.delivery.bean.vo.UserVo; + +import java.util.List; + +/** + * @author 逗 + */ +public interface IUserService { + /** + * 用户登录 + * @param params 登录信息 + * @param deviceId 设备id + * @return 返回token + */ + UserVo.TokenBean userSignin(UserDto.SigninDto params, String deviceId, String clientIp) throws Exception; + +// /** +// * 业务根据token获取用户信息 +// * @param params 业务app和token +// * @return 返回用户信息 +// */ +// UserVo.TokenToUserId userByBusinessToken(String accessToken, UserDto.BusinessToken params); + + /** + * 获取手机验证码 + * @param phone 手机号 + * @param verificationCodeId 图形验证码id + * @param verificationCodeValue 图形验证码值 + * @return 返回手机号和有效期 + */ + UserVo.SmsCode getSignInSmsCode(String phone, String verificationCodeId, String verificationCodeValue) throws Exception; + + /** + * 获取图片验证码 + * @return 返回base64图片 + */ + UserVo.VerificationCode getVertifyCode(); + + /** + * 根据token或deviceId获取用户信息 + * @param params token等信息 + * @return 返回用户信息 + */ + UserVo.TokenToUserId getUserByToken(UserDto.UserInfoByToken params); + + /** + * 生成token + */ + UserVo.TokenBean generateToken(Long userId, Object authId); + + /** + * 根据refresh获取token + * @param refreshToken 刷新token + * @return 返回重新生成的token + */ + UserVo.TokenBean getTokenByRefreshToken(String refreshToken); + + /** + * 通过手机号获取userId + * @param phoneList 手机号列表 + * @return 用户列表 + */ + List getUserIdByPhone(List phoneList); + + /** + * 修改用户信息 + * @param userId userId + * @param param 详细信息 + * @return 返回头像名称等 + */ + UserVo.TokenBean updateUserInfo(Long userId, UserDto.WxInfo param); +} diff --git a/src/main/java/com/ccsens/delivery/service/UserService.java b/src/main/java/com/ccsens/delivery/service/UserService.java new file mode 100644 index 0000000..1324444 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/service/UserService.java @@ -0,0 +1,723 @@ +package com.ccsens.delivery.service; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import com.ccsens.delivery.bean.dto.UserDto; +import com.ccsens.delivery.bean.po.SysAuth; +import com.ccsens.delivery.bean.po.SysAuthExample; +import com.ccsens.delivery.bean.po.SysUser; +import com.ccsens.delivery.bean.vo.UserVo; +import com.ccsens.delivery.persist.dao.SysAuthDao; +import com.ccsens.delivery.persist.dao.SysUserDao; +import com.ccsens.delivery.util.DeliveryCodeError; +import com.ccsens.delivery.util.DeliveryConstant; +import com.ccsens.util.*; +import com.ccsens.util.bean.wx.po.WxOauth2UserInfo; +import com.ccsens.util.exception.BaseException; +import com.ccsens.util.wx.WxGzhUtil; +import com.ccsens.util.wx.WxXcxUtil; +import com.ccsens.wechatutil.bean.po.MiniProgramUser; +import com.ccsens.wechatutil.wxmini.MiniSigninUtil; +import io.jsonwebtoken.Claims; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.RandomStringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author 逗 + */ +@Slf4j +@Service +@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class) +public class UserService implements IUserService { + @Resource + private RedisUtil redisUtil; + @Resource + private SysUserDao sysUserDao; + @Resource + private SysAuthDao sysAuthDao; + @Resource + private Snowflake snowflake; + + @Override + public UserVo.TokenBean userSignin(UserDto.SigninDto params, String deviceId, String clientIp) throws Exception { + + String identifier = params.getData().getIdentifier(); + String credential = params.getData().getCredential(); + + UserVo.UserSign userSign; + //验证客户端类型 + switch (params.getClient()) { + case 0: + //h5 只能账号登录 + userSign = accountLogin(identifier, credential); + break; + case 1: + //小程序 只能小程序登录 + userSign = wxmplogin(identifier); + break; + default: + throw new BaseException(DeliveryCodeError.CLIENT_ERROR); + } + + //手机号 +// String phone = null; +// if(ObjectUtil.isNull(userSign)){ +// switch (params.getType()) { +// case 0: +// //小程序登录 +// userSign = wxmplogin(identifier); +// break; +// case 1: +// //验证数据 +// if(StrUtil.isBlank(identifier)){ +// throw new BaseException(DeliveryCodeError.NOT_PHONE); +// } +// if(StrUtil.isBlank(credential)){ +// throw new BaseException(DeliveryCodeError.NOT_SMS_CODE); +// } +// //手机号登录 +// userSign = phoneLogin(identifier, credential, deviceId); +// phone = identifier; +// break; +// case 3: +// //账号登录 +// userSign = accountLogin(identifier, credential); +// break; +// case 4: +// //微信登录 +// WebConstant.IDENTIFY_TYPE identifyType = WebConstant.IDENTIFY_TYPE.valueOf(params.getType()); +// userSign = wxLogin(identifyType,identifier); +// break; +// default: { +// throw new BaseException(DeliveryCodeError.SIGNIN_TYPE_ERROR); +// } +// } +// } + //生成token + UserVo.TokenBean tokenBean = generateToken(userSign.getUserId(), userSign.getAuthId()); + + + tokenBean.setId(userSign.getUserId()); +// if(ObjectUtil.isNull(phone)){ +// phone = sysAuthDao.getPhoneByUserId(userSign.getUserId()); +// } +// if(ObjectUtil.isNotNull(phone)){ +// tokenBean.setPhone(phone); +// } + //获取用户信息 + SysUser sysUser = sysUserDao.selectByPrimaryKey(userSign.getUserId()); + if(ObjectUtil.isNotNull(sysUser)){ + tokenBean.setName(sysUser.getName()); + tokenBean.setAvatarUrl(sysUser.getAvatarUrl()); +// if(ObjectUtil.isNull(tokenBean.getPhone())){ + tokenBean.setPhone(sysUser.getPhone()); +// } + } + return tokenBean; + } + + /** + * 微信小程序 + */ + private UserVo.UserSign wxmplogin(String code) throws Exception { + //0.获取openid + MiniProgramUser miniProgramUser; + try { + miniProgramUser = MiniSigninUtil.signinByMini(code, DeliveryConstant.DEFAULT_APP_ID, DeliveryConstant.DEFAULT_SECRET); + }catch (Exception e){ + throw new BaseException(DeliveryCodeError.SIGNIN_ERROR); + } + if(ObjectUtil.isNull(miniProgramUser)){ + throw new BaseException(DeliveryCodeError.SIGNIN_ERROR); + } + String openId = miniProgramUser.openid; + String unionId = miniProgramUser.unionid; + log.info("小程序登录,openid:{} ,unionId:{}", openId, unionId); + return getUserSign(openId, unionId, (byte) WebConstant.IDENTIFY_TYPE.Wxmp.value); + } + /** + * @param openId + * @param unionId + * @return + */ + private UserVo.UserSign getUserSign(String openId, String unionId,byte identifyType) { + //1.查找对应账户,不存在则注册 + UserVo.UserSign userSignVo; + List authList = null; + SysAuth theAuth; + if (ObjectUtil.isNotNull(openId)) { + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo(identifyType) + .andIdentifierEqualTo(openId); + authList = sysAuthDao.selectByExample(authExample); + } + if (CollectionUtil.isEmpty(authList)) { + List sysAuthList = null; + if (ObjectUtil.isNotNull(unionId) && identifyType == WebConstant.IDENTIFY_TYPE.Wxmp.value) { + SysAuthExample sysAuthExample = new SysAuthExample(); + sysAuthExample.createCriteria().andCredentialEqualTo(unionId); + sysAuthList = sysAuthDao.selectByExample(sysAuthExample); + } + if (CollectionUtil.isNotEmpty(sysAuthList)) { + //添加认证方式 + theAuth = new SysAuth(); + theAuth.setId(snowflake.nextId()); + theAuth.setUserId(sysAuthList.get(0).getUserId()); + theAuth.setIdentifyType(identifyType); + theAuth.setIdentifier(openId); + theAuth.setCredential(unionId); + sysAuthDao.insertSelective(theAuth); + } else { + //新建用户并保存微信信息 + SysUser user = new SysUser(); + user.setId(snowflake.nextId()); + sysUserDao.insertSelective(user); + //添加认证方式 + theAuth = new SysAuth(); + theAuth.setId(snowflake.nextId()); + theAuth.setUserId(user.getId()); + theAuth.setIdentifyType(identifyType); + theAuth.setIdentifier(openId); + theAuth.setCredential(unionId); + sysAuthDao.insertSelective(theAuth); + } + } else { + theAuth = authList.get(0); + } + //2.返回 + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(theAuth.getUserId()); + userSignVo.setAuthId(theAuth.getId()); + return userSignVo; + } + + + /** + * 账号登录 + * @param account 账号密码 + * @param password 密码 + * @return 返回 + */ + private UserVo.UserSign accountLogin(String account, String password) throws Exception { + UserVo.UserSign userSignVo; + List authList; + SysAuth theAuth; + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria() + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value).andIdentifierEqualTo(account); + authList = sysAuthDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + theAuth = authList.get(0); + if (ShiroKit.authenticate(password, theAuth.getCredential(), theAuth.getSalt())) { + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(theAuth.getUserId()); + userSignVo.setAuthId(theAuth.getId()); + } else { + throw new BaseException(CodeEnum.PASSWORD_ERROR); + } + } else { + throw new BaseException(CodeEnum.PASSWORD_ERROR); + } + return userSignVo; + } + + /** + * 获取token + */ + @Override + public UserVo.TokenBean generateToken(Long userId, Object authId) { + Map payLoads = CollectionUtil.newHashMap(); + payLoads.put(WebConstant.PARAMETER_KEY_TOKEN_AUTH_ID, String.valueOf(authId)); + + UserVo.TokenBean tokenBean = new UserVo.TokenBean(); + //生成过期时间 + long tokenExpired = 3600 * 1000L * 2; + long refreshTokenExpired = 3600 * 1000L * 24 * 30; + + //1.生成token并缓存 + String token = JwtUtil.createJWT(userId + "",payLoads, tokenExpired, WebConstant.JWT_ACCESS_TOKEN_SECERT); + redisUtil.set(RedisKeyManager.getTokenCachedKey(userId), token, tokenExpired / 1000); + tokenBean.setToken(token); + + //生成refreshToken + String refreshToken = JwtUtil.createJWT(userId + "", payLoads, refreshTokenExpired, WebConstant.JWT_ACCESS_TOKEN_SECERT); + redisUtil.set(RedisKeyManager.getRefreshTokenCachedKey(userId), refreshToken, refreshTokenExpired / 1000); + tokenBean.setRefreshToken(refreshToken); + + //2.返回 + return tokenBean; + } + +// /** +// * 添加登录记录 +// */ +// private void saveSigninLog(Long userId, Long authId, String deviceId, Byte client, String clientIp) { +// SysSigninLog sysSigninLog = new SysSigninLog(); +// sysSigninLog.setId(snowflake.nextId()); +// sysSigninLog.setUserId(userId); +// sysSigninLog.setAuthId(authId); +// sysSigninLog.setTime(System.currentTimeMillis()); +// sysSigninLog.setDeviceId(deviceId); +// sysSigninLog.setClientType(client); +// sysSigninLog.setIpAddress(clientIp); +// sysSigninLogMapper.insertSelective(sysSigninLog); +// } + +// /** +// * 添加用户设备关联信息 +// * @param userId userId +// * @param deviceId 设备id +// */ +// private void saveUserDevice(Long userId, String deviceId,Integer client) { +// //查找用户和设备的关联信息,如果为空则添加关联信息 +// SysUserDeviceExample userDeviceExample = new SysUserDeviceExample(); +// userDeviceExample.createCriteria().andUserIdEqualTo(userId).andDeviceIdEqualTo(deviceId); +// List sysUserDevices = userDeviceMapper.selectByExample(userDeviceExample); +// //不存在则添加 +// if(CollectionUtil.isEmpty(sysUserDevices)){ +// SysUserDevice sysUserDevice = new SysUserDevice(); +// sysUserDevice.setId(snowflake.nextId()); +// sysUserDevice.setUserId(userId); +// sysUserDevice.setDeviceId(deviceId); +// sysUserDevice.setClientType(client.byteValue()); +// userDeviceMapper.insertSelective(sysUserDevice); +// } +// } + + /** + * 手机号登陆 + * @param phone 手机号 + * @param smsVerifyCode 验证码 + * @param deviceId 设备id + * @return 返回用户信息 + */ + private UserVo.UserSign phoneLogin(String phone, String smsVerifyCode, String deviceId) { + UserVo.UserSign userSignVo; + if (!isSmsCodeCorrect(phone, smsVerifyCode)) { + throw new BaseException(DeliveryCodeError.SMS_CODE_CORRECT); + } + //1.查找对应账户,不存在则注册 + SysAuth theAuth = sysAuthDao.getByPhone(phone); + if (ObjectUtil.isNull(theAuth)) { + theAuth = saveUser(phone, deviceId); + } + //返回用户id和认证id + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(theAuth.getUserId()); + userSignVo.setAuthId(theAuth.getId()); + + return userSignVo; + } + + /** + * 微信登陆 + * @param code 微信code + * @return 返回用户信息 + */ + private UserVo.UserSign wxLogin(WebConstant.IDENTIFY_TYPE identifyType, String code) { + UserVo.UserSign userSignVo; + //获取微信信息并保存 + log.info("公众号登陆,{}", code); + WxOauth2UserInfo wxOauth2UserInfo = WxGzhUtil.getOauth2UserInfo(identifyType, code); + log.info("获取用户的微信信息,{}", wxOauth2UserInfo); + SysAuth theAuth; + if (ObjectUtil.isNull(wxOauth2UserInfo)) { + throw new BaseException(CodeEnum.NOT_SELECT_WX); + } + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.OAUTH2_Wx.value) + .andIdentifierEqualTo(wxOauth2UserInfo.getOpenId()).andCredentialEqualTo(wxOauth2UserInfo.getUnionId()); + List authList = sysAuthDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + theAuth = authList.get(0); + log.info("该用户已有微信登录的auth信息,{}", theAuth); + } else { + SysAuthExample sysAuthExample = new SysAuthExample(); + sysAuthExample.createCriteria().andCredentialEqualTo(wxOauth2UserInfo.getUnionId()); + List sysAuthList = sysAuthDao.selectByExample(sysAuthExample); + if (CollectionUtil.isNotEmpty(sysAuthList)) { + //添加认证方式 + theAuth = new SysAuth(); + theAuth.setId(snowflake.nextId()); + theAuth.setUserId(sysAuthList.get(0).getUserId()); + } else { + //新建用户并保存微信信息 + SysUser user = new SysUser(); + user.setId(snowflake.nextId()); + user.setAvatarUrl(wxOauth2UserInfo.getHeadImgUrl()); + user.setName(wxOauth2UserInfo.getNickname()); + user.setGender((byte) wxOauth2UserInfo.getSex()); + user.setCountry(wxOauth2UserInfo.getCountry()); + user.setProvince(wxOauth2UserInfo.getProvince()); + user.setCity(wxOauth2UserInfo.getCity()); + sysUserDao.insertSelective(user); + //添加认证方式 + theAuth = new SysAuth(); + theAuth.setId(snowflake.nextId()); + theAuth.setUserId(user.getId()); + } + theAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.OAUTH2_Wx.value); + theAuth.setIdentifier(wxOauth2UserInfo.getOpenId()); + theAuth.setCredential(wxOauth2UserInfo.getUnionId()); + sysAuthDao.insertSelective(theAuth); + } + //2.返回 + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(theAuth.getUserId()); + userSignVo.setAuthId(theAuth.getId()); + log.info("认证成功返回:{}", userSignVo); + return userSignVo; + } + + + /** + * 添加用户和手机号认证方式 + * @return 认证信息 + */ + private SysAuth saveUser(String identifier, String deviceId) { + //1.添加user + SysUser user = new SysUser(); + user.setId(snowflake.nextId()); + user.setDeviceId(deviceId); + user.setAuthType((byte) 1); + sysUserDao.insertSelective(user); + //2.添加auth + SysAuth auth = new SysAuth(); + auth.setId(snowflake.nextId()); + auth.setUserId(user.getId()); + auth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Phone.value); + auth.setIdentifier(identifier); + auth.setCredential(null); + sysAuthDao.insertSelective(auth); + return auth; + } + + /** + * 判断验证码是否有效 + */ + private Boolean isSmsCodeCorrect(String phone, String smsCode) { + boolean correct = false; + //TODO 暂时1111也可以 + if("1111".equals(smsCode)){ + correct = true; + } + if (redisUtil.hasKey(RedisKeyManager.getSigninSmsKey(phone))) { + if (smsCode.equals(redisUtil.get(RedisKeyManager.getSigninSmsKey(phone)).toString())) { + correct = true; + } + } + return correct; + } + + @Override + public UserVo.SmsCode getSignInSmsCode(String phone, String verificationCodeId, String verificationCodeValue) { + //检查图形验证码是否正确 + String codeKey = WebConstant.IMAGE_CODE + verificationCodeId; + if (!redisUtil.hasKey(codeKey)) { + throw new BaseException(CodeEnum.VERIFICATION_CODE_PAST_IMG); + } + if (!verificationCodeValue.equals(String.valueOf(redisUtil.get(codeKey)))) { + throw new BaseException(CodeEnum.VERIFICATION_CODE_ERROR_IMG); + } + //验证一次,无论是否正确,都将缓存删除 + redisUtil.del(codeKey); + //验证手机号的正确性 + String regex = "[1]([3-9])[0-9]{9}$"; + Pattern p = Pattern.compile(regex); + Matcher m = p.matcher(phone); + boolean isMatch = m.matches(); + if (!isMatch) { + throw new BaseException(CodeEnum.PHONE_ERR); + } + + UserVo.SmsCode smsCodeVo; + //1.验证发送间隔是否大于指定间隔 + if (redisUtil.hasKey(RedisKeyManager.getSigninSmsExistKey(phone))) { + throw new BaseException(DeliveryCodeError.ERROR_SEND_TOO_FAST); + } + //测试环境默认发送1111 + String verifyCode; +// if (PtOsConstant.SMS_CODE.equalsIgnoreCase(PropUtil.smsCode)) { + verifyCode = RandomUtil.randomNumbers(4); +// } + //3.保存到redis中 + Integer codeValidInSeconds = WebConstant.Expired_Verify_Code_In_Seconds; + Integer codeExistInSeconds = WebConstant.Exist_Verify_Code_In_Seconds; + redisUtil.set(RedisKeyManager.getSigninSmsKey(phone), verifyCode, codeValidInSeconds); + redisUtil.set(RedisKeyManager.getSigninSmsExistKey(phone), verifyCode, codeExistInSeconds); + + //5.发送验证码 +// if (PtOsConstant.SMS_CODE.equalsIgnoreCase(PropUtil.smsCode)) { + SmsUtil.sendSms(phone, verifyCode, "", codeValidInSeconds); +// } + //6.返回 + smsCodeVo = new UserVo.SmsCode(); + smsCodeVo.setPhone(phone); + smsCodeVo.setSmsCode(verifyCode); + smsCodeVo.setExpiredInSeconds(WebConstant.Expired_Verify_Code_In_Seconds); + return smsCodeVo; + } + + @Override + public UserVo.VerificationCode getVertifyCode() { + Map codeMap = ImageCodeGeneratorUtil.generateCountCode(); + //生成一个id + long id = snowflake.nextId(); + //将两个数的和,存在redis内,key为新生成的id + String imageCodeKey = WebConstant.IMAGE_CODE + id; + redisUtil.set(imageCodeKey, codeMap.get("sum"), 90); + log.info("将图形验证码存入redis:{},,,{}", imageCodeKey,codeMap.get("sum")); + String imageBase64 = "data:image/png;base64," + ImageCodeGeneratorUtil.generateCodeImage(null, (String) codeMap.get("imageCode"), 200, 70); + + UserVo.VerificationCode vertifyCode = new UserVo.VerificationCode(); + vertifyCode.setImageBase64(imageBase64); + vertifyCode.setVerificationCodeId(String.valueOf(id)); + + return vertifyCode; + } + + @Override + public UserVo.TokenToUserId getUserByToken(UserDto.UserInfoByToken params) { + UserVo.TokenToUserId userInfo; + if(StrUtil.isNotBlank(params.getToken())){ + //根据token获取userId + userInfo = getUserByToken(params.getToken()); + }else { +// //根据deviceId获取userId +// userInfo = getUserByDeviceId(params); + throw new BaseException(CodeEnum.NOT_LOGIN); + } + return userInfo; + } + + /** + * 根据token获取用户信息 + * @param token token + */ + private UserVo.TokenToUserId getUserByToken(String token) { + UserVo.TokenToUserId userInfo = new UserVo.TokenToUserId(); + //如果token不为空,获取用户信息 + if (!token.startsWith(WebConstant.HEADER_KEY_TOKEN_PREFIX)) { + log.info("token不存在:{}",token); + throw new BaseException(CodeEnum.NOT_LOGIN); + } + String userToken = token.substring(WebConstant.HEADER_KEY_TOKEN_PREFIX.length()); + //验证token是否有效 + Claims claims; + try { + claims = JwtUtil.parseJWT(userToken, WebConstant.JWT_ACCESS_TOKEN_SECERT); + }catch(Exception e){ + log.info("token无效"); + throw new BaseException(CodeEnum.NOT_LOGIN); + } + //验证用户存根 + if(!redisUtil.hasKey(RedisKeyManager.getTokenCachedKey(Long.valueOf(claims.getSubject())))){ + log.info("用户存根不存在:{}",claims.getSubject()); + throw new BaseException(CodeEnum.NOT_LOGIN); + } + SysUser sysUser = sysUserDao.selectByPrimaryKey(Long.valueOf(claims.getSubject())); + if(ObjectUtil.isNull(sysUser)){ + throw new BaseException(CodeEnum.NOT_LOGIN); + } + + //获取用户信息 + BeanUtil.copyProperties(sysUser,userInfo); + userInfo.setUserName(sysUser.getName()); + //查找手机号 + userInfo.setPhone(sysAuthDao.getPhoneByUserId(Long.valueOf(claims.getSubject()))); + + return userInfo; + } + + /** + * 根据deviceId获取userId + * @param params 设备id等 + */ + private UserVo.TokenToUserId getUserByDeviceId(UserDto.UserInfoByToken params) { + UserVo.TokenToUserId userInfo = new UserVo.TokenToUserId(); + //如果token为空,则用deviceId获取用户信息 + if(StrUtil.isBlank(params.getDeviceId())){ + throw new BaseException(DeliveryCodeError.ILLEGAL_LOG_IN); + } + synchronized (this) { + //查找deviceId关联的临时用户 + SysUser sysUser = sysUserDao.getVisitorUser(params.getDeviceId()); + log.info("查找deviceId用户:{}" ,sysUser); + if(ObjectUtil.isNotNull(sysUser)){ + BeanUtil.copyProperties(sysUser,userInfo); + userInfo.setUserName(sysUser.getName()); + }else { + //以前没有关联用户则新建一个 + sysUser = new SysUser(); + sysUser.setId(snowflake.nextId()); + sysUser.setDeviceId(params.getDeviceId()); + sysUser.setAuthType((byte) 0); + sysUserDao.insertSelective(sysUser); + userInfo.setId(sysUser.getId()); + } +// userInfo.setAuthType(sysUser.getAuthType()); +// //添加登录记录 +// saveSigninLog(sysUser.getId(), 0L,params.getDeviceId(), params.getClientType(),params.getClientIp()); + //重新生成token + UserVo.TokenBean tokenBean = generateToken(sysUser.getId(), 0L); + userInfo.setToken(tokenBean.getToken()); + userInfo.setRefreshToken(tokenBean.getRefreshToken()); + } + return userInfo; + } + + @Override + public UserVo.TokenBean getTokenByRefreshToken(String refreshToken) { + Claims claims; + try { + claims = JwtUtil.parseJWT(refreshToken, WebConstant.JWT_ACCESS_TOKEN_SECERT); + }catch(Exception e){ + log.info("token无效"); + throw new BaseException(DeliveryCodeError.NOT_REFRESH_TOKEN); + } + //获取userId和authId + String subject = claims.getSubject(); + Object authId = claims.get(WebConstant.PARAMETER_KEY_TOKEN_AUTH_ID); + //验证用户存根 + if(!redisUtil.hasKey(RedisKeyManager.getRefreshTokenCachedKey(Long.valueOf(subject)))){ + log.info("用户存根不存在:{}",claims.getSubject()); + throw new BaseException(DeliveryCodeError.NOT_REFRESH_TOKEN); + } + //检查用户是否存在 + SysUser sysUser = sysUserDao.selectByPrimaryKey(Long.valueOf(claims.getSubject())); + if(ObjectUtil.isNull(sysUser)){ + throw new BaseException(DeliveryCodeError.NOT_REFRESH_TOKEN); + } + //重新生成token + Map payLoads = CollectionUtil.newHashMap(); + payLoads.put(WebConstant.PARAMETER_KEY_TOKEN_AUTH_ID, String.valueOf(authId)); + //生成过期时间 + long tokenExpired = 3600 * 1000L * 2; + //生成token并缓存 + String token = JwtUtil.createJWT(subject + "",payLoads, tokenExpired, WebConstant.JWT_ACCESS_TOKEN_SECERT); + redisUtil.set(RedisKeyManager.getTokenCachedKey(subject), token, tokenExpired / 1000); + + UserVo.TokenBean tokenBean = new UserVo.TokenBean(); + tokenBean.setToken(token); + tokenBean.setRefreshToken(refreshToken); + tokenBean.setId(sysUser.getId()); + tokenBean.setAvatarUrl(sysUser.getAvatarUrl()); + tokenBean.setPhone(sysAuthDao.getPhoneByUserId(sysUser.getId())); + return tokenBean; + } + +// @Override +// public UserVo.TokenToUserId userByBusinessToken(String accessToken, UserDto.BusinessToken params) { +// //验证业务的accessToken +// Claims claims; +// try { +// claims = JwtUtil.parseJWT(accessToken, WebConstant.JWT_ACCESS_TOKEN_SECERT); +// }catch(Exception e){ +// log.info("token无效"); +// throw new BaseException(CodeEnum.NOT_LOGIN); +// } +// //检查业务是否存在 +// String appId = claims.getSubject(); +// Object secret = claims.get(WebConstant.ACCESS_TOKEN_SECRET); +// OpenBusinessExample openBusinessExample = new OpenBusinessExample(); +// openBusinessExample.createCriteria().andAppIdEqualTo(appId).andSecretEqualTo(String.valueOf(secret)); +// long l = businessMapper.countByExample(openBusinessExample); +// if(l == 0){ +// throw new BaseException(DeliveryCodeError.NOT_BUSINESS); +// } +// //根据token查找用户信息 +// //验证token是否有效 +// +// Claims userClaims; +// try { +// userClaims = JwtUtil.parseJWT(params.getToken(), WebConstant.JWT_ACCESS_TOKEN_SECERT); +// }catch(Exception e){ +// log.info("token无效"); +// throw new BaseException(CodeEnum.NOT_LOGIN); +// } +// //验证用户存根 +// if(!redisUtil.hasKey(RedisKeyManager.getTokenCachedKey(Long.valueOf(userClaims.getSubject())))){ +// log.info("用户存根不存在:{}",userClaims.getSubject()); +// throw new BaseException(CodeEnum.NOT_LOGIN); +// } +// SysUser sysUser = sysUserDao.selectByPrimaryKey(Long.valueOf(userClaims.getSubject())); +// if(ObjectUtil.isNull(sysUser)){ +// throw new BaseException(CodeEnum.NOT_LOGIN); +// } +// UserVo.TokenToUserId userInfo = new UserVo.TokenToUserId(); +// userInfo.setId(sysUser.getId()); +// //获取用户信息 +// userInfo.setAvatarUrl(sysUser.getAvatarUrl()); +// userInfo.setUserName(sysUser.getName()); +// userInfo.setAuthType(sysUser.getAuthType()); +// +// //查找手机号 +// userInfo.setPhone(sysAuthDao.getPhoneByUserId(sysUser.getId())); + //返回用户信息 +// return getUserByToken(params.getToken()); +// } + + @Override + public List getUserIdByPhone(List phoneList) { + List userIdByPhone = null; + if(CollectionUtil.isNotEmpty(phoneList)){ + userIdByPhone = sysUserDao.getUserIdByPhone(phoneList); + } + return userIdByPhone; + } + + + @Override + public UserVo.TokenBean updateUserInfo(Long userId, UserDto.WxInfo userInfo) { + //通过userId查找到用户 + SysUser user = sysUserDao.selectByPrimaryKey(userId); + if (ObjectUtil.isNull(user)) { + throw new BaseException(CodeEnum.NOT_USER); + } + + if (StrUtil.isNotEmpty(userInfo.getNickname())) { + user.setName(userInfo.getNickname()); + } + if (StrUtil.isNotEmpty(userInfo.getHeadImgUrl())) { + user.setAvatarUrl(userInfo.getHeadImgUrl()); + } + if (ObjectUtil.isNotNull(userInfo.getSex())) { + user.setGender(userInfo.getSex()); + } + if (StrUtil.isNotEmpty(userInfo.getCountry())) { + user.setCountry(userInfo.getCountry()); + } + if (StrUtil.isNotEmpty(userInfo.getProvince())) { + user.setProvince(userInfo.getProvince()); + } + if (StrUtil.isNotEmpty(userInfo.getCity())) { + user.setCity(userInfo.getCity()); + } + sysUserDao.updateByPrimaryKeySelective(user); + //返回信息 + UserVo.TokenBean tokenBean = new UserVo.TokenBean(); + tokenBean.setId(user.getId()); + String phone = sysAuthDao.getPhoneByUserId(user.getId()); + tokenBean.setPhone(phone); + //获取用户信息 + tokenBean.setName(user.getName()); + tokenBean.setAvatarUrl(user.getAvatarUrl()); + if(ObjectUtil.isNull(tokenBean.getPhone())){ + tokenBean.setPhone(user.getPhone()); + } + return tokenBean; + } +} diff --git a/src/main/java/com/ccsens/delivery/util/DeliveryCodeError.java b/src/main/java/com/ccsens/delivery/util/DeliveryCodeError.java new file mode 100644 index 0000000..eb8548f --- /dev/null +++ b/src/main/java/com/ccsens/delivery/util/DeliveryCodeError.java @@ -0,0 +1,19 @@ +package com.ccsens.delivery.util; + +import com.ccsens.util.CodeError; + +/** + * @author 逗 + */ +public class DeliveryCodeError extends CodeError { + public static final Code SMS_CODE_CORRECT = new Code(46,"请输入正确验证码",true); + public static final Code ILLEGAL_LOG_IN = new Code(400,"非法登录",true); + public static final Code NOT_REFRESH_TOKEN = new Code(401,"refreshToken过期,请重新登录",true); + public static final Code CLIENT_ERROR = new Code(501,"客户端类型异常",true); + public static final Code SIGNIN_ERROR = new Code(502,"登录异常",true); + public static final Code NOT_PHONE = new Code(503,"手机号不能为空",true); + public static final Code NOT_SMS_CODE = new Code(504,"请填写手机号验证码",true); + public static final Code ERROR_SEND_TOO_FAST = new Code(505,"60秒内只能发送一次,请稍后再试",false); + public static final Code NOT_BUSINESS = new Code(506,"业务信息异常",true); + +} diff --git a/src/main/java/com/ccsens/delivery/util/DeliveryConstant.java b/src/main/java/com/ccsens/delivery/util/DeliveryConstant.java new file mode 100644 index 0000000..564c4b2 --- /dev/null +++ b/src/main/java/com/ccsens/delivery/util/DeliveryConstant.java @@ -0,0 +1,34 @@ +package com.ccsens.delivery.util; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author 逗 + */ +public class DeliveryConstant { + + /**是否发送验证码 0不发送 1发送*/ + public static final String SMS_CODE = "1"; + + /**默认公众号appId*/ + public static final String DEFAULT_APP_ID = "wxb3be21dcd7912555"; + /**默认公众号secret*/ + public static final String DEFAULT_SECRET = "9213776254878a8065f1a29d1f58a02c"; + + /**图片类型*/ + public static final String FILE_TYPE_IMG = "bmp,jpg,jpeg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,WMF,webp"; + /**文档类型*/ + public static final String FILE_TYPE_DOCUMENT = "doc, dot, wps, wpt, docx, dotx, docm, dotm, xls, xlt, et, xlsx, xltx, csv, xlsm, xltm, ppt,pptx,pptm,ppsx,ppsm,pps,potx,potm,dpt,dps, pdf"; + + + /**验证手机正则*/ + public static final String PHONE_REGEX = "^[1]([3-9])[0-9]{9}$"; + /**字符串分隔符*/ + public static final String STRING_REGEX = ",|,|;|;|、|/"; + + + + + +} diff --git a/src/main/resources/application-common.yml b/src/main/resources/application-common.yml new file mode 100644 index 0000000..33d6173 --- /dev/null +++ b/src/main/resources/application-common.yml @@ -0,0 +1,30 @@ +logging: + level: + com: + favorites: DEBUG + org: + hibernate: ERROR + springframework: + web: DEBUG +mybatis: + config-location: classpath:mybatis/mybatis-config.xml + mapper-locations: classpath*:mapper_*/*.xml +# type-aliases-package: com.ccsens.mtpro.bean +#server: +# tomcat: +# uri-encoding: UTF-8 +spring: + http: + encoding: + charset: UTF-8 + enabled: true + force: true + log-request-details: true + servlet: + multipart: + max-file-size: 200MB + max-request-size: 200MB + snowflake: + dataCenterId: 2 + workerId: 2 + diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml new file mode 100644 index 0000000..07e5fc6 --- /dev/null +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,53 @@ +server: + port: 7340 + servlet: + context-path: /v1.0 +spring: + application: + name: delivery + datasource: + type: com.alibaba.druid.pool.DruidDataSource +# rabbitmq: +# host: 192.168.0.99 +# password: 111111 +# port: 5672 +# username: admin +# rabbitmq: +# host: dd.tall.wiki +# password: 111111 +# port: 5672 +# username: admin +# redis: +# database: 0 +# host: 127.0.0.1 +# jedis: +# pool: +# max-active: 200 +# max-idle: 10 +# max-wait: -1ms +# min-idle: 0 +# password: '' +# port: 6379 +# timeout: 1000ms +swagger: + enable: true +#mybatisCache: +# database: 1 +# host: 127.0.0.1 +# jedis: +# pool: +# max-active: 200 +# max-idle: 10 +# max-wait: -1 +# min-idle: 0 +# password: '' +# port: 6379 +# timeout: 1000 + +file: + path: /home/cloud/delivery/server/uploads/ + domain: http://127.0.0.1:7280/v1.0/ + imgDomain: http://127.0.0.1:7280/v1.0/uploads/ +url: + token: http://101.201.226.163/gateway/ptostall/users/token + subscriptWx: http://101.201.226.163/gateway/ptostall/wx/officialId \ No newline at end of file diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml new file mode 100644 index 0000000..5e75a83 --- /dev/null +++ b/src/main/resources/application-prod.yml @@ -0,0 +1,19 @@ +server: + port: 7340 + servlet: + context-path: /v1.0 +spring: + application: + name: delivery + datasource: + type: com.alibaba.druid.pool.DruidDataSource +swagger: + enable: true + +file: + path: /home/cloud/delivery/server/uploads/ + domain: https://www.tall.wiki/delivery/v1.0/ + imgDomain: https://www.tall.wiki/delivery/v1.0/uploads/ +url: + token: http://101.201.226.163/gateway/ptostall/users/token + subscriptWx: http://101.201.226.163/gateway/ptostall/wx/officialId \ No newline at end of file diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml new file mode 100644 index 0000000..b08f9e0 --- /dev/null +++ b/src/main/resources/application-test.yml @@ -0,0 +1,19 @@ +server: + port: 7340 + servlet: + context-path: /v1.0 +spring: + application: + name: delivery + datasource: + type: com.alibaba.druid.pool.DruidDataSource +swagger: + enable: true + +file: + path: /home/cloud/delivery/server/uploads/ + domain: http://test.tall.wiki/delivery/v1.0/ + imgDomain: http://test.tall.wiki/delivery/v1.0/uploads/ +url: + token: http://101.201.226.163/gateway/ptostall/users/token + subscriptWx: http://101.201.226.163/gateway/ptostall/wx/officialId \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..0ee65bb --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,4 @@ +spring: + profiles: + active: test + include: common diff --git a/src/main/resources/druid-dev.yml b/src/main/resources/druid-dev.yml new file mode 100644 index 0000000..01a52aa --- /dev/null +++ b/src/main/resources/druid-dev.yml @@ -0,0 +1,35 @@ +spring: + datasource: + druid: + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + driverClassName: com.mysql.cj.jdbc.Driver + dynamicUrl: jdbc:mysql://localhost:3306/${schema} + filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' + filterName: druidFilter + filterProfileEnable: true + filterUrlPattern: /* + filters: stat,wall + initialSize: 5 + maxActive: 20 + maxPoolPreparedStatementPerConnectionSize: 20 + maxWait: 60000 + minEvictableIdleTimeMillis: 300000 + minIdle: 5 +# password: 37080c1f223685592316b02dad8816c019290a476e54ebb638f9aa3ba8b6bdb9 + password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 + poolPreparedStatements: true + servletLogSlowSql: true + servletLoginPassword: 111111 + servletLoginUsername: druid + servletName: druidServlet + servletResetEnable: true + servletUrlMapping: /druid/* + testOnBorrow: false + testOnReturn: false + testWhileIdle: true + timeBetweenEvictionRunsMillis: 60000 + url: jdbc:mysql://test.tall.wiki:3306/delivery?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true + username: root + validationQuery: SELECT 1 FROM DUAL +# env: CCSENS_GAME + env: CCSENS_TALL \ No newline at end of file diff --git a/src/main/resources/druid-prod.yml b/src/main/resources/druid-prod.yml new file mode 100644 index 0000000..e4eb34f --- /dev/null +++ b/src/main/resources/druid-prod.yml @@ -0,0 +1,33 @@ +spring: + datasource: + druid: + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + driverClassName: com.mysql.cj.jdbc.Driver + dynamicUrl: jdbc:mysql://localhost:3306/${schema} + filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' + filterName: druidFilter + filterProfileEnable: true + filterUrlPattern: /* + filters: stat,wall + initialSize: 5 + maxActive: 20 + maxPoolPreparedStatementPerConnectionSize: 20 + maxWait: 60000 + minEvictableIdleTimeMillis: 300000 + minIdle: 5 + password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 + poolPreparedStatements: true + servletLogSlowSql: true + servletLoginPassword: 111111 + servletLoginUsername: druid + servletName: druidServlet + servletResetEnable: true + servletUrlMapping: /druid/* + testOnBorrow: false + testOnReturn: false + testWhileIdle: true + timeBetweenEvictionRunsMillis: 60000 + url: jdbc:mysql://127.0.0.1/delivery?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true + username: root + validationQuery: SELECT 1 FROM DUAL + env: CCSENS_TALL \ No newline at end of file diff --git a/src/main/resources/druid-test.yml b/src/main/resources/druid-test.yml new file mode 100644 index 0000000..59db4b9 --- /dev/null +++ b/src/main/resources/druid-test.yml @@ -0,0 +1,33 @@ +spring: + datasource: + druid: + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + driverClassName: com.mysql.cj.jdbc.Driver + dynamicUrl: jdbc:mysql://localhost:3306/${schema} + filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' + filterName: druidFilter + filterProfileEnable: true + filterUrlPattern: /* + filters: stat,wall + initialSize: 5 + maxActive: 20 + maxPoolPreparedStatementPerConnectionSize: 20 + maxWait: 60000 + minEvictableIdleTimeMillis: 300000 + minIdle: 5 + password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 + poolPreparedStatements: true + servletLogSlowSql: true + servletLoginPassword: 111111 + servletLoginUsername: druid + servletName: druidServlet + servletResetEnable: true + servletUrlMapping: /druid/* + testOnBorrow: false + testOnReturn: false + testWhileIdle: true + timeBetweenEvictionRunsMillis: 60000 + url: jdbc:mysql://test.tall.wiki:3306/delivery?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true + username: root + validationQuery: SELECT 1 FROM DUAL + env: CCSENS_TALL \ No newline at end of file diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..f82881b --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,196 @@ + + + + + + + + + + logback + + + + + + + + + + + + + + + + + info + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + + + ${log.path}/log_debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/log_info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/log_warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + + ${log.path}/log_error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper_dao/SysAuthDao.xml b/src/main/resources/mapper_dao/SysAuthDao.xml new file mode 100644 index 0000000..7757676 --- /dev/null +++ b/src/main/resources/mapper_dao/SysAuthDao.xml @@ -0,0 +1,27 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper_dao/SysUserDao.xml b/src/main/resources/mapper_dao/SysUserDao.xml new file mode 100644 index 0000000..b03343a --- /dev/null +++ b/src/main/resources/mapper_dao/SysUserDao.xml @@ -0,0 +1,53 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper_raw/SysAuthMapper.xml b/src/main/resources/mapper_raw/SysAuthMapper.xml new file mode 100644 index 0000000..762586c --- /dev/null +++ b/src/main/resources/mapper_raw/SysAuthMapper.xml @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, user_id, identify_type, identifier, credential, salt, operator, created_at, updated_at, + rec_status + + + + + delete from t_sys_auth + where id = #{id,jdbcType=BIGINT} + + + delete from t_sys_auth + + + + + + insert into t_sys_auth (id, user_id, identify_type, + identifier, credential, salt, + operator, created_at, updated_at, + rec_status) + values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{identifyType,jdbcType=TINYINT}, + #{identifier,jdbcType=VARCHAR}, #{credential,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR}, + #{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, + #{recStatus,jdbcType=TINYINT}) + + + insert into t_sys_auth + + + id, + + + user_id, + + + identify_type, + + + identifier, + + + credential, + + + salt, + + + operator, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{userId,jdbcType=BIGINT}, + + + #{identifyType,jdbcType=TINYINT}, + + + #{identifier,jdbcType=VARCHAR}, + + + #{credential,jdbcType=VARCHAR}, + + + #{salt,jdbcType=VARCHAR}, + + + #{operator,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_sys_auth + + + id = #{record.id,jdbcType=BIGINT}, + + + user_id = #{record.userId,jdbcType=BIGINT}, + + + identify_type = #{record.identifyType,jdbcType=TINYINT}, + + + identifier = #{record.identifier,jdbcType=VARCHAR}, + + + credential = #{record.credential,jdbcType=VARCHAR}, + + + salt = #{record.salt,jdbcType=VARCHAR}, + + + operator = #{record.operator,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_sys_auth + set id = #{record.id,jdbcType=BIGINT}, + user_id = #{record.userId,jdbcType=BIGINT}, + identify_type = #{record.identifyType,jdbcType=TINYINT}, + identifier = #{record.identifier,jdbcType=VARCHAR}, + credential = #{record.credential,jdbcType=VARCHAR}, + salt = #{record.salt,jdbcType=VARCHAR}, + operator = #{record.operator,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_sys_auth + + + user_id = #{userId,jdbcType=BIGINT}, + + + identify_type = #{identifyType,jdbcType=TINYINT}, + + + identifier = #{identifier,jdbcType=VARCHAR}, + + + credential = #{credential,jdbcType=VARCHAR}, + + + salt = #{salt,jdbcType=VARCHAR}, + + + operator = #{operator,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_sys_auth + set user_id = #{userId,jdbcType=BIGINT}, + identify_type = #{identifyType,jdbcType=TINYINT}, + identifier = #{identifier,jdbcType=VARCHAR}, + credential = #{credential,jdbcType=VARCHAR}, + salt = #{salt,jdbcType=VARCHAR}, + operator = #{operator,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/src/main/resources/mapper_raw/SysUserMapper.xml b/src/main/resources/mapper_raw/SysUserMapper.xml new file mode 100644 index 0000000..00da819 --- /dev/null +++ b/src/main/resources/mapper_raw/SysUserMapper.xml @@ -0,0 +1,385 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, name, gender, avatar_url, country, province, city, phone, id_card, power, device_id, + auth_type, operator, created_at, updated_at, rec_status + + + + + delete from t_sys_user + where id = #{id,jdbcType=BIGINT} + + + delete from t_sys_user + + + + + + insert into t_sys_user (id, name, gender, + avatar_url, country, province, + city, phone, id_card, + power, device_id, auth_type, + operator, created_at, updated_at, + rec_status) + values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT}, + #{avatarUrl,jdbcType=VARCHAR}, #{country,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, + #{city,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{idCard,jdbcType=VARCHAR}, + #{power,jdbcType=TINYINT}, #{deviceId,jdbcType=VARCHAR}, #{authType,jdbcType=TINYINT}, + #{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, + #{recStatus,jdbcType=TINYINT}) + + + insert into t_sys_user + + + id, + + + name, + + + gender, + + + avatar_url, + + + country, + + + province, + + + city, + + + phone, + + + id_card, + + + power, + + + device_id, + + + auth_type, + + + operator, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{name,jdbcType=VARCHAR}, + + + #{gender,jdbcType=TINYINT}, + + + #{avatarUrl,jdbcType=VARCHAR}, + + + #{country,jdbcType=VARCHAR}, + + + #{province,jdbcType=VARCHAR}, + + + #{city,jdbcType=VARCHAR}, + + + #{phone,jdbcType=VARCHAR}, + + + #{idCard,jdbcType=VARCHAR}, + + + #{power,jdbcType=TINYINT}, + + + #{deviceId,jdbcType=VARCHAR}, + + + #{authType,jdbcType=TINYINT}, + + + #{operator,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_sys_user + + + id = #{record.id,jdbcType=BIGINT}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + gender = #{record.gender,jdbcType=TINYINT}, + + + avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}, + + + country = #{record.country,jdbcType=VARCHAR}, + + + province = #{record.province,jdbcType=VARCHAR}, + + + city = #{record.city,jdbcType=VARCHAR}, + + + phone = #{record.phone,jdbcType=VARCHAR}, + + + id_card = #{record.idCard,jdbcType=VARCHAR}, + + + power = #{record.power,jdbcType=TINYINT}, + + + device_id = #{record.deviceId,jdbcType=VARCHAR}, + + + auth_type = #{record.authType,jdbcType=TINYINT}, + + + operator = #{record.operator,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_sys_user + set id = #{record.id,jdbcType=BIGINT}, + name = #{record.name,jdbcType=VARCHAR}, + gender = #{record.gender,jdbcType=TINYINT}, + avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}, + country = #{record.country,jdbcType=VARCHAR}, + province = #{record.province,jdbcType=VARCHAR}, + city = #{record.city,jdbcType=VARCHAR}, + phone = #{record.phone,jdbcType=VARCHAR}, + id_card = #{record.idCard,jdbcType=VARCHAR}, + power = #{record.power,jdbcType=TINYINT}, + device_id = #{record.deviceId,jdbcType=VARCHAR}, + auth_type = #{record.authType,jdbcType=TINYINT}, + operator = #{record.operator,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_sys_user + + + name = #{name,jdbcType=VARCHAR}, + + + gender = #{gender,jdbcType=TINYINT}, + + + avatar_url = #{avatarUrl,jdbcType=VARCHAR}, + + + country = #{country,jdbcType=VARCHAR}, + + + province = #{province,jdbcType=VARCHAR}, + + + city = #{city,jdbcType=VARCHAR}, + + + phone = #{phone,jdbcType=VARCHAR}, + + + id_card = #{idCard,jdbcType=VARCHAR}, + + + power = #{power,jdbcType=TINYINT}, + + + device_id = #{deviceId,jdbcType=VARCHAR}, + + + auth_type = #{authType,jdbcType=TINYINT}, + + + operator = #{operator,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_sys_user + set name = #{name,jdbcType=VARCHAR}, + gender = #{gender,jdbcType=TINYINT}, + avatar_url = #{avatarUrl,jdbcType=VARCHAR}, + country = #{country,jdbcType=VARCHAR}, + province = #{province,jdbcType=VARCHAR}, + city = #{city,jdbcType=VARCHAR}, + phone = #{phone,jdbcType=VARCHAR}, + id_card = #{idCard,jdbcType=VARCHAR}, + power = #{power,jdbcType=TINYINT}, + device_id = #{deviceId,jdbcType=VARCHAR}, + auth_type = #{authType,jdbcType=TINYINT}, + operator = #{operator,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/src/main/resources/mbg.xml b/src/main/resources/mbg.xml new file mode 100644 index 0000000..a8418a9 --- /dev/null +++ b/src/main/resources/mbg.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + \ No newline at end of file diff --git a/src/main/resources/mybatis/mybatis-config.xml b/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e5a218d --- /dev/null +++ b/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file