diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/.gitignore" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/.gitignore" new file mode 100644 index 0000000000000000000000000000000000000000..549e00a2a96fa9d7c5dbc9859664a78d980158c2 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/.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/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/.mvn/wrapper/maven-wrapper.jar" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/.mvn/wrapper/maven-wrapper.jar" new file mode 100644 index 0000000000000000000000000000000000000000..c1dd12f17644411d6e840bd5a10c6ecda0175f18 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/.mvn/wrapper/maven-wrapper.jar" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/.mvn/wrapper/maven-wrapper.properties" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/.mvn/wrapper/maven-wrapper.properties" new file mode 100644 index 0000000000000000000000000000000000000000..b7cb93e7050f42ff587aefbc40cc038ad4fa3271 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/.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/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/mvnw" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/mvnw" new file mode 100644 index 0000000000000000000000000000000000000000..8a8fb2282df5b8f7263470a5a2dc0e196f35f35f --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/mvnw" @@ -0,0 +1,316 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/mvnw.cmd" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/mvnw.cmd" new file mode 100644 index 0000000000000000000000000000000000000000..1d8ab018eaf11d9b3a4a90e7818ace373dfbb380 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/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/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/pom.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/pom.xml" new file mode 100644 index 0000000000000000000000000000000000000000..9a50d8929f3925e0da6ea6b2facd3a8943635981 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/pom.xml" @@ -0,0 +1,60 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.7.0 + + + com.example + spring + 0.0.1-SNAPSHOT + spring + Demo project for Spring Boot + + 18 + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.alibaba + druid-spring-boot-starter + 1.1.10 + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.1.4 + + + + mysql + mysql-connector-java + runtime + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/Application.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/Application.java" new file mode 100644 index 0000000000000000000000000000000000000000..c6584004593d89ea45eed8727d013e8bc9a372d5 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/Application.java" @@ -0,0 +1,16 @@ +package com.example.spring; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; + +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) +@MapperScan("com.example.spring.mapper") +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/config/Config.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/config/Config.java" new file mode 100644 index 0000000000000000000000000000000000000000..0e79b7286a037215c4fe4af4d1f733337e354e62 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/config/Config.java" @@ -0,0 +1,18 @@ +package com.example.spring.config; + +import org.springframework.beans.factory.annotation.Configurable; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; + +import javax.sql.DataSource; + +@Configurable +public class Config { + + @Bean("myDataSource") +// @ConfigurationProperties(prefix = "spring.durid.datasource.master") + public DataSource myDataSource(){ + return DataSourceBuilder.create().build(); + } +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/domain/User.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/domain/User.java" new file mode 100644 index 0000000000000000000000000000000000000000..fe123b712ab0f65ab127fa7c288f0b4e2f153a1c --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/domain/User.java" @@ -0,0 +1,23 @@ +package com.example.spring.domain; + +public class User { + + private String id; + private String userName; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/mapper/UserMapper.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/mapper/UserMapper.java" new file mode 100644 index 0000000000000000000000000000000000000000..6f650788da6e95772f3a9435a0300f0ea645bdff --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/mapper/UserMapper.java" @@ -0,0 +1,14 @@ +package com.example.spring.mapper; + +import com.example.spring.domain.User; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +public interface UserMapper { + + @Select("select * from user") + List findUsers(); + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/service/UserService.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/service/UserService.java" new file mode 100644 index 0000000000000000000000000000000000000000..1c927c82b019e15427f9ffe973d5f218b6169632 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/java/com/example/spring/service/UserService.java" @@ -0,0 +1,24 @@ +package com.example.spring.service; + +import com.example.spring.domain.User; +import com.example.spring.mapper.UserMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class UserService { + + @Autowired + private UserMapper userMapper; + + + public void findUses(){ + // 查询Master + List allUserM = userMapper.findUsers(); + System.out.println(allUserM); + } + + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/resources/application.properties" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/resources/application.properties" new file mode 100644 index 0000000000000000000000000000000000000000..713c92a7dbedfd4ee305870dd7149f0ded74ec79 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/main/resources/application.properties" @@ -0,0 +1,8 @@ +#spring.druid.datasource.master.password=root +#spring.druid.datasource.master.username=root +#spring.druid.datasource.master.jdbc-url=jdbc:mysql://localhost:3306/product_master?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC +#spring.druid.datasource.master.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.driver=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8&useSSL=true&serverTimezone=UTC +spring.datasource.username=star +spring.datasource.password=123456 diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/test/java/com/example/spring/ApplicationTests.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/test/java/com/example/spring/ApplicationTests.java" new file mode 100644 index 0000000000000000000000000000000000000000..62fb0f34549fbdf7ca6f2bda4929e85d4e35e670 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/privateTeach/spring/src/test/java/com/example/spring/ApplicationTests.java" @@ -0,0 +1,22 @@ +package com.example.spring; + +import com.example.spring.domain.User; +import com.example.spring.service.UserService; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.util.List; + +@SpringBootTest +class ApplicationTests { + + @Autowired + private UserService userService; + + @Test + void contextLoads() { + userService.findUses(); + } + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/.gitignore" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/.gitignore" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/compiler.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/compiler.xml" new file mode 100644 index 0000000000000000000000000000000000000000..3c7615b54e383216c817bcaacdb0167256cd7155 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/compiler.xml" @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/encodings.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/encodings.xml" new file mode 100644 index 0000000000000000000000000000000000000000..aa00ffab7828f4818589659c804ec2cfd99baed3 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/encodings.xml" @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/jarRepositories.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/jarRepositories.xml" new file mode 100644 index 0000000000000000000000000000000000000000..712ab9d985c20018a0c97b93d2148ac1ffe588a5 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/jarRepositories.xml" @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__c3p0_c3p0_0_9_1_2.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__c3p0_c3p0_0_9_1_2.xml" new file mode 100644 index 0000000000000000000000000000000000000000..fead87ba59028563709f5345de392462fe32db37 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__c3p0_c3p0_0_9_1_2.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml" new file mode 100644 index 0000000000000000000000000000000000000000..14681ee84083f43045a16158c0e62720d8f4e0bd --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__jaxen_jaxen_1_1_6.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__jaxen_jaxen_1_1_6.xml" new file mode 100644 index 0000000000000000000000000000000000000000..1784cea4a48b751fda3ffc4be7e9686b8ac47f93 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__jaxen_jaxen_1_1_6.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__junit_junit_4_10.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__junit_junit_4_10.xml" new file mode 100644 index 0000000000000000000000000000000000000000..ed8bf5fe7f8a4a5117ac81f4ce4364cb1ca7cef2 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__junit_junit_4_10.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__log4j_log4j_1_2_12.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__log4j_log4j_1_2_12.xml" new file mode 100644 index 0000000000000000000000000000000000000000..f398ab4af54eaa7ce32f96f2805fff4ca9510548 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__log4j_log4j_1_2_12.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_17.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_17.xml" new file mode 100644 index 0000000000000000000000000000000000000000..c3b7f46c4577306ee5f197375911a72057cc8a22 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_17.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml" new file mode 100644 index 0000000000000000000000000000000000000000..acdf44300b42ccd0a7dec6d5b31ed08c48e2b071 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__xml_apis_xml_apis_1_0_b2.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__xml_apis_xml_apis_1_0_b2.xml" new file mode 100644 index 0000000000000000000000000000000000000000..c36e71714a7d641de87adc2d59533145c852f652 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/libraries/Maven__xml_apis_xml_apis_1_0_b2.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/misc.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/misc.xml" new file mode 100644 index 0000000000000000000000000000000000000000..25daa30c84345e5483c3a3fdc5423595e648d486 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/misc.xml" @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/modules.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/modules.xml" new file mode 100644 index 0000000000000000000000000000000000000000..11089ee6bb92e47a0df12c11c09d4662c8089801 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/workspace.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/workspace.xml" new file mode 100644 index 0000000000000000000000000000000000000000..2758b2ccc6a1716e2e3c9e62bdd7e98ce28c2b98 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/.idea/workspace.xml" @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1641222823917 + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/IPersistence.iml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/IPersistence.iml" new file mode 100644 index 0000000000000000000000000000000000000000..0de1efec1c259a1b5ac12340417ebcddb5d5b0a4 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/IPersistence.iml" @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/pom.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/pom.xml" new file mode 100644 index 0000000000000000000000000000000000000000..12e62561f37d4745e601ec92b01840f88b183bdd --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/pom.xml" @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.lagou + IPersistence + 1.0-SNAPSHOT + + + UTF-8 + UTF-8 + 1.8 + 1.8 + 1.8 + + + + + + mysql + mysql-connector-java + 8.0.21 + + + c3p0 + c3p0 + 0.9.1.2 + + + log4j + log4j + 1.2.12 + + + junit + junit + 4.10 + + + dom4j + dom4j + 1.6.1 + + + jaxen + jaxen + 1.1.6 + + + dom4j + dom4j + 1.6.1 + compile + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/.DS_Store" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/.DS_Store" new file mode 100644 index 0000000000000000000000000000000000000000..320b10dc21a6ca34ebbc9f11dba8a75016b85dcb Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/.DS_Store" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/config/BoundSql.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/config/BoundSql.java" new file mode 100644 index 0000000000000000000000000000000000000000..1066b5746f898c2cf5bec195d9aadb64b53dbb77 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/config/BoundSql.java" @@ -0,0 +1,34 @@ +package com.lagou.config; + +import com.lagou.utils.ParameterMapping; + +import java.util.ArrayList; +import java.util.List; + +public class BoundSql { + + private String sqlText; //解析过后的sql + + private List parameterMappingList = new ArrayList<>(); + + public BoundSql(String sqlText, List parameterMappingList) { + this.sqlText = sqlText; + this.parameterMappingList = parameterMappingList; + } + + public String getSqlText() { + return sqlText; + } + + public void setSqlText(String sqlText) { + this.sqlText = sqlText; + } + + public List getParameterMappingList() { + return parameterMappingList; + } + + public void setParameterMappingList(List parameterMappingList) { + this.parameterMappingList = parameterMappingList; + } +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/config/XMLConfigBuilder.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/config/XMLConfigBuilder.java" new file mode 100644 index 0000000000000000000000000000000000000000..ab9e2255b1363f82680741c2293445ab15ab528b --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/config/XMLConfigBuilder.java" @@ -0,0 +1,66 @@ +package com.lagou.config; + +import com.lagou.io.Resources; +import com.lagou.pojo.Configuration; +import com.mchange.v2.c3p0.ComboPooledDataSource; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import java.beans.PropertyVetoException; +import java.io.InputStream; +import java.util.List; +import java.util.Properties; + +public class XMLConfigBuilder { + + private Configuration configuration; + + public XMLConfigBuilder() { + this.configuration = new Configuration(); + } + + /** + * 该方法就是使用dom4j对配置文件进行解析,封装Configuration + */ + public Configuration parseConfig(InputStream inputStream) throws DocumentException, PropertyVetoException { + + Document document = new SAXReader().read(inputStream); + // + Element rootElement = document.getRootElement(); + List list = rootElement.selectNodes("//property"); + Properties properties = new Properties(); + for (Element element : list) { + String name = element.attributeValue("name"); + String value = element.attributeValue("value"); + properties.setProperty(name,value); + } + + ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource(); + comboPooledDataSource.setDriverClass(properties.getProperty("driverClass")); + comboPooledDataSource.setJdbcUrl(properties.getProperty("jdbcUrl")); + comboPooledDataSource.setUser(properties.getProperty("username")); + comboPooledDataSource.setPassword(properties.getProperty("password")); + + configuration.setDataSource(comboPooledDataSource); + + //mapper.xml解析: 拿到路径--字节输入流---dom4j进行解析 + List mapperList = rootElement.selectNodes("//mapper"); + + for (Element element : mapperList) { + String mapperPath = element.attributeValue("resource"); + InputStream resourceAsSteam = Resources.getResourceAsSteam(mapperPath); + XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(configuration); + xmlMapperBuilder.parse(resourceAsSteam); + + } + + + + + return configuration; + } + + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/config/XMLMapperBuilder.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/config/XMLMapperBuilder.java" new file mode 100644 index 0000000000000000000000000000000000000000..d7ebd92df6f7f9f112824489c1532b4845657b63 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/config/XMLMapperBuilder.java" @@ -0,0 +1,48 @@ +package com.lagou.config; + +import com.lagou.pojo.Configuration; +import com.lagou.pojo.MappedStatement; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import java.io.InputStream; +import java.util.List; + +public class XMLMapperBuilder { + + private Configuration configuration; + + public XMLMapperBuilder(Configuration configuration) { + this.configuration =configuration; + } + + public void parse(InputStream inputStream) throws DocumentException { + + Document document = new SAXReader().read(inputStream); + Element rootElement = document.getRootElement(); + + String namespace = rootElement.attributeValue("namespace"); + +// List list = rootElement.selectNodes("//select"); + List list = rootElement.elements(); + for (Element element : list) { + String id = element.attributeValue("id"); + String resultType = element.attributeValue("resultType"); + String paramterType = element.attributeValue("parameterType"); + String sqlText = element.getTextTrim(); + MappedStatement mappedStatement = new MappedStatement(); + mappedStatement.setId(id); + mappedStatement.setResultType(resultType); + mappedStatement.setParameterType(paramterType); + mappedStatement.setSql(sqlText); + String key = namespace+"."+id; + configuration.getMappedStatementMap().put(key,mappedStatement); + + } + + } + + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/io/Resources.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/io/Resources.java" new file mode 100644 index 0000000000000000000000000000000000000000..819cd296b62ca0c178f177b95fc34e03bc5a1365 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/io/Resources.java" @@ -0,0 +1,16 @@ +package com.lagou.io; + +import java.io.InputStream; + +public class Resources { + + // 根据配置文件的路径,将配置文件加载成字节输入流,存储在内存中 + public static InputStream getResourceAsSteam(String path){ + InputStream resourceAsStream = Resources.class.getClassLoader().getResourceAsStream(path); + return resourceAsStream; + + } + + + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/pojo/Configuration.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/pojo/Configuration.java" new file mode 100644 index 0000000000000000000000000000000000000000..0543481bfae967f70e6d81149766939b50de92cd --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/pojo/Configuration.java" @@ -0,0 +1,31 @@ +package com.lagou.pojo; + +import javax.sql.DataSource; +import java.util.HashMap; +import java.util.Map; + +public class Configuration { + + private DataSource dataSource; + + /* + * key: statementid value:封装好的mappedStatement对象 + * */ + Map mappedStatementMap = new HashMap<>(); + + public DataSource getDataSource() { + return dataSource; + } + + public void setDataSource(DataSource dataSource) { + this.dataSource = dataSource; + } + + public Map getMappedStatementMap() { + return mappedStatementMap; + } + + public void setMappedStatementMap(Map mappedStatementMap) { + this.mappedStatementMap = mappedStatementMap; + } +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/pojo/MappedStatement.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/pojo/MappedStatement.java" new file mode 100644 index 0000000000000000000000000000000000000000..8421d819d5ad9e44dcbe04207922b833eef440a7 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/pojo/MappedStatement.java" @@ -0,0 +1,45 @@ +package com.lagou.pojo; + +public class MappedStatement { + + //id标识 + private String id; + //返回值类型 + private String resultType; + //参数值类型 + private String parameterType; + //sql语句 + private String sql; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getResultType() { + return resultType; + } + + public void setResultType(String resultType) { + this.resultType = resultType; + } + + public String getParameterType() { + return parameterType; + } + + public void setParameterType(String parameterType) { + this.parameterType = parameterType; + } + + public String getSql() { + return sql; + } + + public void setSql(String sql) { + this.sql = sql; + } +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/DefaultSqlSession.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/DefaultSqlSession.java" new file mode 100644 index 0000000000000000000000000000000000000000..92f677dd6b921d74bb7664c86a72fc968f59f318 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/DefaultSqlSession.java" @@ -0,0 +1,75 @@ +package com.lagou.sqlSession; + +import com.lagou.pojo.Configuration; +import com.lagou.pojo.MappedStatement; + +import java.lang.reflect.*; +import java.util.List; + +public class DefaultSqlSession implements SqlSession { + + private Configuration configuration; + + public DefaultSqlSession(Configuration configuration) { + this.configuration = configuration; + } + + @Override + public List selectList(String statementid, Object... params) throws Exception { + + //将要去完成对simpleExecutor里的query方法的调用 + simpleExecutor simpleExecutor = new simpleExecutor(); + MappedStatement mappedStatement = configuration.getMappedStatementMap().get(statementid); + List list = simpleExecutor.query(configuration, mappedStatement, params); + + return (List) list; + } + + @Override + public T selectOne(String statementid, Object... params) throws Exception { + List objects = selectList(statementid, params); + if(objects.size()==1){ + return (T) objects.get(0); + }else { + throw new RuntimeException("查询结果为空或者返回结果过多"); + } + } + + @Override + public T getMapper(Class mapperClass) { + // 使用JDK动态代理来为Dao接口生成代理对象,并返回 + + Object proxyInstance = Proxy.newProxyInstance(DefaultSqlSession.class.getClassLoader(), new Class[]{mapperClass}, new InvocationHandler() { + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + // 底层都还是去执行JDBC代码 //根据不同情况,来调用selctList或者selectOne + // 准备参数 1:statmentid :sql语句的唯一标识:namespace.id= 接口全限定名.方法名 + // 方法名:findAll + String methodName = method.getName(); + String className = method.getDeclaringClass().getName(); + + String statementId = className+"."+methodName; + + // 准备参数2:params:args + // 获取被调用方法的返回值类型 + Type genericReturnType = method.getGenericReturnType(); + // 判断是否进行了 泛型类型参数化 + if(genericReturnType instanceof ParameterizedType){ + List objects = selectList(statementId, args); + return objects; + } else if (genericReturnType.getTypeName() == int.class.getName()){ + simpleExecutor simpleExecutor = new simpleExecutor(); + MappedStatement mappedStatement = configuration.getMappedStatementMap().get(statementId); + return simpleExecutor.executeUpdate(configuration,mappedStatement,args); + } + + return selectOne(statementId,args); + + } + }); + + return (T) proxyInstance; + } + + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/DefaultSqlSessionFactory.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/DefaultSqlSessionFactory.java" new file mode 100644 index 0000000000000000000000000000000000000000..b4b27aa947dd4653e35fb0e9a3af0302dd1c61fb --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/DefaultSqlSessionFactory.java" @@ -0,0 +1,18 @@ +package com.lagou.sqlSession; + +import com.lagou.pojo.Configuration; + +public class DefaultSqlSessionFactory implements SqlSessionFactory { + + private Configuration configuration; + + public DefaultSqlSessionFactory(Configuration configuration) { + this.configuration = configuration; + } + + + @Override + public SqlSession openSession() { + return new DefaultSqlSession(configuration); + } +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/Executor.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/Executor.java" new file mode 100644 index 0000000000000000000000000000000000000000..1a4ffcbb66f7f348065707642a0d9f12005009e7 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/Executor.java" @@ -0,0 +1,18 @@ +package com.lagou.sqlSession; + +import com.lagou.pojo.Configuration; +import com.lagou.pojo.MappedStatement; + +import java.util.List; + +public interface Executor { + + public List query(Configuration configuration, MappedStatement mappedStatement, Object... params) throws Exception; + + public int executeUpdate(Configuration configuration, MappedStatement mappedStatement, Object... params) throws Exception; + +// public int update(Configuration configuration, MappedStatement mappedStatement, Object... params) throws Exception; + +// public int delete(Configuration configuration, MappedStatement mappedStatement, Object... params) throws Exception; + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/SqlSession.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/SqlSession.java" new file mode 100644 index 0000000000000000000000000000000000000000..758e1fa74090b367cacd1de51e01191c6129e152 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/SqlSession.java" @@ -0,0 +1,18 @@ +package com.lagou.sqlSession; + +import java.util.List; + +public interface SqlSession { + + //查询所有 + public List selectList(String statementid,Object... params) throws Exception; + + //根据条件查询单个 + public T selectOne(String statementid,Object... params) throws Exception; + + + //为Dao接口生成代理实现类 + public T getMapper(Class mapperClass); + + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/SqlSessionFactory.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/SqlSessionFactory.java" new file mode 100644 index 0000000000000000000000000000000000000000..df5bba287448fa7b1ae88ad81b2eb1ff5eb735c9 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/SqlSessionFactory.java" @@ -0,0 +1,8 @@ +package com.lagou.sqlSession; + +public interface SqlSessionFactory { + + public SqlSession openSession(); + + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/SqlSessionFactoryBuilder.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/SqlSessionFactoryBuilder.java" new file mode 100644 index 0000000000000000000000000000000000000000..93fc83be2fbf2d95b24e957d9d02ceb41d267a0f --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/SqlSessionFactoryBuilder.java" @@ -0,0 +1,27 @@ +package com.lagou.sqlSession; + +import com.lagou.config.XMLConfigBuilder; +import com.lagou.pojo.Configuration; +import org.dom4j.DocumentException; + +import java.beans.PropertyVetoException; +import java.io.InputStream; + +public class SqlSessionFactoryBuilder { + + public SqlSessionFactory build(InputStream in) throws DocumentException, PropertyVetoException { + // 第一:使用dom4j解析配置文件,将解析出来的内容封装到Configuration中 + XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder(); + Configuration configuration = xmlConfigBuilder.parseConfig(in); + + + // 第二:创建sqlSessionFactory对象:工厂类:生产sqlSession:会话对象 + DefaultSqlSessionFactory defaultSqlSessionFactory = new DefaultSqlSessionFactory(configuration); + + return defaultSqlSessionFactory; + } + + + + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/simpleExecutor.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/simpleExecutor.java" new file mode 100644 index 0000000000000000000000000000000000000000..506430174dbddeae225857ae36a2c7ddbe48502f --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/sqlSession/simpleExecutor.java" @@ -0,0 +1,140 @@ +package com.lagou.sqlSession; + + +import com.lagou.config.BoundSql; +import com.lagou.pojo.Configuration; +import com.lagou.pojo.MappedStatement; +import com.lagou.utils.GenericTokenParser; +import com.lagou.utils.ParameterMapping; +import com.lagou.utils.ParameterMappingTokenHandler; + +import java.beans.PropertyDescriptor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.util.ArrayList; +import java.util.List; + +public class simpleExecutor implements Executor { + + @Override //user + public List query(Configuration configuration, MappedStatement mappedStatement, Object... params) throws Exception { + // 1. 注册驱动,获取连接 + Connection connection = configuration.getDataSource().getConnection(); + // 2. 获取sql语句 : select * from user where id = #{id} and username = #{username} + //转换sql语句: select * from user where id = ? and username = ? ,转换的过程中,还需要对#{}里面的值进行解析存储 + String sql = mappedStatement.getSql(); + BoundSql boundSql = getBoundSql(sql); + // 3.获取预处理对象:preparedStatement + PreparedStatement preparedStatement = connection.prepareStatement(boundSql.getSqlText()); + // 4. 设置参数 + //获取到了参数的全路径 + String parameterType = mappedStatement.getParameterType(); + Class parametertypeClass = getClassType(parameterType); + + List parameterMappingList = boundSql.getParameterMappingList(); + for (int i = 0; i < parameterMappingList.size(); i++) { + ParameterMapping parameterMapping = parameterMappingList.get(i); + String content = parameterMapping.getContent(); + //反射 + Field declaredField = parametertypeClass.getDeclaredField(content); + //暴力访问 + declaredField.setAccessible(true); + Object o = declaredField.get(params[0]); + + preparedStatement.setObject(i + 1, o); + } + // 5. 执行sql + ResultSet resultSet = preparedStatement.executeQuery(); + String resultType = mappedStatement.getResultType(); + Class resultTypeClass = getClassType(resultType); + + ArrayList objects = new ArrayList<>(); + + // 6. 封装返回结果集 + while (resultSet.next()) { + Object o = resultTypeClass.newInstance(); + //元数据 + ResultSetMetaData metaData = resultSet.getMetaData(); + for (int i = 1; i <= metaData.getColumnCount(); i++) { + // 字段名 + String columnName = metaData.getColumnName(i); + // 字段的值 + Object value = resultSet.getObject(columnName); + + //使用反射或者内省,根据数据库表和实体的对应关系,完成封装 + PropertyDescriptor propertyDescriptor = new PropertyDescriptor(columnName, resultTypeClass); + Method writeMethod = propertyDescriptor.getWriteMethod(); + writeMethod.invoke(o, value); + } + objects.add(o); + } + return (List) objects; + } + + public int executeUpdate(Configuration configuration, MappedStatement mappedStatement, Object... params) throws Exception { + PreparedStatement preparedStatement = getPrepareStatement(configuration, mappedStatement); + setParam(preparedStatement,mappedStatement,params); + return preparedStatement.executeUpdate(); + } + + private Class getClassType(String paramterType) throws ClassNotFoundException { + if (paramterType != null) { + Class aClass = Class.forName(paramterType); + return aClass; + } + return null; + } + + /** + * 完成对#{}的解析工作:1.将#{}使用?进行代替,2.解析出#{}里面的值进行存储 + * + * @param sql + * @return + */ + private BoundSql getBoundSql(String sql) { + //标记处理类:配置标记解析器来完成对占位符的解析处理工作 + ParameterMappingTokenHandler parameterMappingTokenHandler = new ParameterMappingTokenHandler(); + GenericTokenParser genericTokenParser = new GenericTokenParser("#{", "}", parameterMappingTokenHandler); + //解析出来的sql + String parseSql = genericTokenParser.parse(sql); + //#{}里面解析出来的参数名称 + List parameterMappings = parameterMappingTokenHandler.getParameterMappings(); + + BoundSql boundSql = new BoundSql(parseSql, parameterMappings); + return boundSql; + } + + private PreparedStatement getPrepareStatement(Configuration conf, MappedStatement mappedStatement) throws Exception { + Connection connection = conf.getDataSource().getConnection(); + String sql = mappedStatement.getSql(); + BoundSql boundSql = getBoundSql(sql); + return connection.prepareStatement(boundSql.getSqlText()); + + } + + private void setParam(PreparedStatement preparedStatement, + MappedStatement mappedStatement, + Object ...params) throws Exception { + String parameterType = mappedStatement.getParameterType(); + Class parametertypeClass = getClassType(parameterType); + + String sql = mappedStatement.getSql(); + BoundSql boundSql = getBoundSql(sql); + List parameterMappingList = boundSql.getParameterMappingList(); + for (int i = 0; i < parameterMappingList.size(); i++) { + ParameterMapping parameterMapping = parameterMappingList.get(i); + String content = parameterMapping.getContent(); + //反射 + Field declaredField = parametertypeClass.getDeclaredField(content); + //暴力访问 + declaredField.setAccessible(true); + Object o = declaredField.get(params[0]); + + preparedStatement.setObject(i + 1, o); + } + } +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/GenericTokenParser.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/GenericTokenParser.java" new file mode 100644 index 0000000000000000000000000000000000000000..d92cd5e42b3615574873c60a10c4386f49613e35 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/GenericTokenParser.java" @@ -0,0 +1,102 @@ +/** + * Copyright 2009-2017 the original author or authors. + * + * Licensed 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 + * + * http://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. + */ +package com.lagou.utils; + +/** + * @author Clinton Begin + */ +public class GenericTokenParser { + + private final String openToken; //开始标记 + private final String closeToken; //结束标记 + private final TokenHandler handler; //标记处理器 + + public GenericTokenParser(String openToken, String closeToken, TokenHandler handler) { + this.openToken = openToken; + this.closeToken = closeToken; + this.handler = handler; + } + + /** + * 解析${}和#{} + * @param text + * @return + * 该方法主要实现了配置文件、脚本等片段中占位符的解析、处理工作,并返回最终需要的数据。 + * 其中,解析工作由该方法完成,处理工作是由处理器handler的handleToken()方法来实现 + */ + public String parse(String text) { + // 验证参数问题,如果是null,就返回空字符串。 + if (text == null || text.isEmpty()) { + return ""; + } + + // 下面继续验证是否包含开始标签,如果不包含,默认不是占位符,直接原样返回即可,否则继续执行。 + int start = text.indexOf(openToken, 0); + if (start == -1) { + return text; + } + + // 把text转成字符数组src,并且定义默认偏移量offset=0、存储最终需要返回字符串的变量builder, + // text变量中占位符对应的变量名expression。判断start是否大于-1(即text中是否存在openToken),如果存在就执行下面代码 + char[] src = text.toCharArray(); + int offset = 0; + final StringBuilder builder = new StringBuilder(); + StringBuilder expression = null; + while (start > -1) { + // 判断如果开始标记前如果有转义字符,就不作为openToken进行处理,否则继续处理 + if (start > 0 && src[start - 1] == '\\') { + builder.append(src, offset, start - offset - 1).append(openToken); + offset = start + openToken.length(); + } else { + //重置expression变量,避免空指针或者老数据干扰。 + if (expression == null) { + expression = new StringBuilder(); + } else { + expression.setLength(0); + } + builder.append(src, offset, start - offset); + offset = start + openToken.length(); + int end = text.indexOf(closeToken, offset); + while (end > -1) {////存在结束标记时 + if (end > offset && src[end - 1] == '\\') {//如果结束标记前面有转义字符时 + // this close token is escaped. remove the backslash and continue. + expression.append(src, offset, end - offset - 1).append(closeToken); + offset = end + closeToken.length(); + end = text.indexOf(closeToken, offset); + } else {//不存在转义字符,即需要作为参数进行处理 + expression.append(src, offset, end - offset); + offset = end + closeToken.length(); + break; + } + } + if (end == -1) { + // close token was not found. + builder.append(src, start, src.length - start); + offset = src.length; + } else { + //首先根据参数的key(即expression)进行参数处理,返回?作为占位符 + builder.append(handler.handleToken(expression.toString())); + offset = end + closeToken.length(); + } + } + start = text.indexOf(openToken, offset); + } + if (offset < src.length) { + builder.append(src, offset, src.length - offset); + } + return builder.toString(); + } +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/ParameterMapping.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/ParameterMapping.java" new file mode 100644 index 0000000000000000000000000000000000000000..6011f809f03ac431ce9790f80f2c76e863c764c1 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/ParameterMapping.java" @@ -0,0 +1,18 @@ +package com.lagou.utils; + +public class ParameterMapping { + + private String content; + + public ParameterMapping(String content) { + this.content = content; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/ParameterMappingTokenHandler.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/ParameterMappingTokenHandler.java" new file mode 100644 index 0000000000000000000000000000000000000000..ea32bf016a60a4449da3ed846ebcf42660daf382 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/ParameterMappingTokenHandler.java" @@ -0,0 +1,32 @@ +package com.lagou.utils; + +import java.util.ArrayList; +import java.util.List; + + + + +public class ParameterMappingTokenHandler implements TokenHandler { + private List parameterMappings = new ArrayList(); + + // context是参数名称 #{id} #{username} + + public String handleToken(String content) { + parameterMappings.add(buildParameterMapping(content)); + return "?"; + } + + private ParameterMapping buildParameterMapping(String content) { + ParameterMapping parameterMapping = new ParameterMapping(content); + return parameterMapping; + } + + public List getParameterMappings() { + return parameterMappings; + } + + public void setParameterMappings(List parameterMappings) { + this.parameterMappings = parameterMappings; + } + +} diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/TokenHandler.java" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/TokenHandler.java" new file mode 100644 index 0000000000000000000000000000000000000000..566d90bbc46534f1804eeb3d01d0797aa3f4cc63 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/src/main/java/com/lagou/utils/TokenHandler.java" @@ -0,0 +1,24 @@ +/** + * Copyright 2009-2015 the original author or authors. + * + * Licensed 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 + * + * http://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. + */ +package com.lagou.utils; + +/** + * @author Clinton Begin + */ +public interface TokenHandler { + String handleToken(String content); +} + diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/IPersistence-1.0-SNAPSHOT.jar" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/IPersistence-1.0-SNAPSHOT.jar" new file mode 100644 index 0000000000000000000000000000000000000000..2cb4961ba45ae337fb42853944490afb1e3e0679 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/IPersistence-1.0-SNAPSHOT.jar" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/config/BoundSql.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/config/BoundSql.class" new file mode 100644 index 0000000000000000000000000000000000000000..e882eb8e6e2fef868656086791b63e4986c40c08 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/config/BoundSql.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/config/XMLConfigBuilder.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/config/XMLConfigBuilder.class" new file mode 100644 index 0000000000000000000000000000000000000000..50498f6fc073d0e7ae7c8eb5b29e0c2466e89e49 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/config/XMLConfigBuilder.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/config/XMLMapperBuilder.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/config/XMLMapperBuilder.class" new file mode 100644 index 0000000000000000000000000000000000000000..358d68456602bd5ffb6002d0ca4df5a712912947 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/config/XMLMapperBuilder.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/io/Resources.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/io/Resources.class" new file mode 100644 index 0000000000000000000000000000000000000000..4bc15353fb23c00e479a035d19d812449d676410 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/io/Resources.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/pojo/Configuration.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/pojo/Configuration.class" new file mode 100644 index 0000000000000000000000000000000000000000..be250380677010d2cf5fb7186492c94b8126484f Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/pojo/Configuration.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/pojo/MappedStatement.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/pojo/MappedStatement.class" new file mode 100644 index 0000000000000000000000000000000000000000..8f0c785dab2df2860cedad75b0e5d7b2e74c4db4 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/pojo/MappedStatement.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/DefaultSqlSession$1.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/DefaultSqlSession$1.class" new file mode 100644 index 0000000000000000000000000000000000000000..8e81e1f30311f9d3fcf6d9d15471a02a5cd2330c Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/DefaultSqlSession$1.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/DefaultSqlSession.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/DefaultSqlSession.class" new file mode 100644 index 0000000000000000000000000000000000000000..6a12e63fc91f68ee81b9723e303fcb6573fb5122 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/DefaultSqlSession.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/DefaultSqlSessionFactory.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/DefaultSqlSessionFactory.class" new file mode 100644 index 0000000000000000000000000000000000000000..3aeca6da0908259ccc27c4371fb2103366881084 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/DefaultSqlSessionFactory.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/Executor.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/Executor.class" new file mode 100644 index 0000000000000000000000000000000000000000..2f12f94f9ed8f00807b1c693582cc1de75695147 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/Executor.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/SqlSession.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/SqlSession.class" new file mode 100644 index 0000000000000000000000000000000000000000..8488f3ac2f5b89b6f779ca16d9974d066b4f2268 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/SqlSession.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/SqlSessionFactory.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/SqlSessionFactory.class" new file mode 100644 index 0000000000000000000000000000000000000000..e8d6edc9440c1b82850e7391af5ce596423720e6 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/SqlSessionFactory.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/SqlSessionFactoryBuilder.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/SqlSessionFactoryBuilder.class" new file mode 100644 index 0000000000000000000000000000000000000000..8b2b2fbc90cd747778d1a3b9bca12a6ce12e5825 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/SqlSessionFactoryBuilder.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/simpleExecutor.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/simpleExecutor.class" new file mode 100644 index 0000000000000000000000000000000000000000..9c2bd2f0334e8dba3f1f84c6f68cdc8181095ecc Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/sqlSession/simpleExecutor.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/GenericTokenParser.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/GenericTokenParser.class" new file mode 100644 index 0000000000000000000000000000000000000000..d51ea6d8b1b7505563e6ebfd89ca49291bf8e32e Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/GenericTokenParser.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/ParameterMapping.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/ParameterMapping.class" new file mode 100644 index 0000000000000000000000000000000000000000..a66062b533f267be9ea0d876ac8d3548b6411440 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/ParameterMapping.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/ParameterMappingTokenHandler.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/ParameterMappingTokenHandler.class" new file mode 100644 index 0000000000000000000000000000000000000000..f7b67cdc67434b478ef99e98e69187c6ad4eb179 Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/ParameterMappingTokenHandler.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/TokenHandler.class" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/TokenHandler.class" new file mode 100644 index 0000000000000000000000000000000000000000..6b39d67169acb9a7ffcf1920781d99838b816b6a Binary files /dev/null and "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/classes/com/lagou/utils/TokenHandler.class" differ diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-archiver/pom.properties" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-archiver/pom.properties" new file mode 100644 index 0000000000000000000000000000000000000000..b27b6253f9ee144df88d48e9ba689eaf885f1ef5 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-archiver/pom.properties" @@ -0,0 +1,5 @@ +#Generated by Maven +#Sun Jan 16 19:45:53 CST 2022 +version=1.0-SNAPSHOT +groupId=com.lagou +artifactId=IPersistence diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" new file mode 100644 index 0000000000000000000000000000000000000000..2175a4afa938911128b2071e29cc4aa2c633712b --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" @@ -0,0 +1,18 @@ +com\lagou\sqlSession\SqlSessionFactoryBuilder.class +com\lagou\utils\TokenHandler.class +com\lagou\sqlSession\Executor.class +com\lagou\config\XMLConfigBuilder.class +com\lagou\io\Resources.class +com\lagou\sqlSession\DefaultSqlSession$1.class +com\lagou\sqlSession\SqlSessionFactory.class +com\lagou\config\BoundSql.class +com\lagou\utils\GenericTokenParser.class +com\lagou\config\XMLMapperBuilder.class +com\lagou\pojo\MappedStatement.class +com\lagou\sqlSession\simpleExecutor.class +com\lagou\sqlSession\SqlSession.class +com\lagou\pojo\Configuration.class +com\lagou\utils\ParameterMapping.class +com\lagou\sqlSession\DefaultSqlSessionFactory.class +com\lagou\sqlSession\DefaultSqlSession.class +com\lagou\utils\ParameterMappingTokenHandler.class diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" new file mode 100644 index 0000000000000000000000000000000000000000..d2779410c828dfa8e1393ff6b0a8ebe83cc53114 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" @@ -0,0 +1,17 @@ +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\config\XMLConfigBuilder.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\pojo\Configuration.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\sqlSession\Executor.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\utils\GenericTokenParser.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\utils\ParameterMapping.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\config\BoundSql.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\io\Resources.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\pojo\MappedStatement.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\utils\TokenHandler.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\sqlSession\SqlSessionFactory.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\config\XMLMapperBuilder.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\sqlSession\simpleExecutor.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\utils\ParameterMappingTokenHandler.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\sqlSession\SqlSession.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\sqlSession\DefaultSqlSession.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\sqlSession\SqlSessionFactoryBuilder.java +D:\Documents\Downloads\Documents\拉勾\Mybatis\mybatis-2021\mybatis相关代码\IPersistence\src\main\java\com\lagou\sqlSession\DefaultSqlSessionFactory.java diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/compiler.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/compiler.xml" new file mode 100644 index 0000000000000000000000000000000000000000..d26285dfce4603b737bcbee3938cc2d9fc6f4122 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/compiler.xml" @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/encodings.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/encodings.xml" new file mode 100644 index 0000000000000000000000000000000000000000..bedc286d12fba671cc71d1437c102775cd4d5d8b --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/encodings.xml" @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/misc.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/misc.xml" new file mode 100644 index 0000000000000000000000000000000000000000..5a3ad70ac3a12d0581988c9620319898331f6249 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/misc.xml" @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/uiDesigner.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/uiDesigner.xml" new file mode 100644 index 0000000000000000000000000000000000000000..e96534fb27b68192f27f985d3879e173ec77adb8 --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/uiDesigner.xml" @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/workspace.xml" "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/workspace.xml" new file mode 100644 index 0000000000000000000000000000000000000000..449e03c87870b67566818203ca8c644de93e1a1a --- /dev/null +++ "b/02_\344\275\234\344\270\232\347\233\270\345\205\263/\347\254\254\344\270\200\351\230\266\346\256\265\346\250\241\345\235\227\344\270\200/code/IPersistence_test/.idea/workspace.xml" @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +