diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e340cb0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ + +### Builder +target/ +build/ +out/ +gen/ +.gradle/ +local.properties + +### IntelliJ +.idea/ +*.iml +*.ipr +*.iws + +### Eclipse +.settings/ +.project +.classpath +.mymetadata + +### Package Files +*.jar +*.war +*.ear + +### Other +.DS_Store +*.log +*.bak diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..a5fcc11 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..4f1a6d4 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +## lunwen Web Project diff --git a/bin/jetty-run.bat b/bin/jetty-run.bat new file mode 100644 index 0000000..024a5a0 --- /dev/null +++ b/bin/jetty-run.bat @@ -0,0 +1,2 @@ +CALL ../mvnw jetty:run -f ../pom.xml -DskipTests %* +pause \ No newline at end of file diff --git a/bin/jetty-stop.bat b/bin/jetty-stop.bat new file mode 100644 index 0000000..5deb745 --- /dev/null +++ b/bin/jetty-stop.bat @@ -0,0 +1,2 @@ +CALL ../mvnw jetty:stop -f ../pom.xml -DskipTests %* +pause \ No newline at end of file diff --git a/bin/package.bat b/bin/package.bat new file mode 100644 index 0000000..66f8eae --- /dev/null +++ b/bin/package.bat @@ -0,0 +1,2 @@ +CALL ../mvnw clean package -f ../pom.xml -DskipTests %* +pause \ No newline at end of file diff --git a/bin/package.sh b/bin/package.sh new file mode 100644 index 0000000..1eec3f0 --- /dev/null +++ b/bin/package.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +sh ../mvnw clean package -f ../pom.xml -DskipTests $* diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..961a825 --- /dev/null +++ b/mvnw @@ -0,0 +1,286 @@ +#!/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 +# +# 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 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 /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)`" + # TODO classpath? +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="`which 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 + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" + 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 command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + 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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..830073a --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,161 @@ +@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 http://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 Maven2 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 key stroke 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 my 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 "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\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/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" +FOR /F "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% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%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 "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\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% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..102a346 --- /dev/null +++ b/pom.xml @@ -0,0 +1,257 @@ + + + 4.0.0 + + + com.github.xlongshu.maven + javaweb-starter + 1.0.1 + + + com + lunwen + war + 1.0-SNAPSHOT + lunwen Maven Webapp + + + UTF-8 + UTF-8 + + 1.7 + true + + + 7.0 + 3.1.0 + 2.3.1 + 3.0.0 + + 8080 + DEBUG + /data/logs/ + + + + + + junit + junit + 3.8.1 + test + + + + + org.springframework + spring-core + 4.3.8.RELEASE + + + org.springframework + spring-beans + 4.3.8.RELEASE + + + org.springframework + spring-context + 4.3.8.RELEASE + + + org.springframework + spring-context-support + 4.3.8.RELEASE + + + + org.springframework + spring-jdbc + 4.3.8.RELEASE + + + org.springframework + spring-tx + 4.3.8.RELEASE + + + + org.springframework + spring-web + 4.3.8.RELEASE + + + org.springframework + spring-webmvc + 4.3.8.RELEASE + + + org.springframework + spring-test + 4.3.8.RELEASE + + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + javax.servlet.jsp + jsp-api + 2.2 + provided + + + javax.servlet + jstl + 1.2 + + + taglibs + standard + 1.1.2 + + + + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.7 + + + + + + + + + + + mysql + mysql-connector-java + 5.1.38 + + + + + com.alibaba + druid + ${druid.version} + + + + + + + + + + + + org.mybatis + mybatis + ${mybatis.version} + + + + org.mybatis + mybatis-spring + 1.3.1 + + + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + ch.qos.logback + logback-classic + ${logback.version} + + + + + + + + + + + + + + + + cn.hutool + hutool-all + + + commons-logging + commons-logging + 1.2 + + + + commons-fileupload + commons-fileupload + 1.3.1 + + + + commons-io + commons-io + 2.0 + + + + com.fasterxml.jackson.core + jackson-core + 2.9.0 + + + + + + + + ${project.artifactId} + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.version} + + + stop + 8888 + 8 + ${webAppSourceDir} + ${project.basedir}/target/${project.artifactId} + + + / + ${webAppSourceDir}/WEB-INF/webdefault.xml + + + + ${server.port} + + + + + + + diff --git a/src/main/java/com/controller/PaperController.java b/src/main/java/com/controller/PaperController.java new file mode 100644 index 0000000..3f5ab4d --- /dev/null +++ b/src/main/java/com/controller/PaperController.java @@ -0,0 +1,108 @@ +package com.controller; + +import com.pojo.Paper; +import com.service.PaperService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +import java.util.List; + +/** + * @program:lunwen + * @description: + * @author:Mr.Chen + * @create:2019-06-15 22:10 + **/ + +@Controller +@RequestMapping("/paper") +public class PaperController { + + @Autowired + private PaperService paperService; + +// @RequestMapping("allPaper") +// public String list(Model model){ +// List list = paperService.queryAllPaper(); +// model.addAttribute("list",list); +// return "allPaper";//allPaper.jsp +// } + + @RequestMapping("allPaper") + public ModelAndView list(){ + List list = paperService.queryAllPaper(); + ModelAndView view = new ModelAndView("allPaper");//设置url -> allPaper.jsp 相当于view.setViewName("allPaper"); + view.addObject("list",list); + return view; + } + +// @RequestMapping("queryById") +// public String queryById(Model model,long id){ +// Paper paperId = paperService.queryById(id); +// model.addAttribute("paper01",paperId); +// return "queryById"; +// } + + @RequestMapping("queryById") + public ModelAndView queryById(long id){ + Paper paper01 = paperService.queryById(id); + ModelAndView view = new ModelAndView("queryById"); + view.addObject("paper01",paper01); + return view; + } + + //页面跳转,当在列表页中选择 -> 添加时,会跳转addPaper.jsp页面. + @RequestMapping("/toAddPaper") + public String toAddPaper() { + return "addPaper"; + } + + //当提交添加的数据时会调用此方法 + @RequestMapping("/addPaper") + public String addPaper(Paper paper) { + paperService.addPaper(paper); + return "redirect:/paper/allPaper"; + } + + @RequestMapping("/del/{paperId}") + public String deletePaper(@PathVariable("paperId") Long id) { + paperService.deletePaperById(id); + return "redirect:/paper/allPaper"; + } + +// @RequestMapping("toUpdatePaper") +// public String toUpdatePaper(Model model, Long id) { +// model.addAttribute("paper", paperService.queryById(id)); +// return "updatePaper"; +// } + + @RequestMapping("toUpdatePaper") + public ModelAndView toUpdatePaper(Long id){ + Paper paper = paperService.queryById(id); + ModelAndView view = new ModelAndView("updatePaper"); + view.addObject("paper",paper); + return view; + } + + +// @RequestMapping("/updatePaper") +// public String updatePaper(Model model, Paper paper) { +// paperService.updatePaper(paper); +// paper = paperService.queryById(paper.getPaperId()); +// model.addAttribute("paper", paper); +// return "redirect:/paper/allPaper"; +// } + + @RequestMapping("/updatePaper") + public ModelAndView updatePaper(Paper paper){ + paperService.updatePaper(paper); + ModelAndView view = new ModelAndView("redirect:/paper/allPaper"); + return view; + } + + +} diff --git a/src/main/java/com/dao/PaperDao.java b/src/main/java/com/dao/PaperDao.java new file mode 100644 index 0000000..45a5c5e --- /dev/null +++ b/src/main/java/com/dao/PaperDao.java @@ -0,0 +1,24 @@ +package com.dao; + +import com.pojo.Paper; + +import java.util.List; + +/** + * @program:lunwen + * @description: + * @author:Mr.Chen + * @create:2019-06-15 22:07 + **/ +public interface PaperDao { + int addPaper(Paper paper); + + int deletePaperById(long id); + + int updatePaper(Paper paper); + + Paper queryById(long id); + + List queryAllPaper(); + +} diff --git a/src/main/java/com/pojo/Paper.java b/src/main/java/com/pojo/Paper.java new file mode 100644 index 0000000..0393dd5 --- /dev/null +++ b/src/main/java/com/pojo/Paper.java @@ -0,0 +1,48 @@ +package com.pojo; + +/** + * @program:lunwen + * @description: + * @author:Mr.Chen + * @create:2019-06-15 22:01 + **/ +public class Paper { + private long paperId; + private String paperName; + private int paperNum; + private String paperDetail; + + public long getPaperId() { + return paperId; + } + + public void setPaperId(long paperId) { + this.paperId = paperId; + } + + public String getPaperName() { + return paperName; + } + + public void setPaperName(String paperName) { + this.paperName = paperName; + } + + public int getPaperNum() { + return paperNum; + } + + public void setPaperNum(int paperNum) { + this.paperNum = paperNum; + } + + public String getPaperDetail() { + return paperDetail; + } + + public void setPaperDetail(String paperDetail) { + this.paperDetail = paperDetail; + } + + +} diff --git a/src/main/java/com/service/PaperService.java b/src/main/java/com/service/PaperService.java new file mode 100644 index 0000000..8200f74 --- /dev/null +++ b/src/main/java/com/service/PaperService.java @@ -0,0 +1,20 @@ +package com.service; + +import com.pojo.Paper; + +import java.util.List; + +public interface PaperService { + + int addPaper(Paper paper); + + int deletePaperById(long id); + + int updatePaper(Paper paper); + + Paper queryById(long id); + + List queryAllPaper(); + +} + diff --git a/src/main/java/com/service/impl/PaperServiceImpl.java b/src/main/java/com/service/impl/PaperServiceImpl.java new file mode 100644 index 0000000..ec43dd1 --- /dev/null +++ b/src/main/java/com/service/impl/PaperServiceImpl.java @@ -0,0 +1,48 @@ +package com.service.impl; + +import com.dao.PaperDao; +import com.pojo.Paper; +import com.service.PaperService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @program:lunwen + * @description: + * @author:Mr.Chen + * @create:2019-06-15 22:05 + **/ + +@Service +public class PaperServiceImpl implements PaperService { + + @Autowired + private PaperDao paperDao; + + @Override + public int addPaper(Paper paper) { + return paperDao.addPaper(paper); + } + + @Override + public int deletePaperById(long id) { + return paperDao.deletePaperById(id); + } + + @Override + public int updatePaper(Paper paper) { + return paperDao.updatePaper(paper); + } + + @Override + public Paper queryById(long id) { + return paperDao.queryById(id); + } + + @Override + public List queryAllPaper() { + return paperDao.queryAllPaper(); + } +} diff --git a/src/main/java/com/utils/Test.java b/src/main/java/com/utils/Test.java new file mode 100644 index 0000000..7b6ff7a --- /dev/null +++ b/src/main/java/com/utils/Test.java @@ -0,0 +1,10 @@ +package com.utils; + +/** + * @program:lunwen01 + * @description: + * @author:Mr.Chen + * @create:2019-06-18 18:34 + **/ +public class Test { +} diff --git a/src/main/resources/META-INF/ehcache.xsd b/src/main/resources/META-INF/ehcache.xsd new file mode 100644 index 0000000..25fb481 --- /dev/null +++ b/src/main/resources/META-INF/ehcache.xsd @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/META-INF/logback.xsd b/src/main/resources/META-INF/logback.xsd new file mode 100644 index 0000000..284abee --- /dev/null +++ b/src/main/resources/META-INF/logback.xsd @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties new file mode 100644 index 0000000..3706cb2 --- /dev/null +++ b/src/main/resources/jdbc.properties @@ -0,0 +1,14 @@ +driver=com.mysql.jdbc.Driver +url=jdbc:mysql://127.0.0.1:3306/paper?characterEncoding=UTF-8&autoReconnect=true +username=root +password=root +#ʼ +initialSize=0 +# +maxActive=20 +# +maxIdle=20 +#С +minIdle=1 +#ȴʱ +maxWait=60000 diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties new file mode 100644 index 0000000..6e51b16 --- /dev/null +++ b/src/main/resources/log4j.properties @@ -0,0 +1,4 @@ +log4j.rootLogger=ERROR, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n diff --git a/src/main/resources/log4j.xml b/src/main/resources/log4j.xml new file mode 100644 index 0000000..355f1b1 --- /dev/null +++ b/src/main/resources/log4j.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/logback-test.xml b/src/main/resources/logback-test.xml new file mode 100644 index 0000000..7a4e147 --- /dev/null +++ b/src/main/resources/logback-test.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + ./logs/druid_info.log + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + debug + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/PaperMapper.xml b/src/main/resources/mapper/PaperMapper.xml new file mode 100644 index 0000000..a9260d2 --- /dev/null +++ b/src/main/resources/mapper/PaperMapper.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + insert into paper (paper_id,name,number,detail) value (#{paperId},#{paperName},#{paperNum},#{paperDetail}) + + + + DELETE FROM paper WHERE paper_id=#{paperId} + + + + UPDATE paper + SET name = #{paperName},number = #{paperNum},detail = #{paperDetail} + WHERE paper_id=#{paperId} + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis-config.xml1 b/src/main/resources/mybatis-config.xml1 new file mode 100644 index 0000000..db59c1c --- /dev/null +++ b/src/main/resources/mybatis-config.xml1 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/spring/applicationContext.xml b/src/main/resources/spring/applicationContext.xml new file mode 100644 index 0000000..a33e74a --- /dev/null +++ b/src/main/resources/spring/applicationContext.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/spring/spring-mvc.xml b/src/main/resources/spring/spring-mvc.xml new file mode 100644 index 0000000..c85fc8d --- /dev/null +++ b/src/main/resources/spring/spring-mvc.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/spring/spring-mvc.xml1 b/src/main/resources/spring/spring-mvc.xml1 new file mode 100644 index 0000000..a87fa09 --- /dev/null +++ b/src/main/resources/spring/spring-mvc.xml1 @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/spring/spring-mybatis.xml1 b/src/main/resources/spring/spring-mybatis.xml1 new file mode 100644 index 0000000..2b0b744 --- /dev/null +++ b/src/main/resources/spring/spring-mybatis.xml1 @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/spring/spring-service.xml1 b/src/main/resources/spring/spring-service.xml1 new file mode 100644 index 0000000..73e4dac --- /dev/null +++ b/src/main/resources/spring/spring-service.xml1 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/addPaper.jsp b/src/main/webapp/WEB-INF/jsp/addPaper.jsp new file mode 100644 index 0000000..f8ac555 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/addPaper.jsp @@ -0,0 +1,59 @@ +<%-- + Created by IntelliJ IDEA. + User: 滴滴 + Date: 2019/6/15 + Time: 23:50 + To change this template use File | Settings | File Templates. +--%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + String path = request.getContextPath(); + String basePath = request.getScheme() + "://" + + request.getServerName() + ":" + request.getServerPort() + + path + "/"; +%> + + + 新增论文 + + + + + +
+
+
+ +
+
+ +
+
+ +
+
+
+ 论文名称:


+ 论文数量:


+ 论文详情:


+ +
+ + +
diff --git a/src/main/webapp/WEB-INF/jsp/allPaper.jsp b/src/main/webapp/WEB-INF/jsp/allPaper.jsp new file mode 100644 index 0000000..0ea72ad --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/allPaper.jsp @@ -0,0 +1,84 @@ +<%-- + Created by IntelliJ IDEA. + User: 滴滴 + Date: 2019/6/15 + Time: 23:51 + To change this template use File | Settings | File Templates. +--%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% String appPath = request.getContextPath(); %> + + + Paper列表 + + + + + +
+
+
+ +
+
+ +
+
+ +
+
+
+
+ 新增 +
+
+ +
+
+
+ + + +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + +
论文编号论文名字论文数量论文详情操作
${paper.paperId}${paper.paperName}${paper.paperNum}${paper.paperDetail} + 更改 | + 删除 +
+
+
+
diff --git a/src/main/webapp/WEB-INF/jsp/queryById.jsp b/src/main/webapp/WEB-INF/jsp/queryById.jsp new file mode 100644 index 0000000..6922b8f --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/queryById.jsp @@ -0,0 +1,48 @@ +<%-- + Created by IntelliJ IDEA. + User: 滴滴 + Date: 2019/6/16 + Time: 15:56 + To change this template use File | Settings | File Templates. +--%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% String appPath = request.getContextPath(); %> + + + Title + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
论文编号论文名字论文数量论文详情操作
${paper01.paperId}${paper01.paperName}${paper01.paperNum}${paper01.paperDetail} + 更改 | + 删除 +
+
+
+ + diff --git a/src/main/webapp/WEB-INF/jsp/updatePaper.jsp b/src/main/webapp/WEB-INF/jsp/updatePaper.jsp new file mode 100644 index 0000000..26b0855 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/updatePaper.jsp @@ -0,0 +1,60 @@ +<%-- + Created by IntelliJ IDEA. + User: 滴滴 + Date: 2019/6/15 + Time: 23:51 + To change this template use File | Settings | File Templates. +--%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + String path = request.getContextPath(); + String basePath = request.getScheme() + "://" + + request.getServerName() + ":" + request.getServerPort() + + path + "/"; +%> + + + 修改论文 + + + + + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+ + 论文名称: + 论文数量: + 论文详情: + +
+ +
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..7105055 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,83 @@ + + + + lunwen + + index.html + index.htm + index.jsp + + + + dispatcher + org.springframework.web.servlet.DispatcherServlet + + + + + contextConfigLocation + classpath:spring/*.xml + + + + dispatcher + + / + + + + encodingFilter + + org.springframework.web.filter.CharacterEncodingFilter + + + encoding + utf-8 + + + + + encodingFilter + /* + + + + + DruidStatView + com.alibaba.druid.support.http.StatViewServlet + + + DruidStatView + /druid/* + + + druidWebStatFilter + com.alibaba.druid.support.http.WebStatFilter + + exclusions + /public/*,*.js,*.css,/druid*,*.jsp,*.swf + + + principalSessionName + sessionInfo + + + profileEnable + true + + + + druidWebStatFilter + /* + + + + + diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html new file mode 100644 index 0000000..01b9694 --- /dev/null +++ b/src/main/webapp/index.html @@ -0,0 +1,10 @@ + + + + +Hello + + +

Hello World!

+ + \ No newline at end of file diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp new file mode 100644 index 0000000..2efd227 --- /dev/null +++ b/src/main/webapp/index.jsp @@ -0,0 +1,38 @@ +<%-- + Created by IntelliJ IDEA. + User: 滴滴 + Date: 2019/6/15 + Time: 23:49 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + pageContext.setAttribute("path", request.getContextPath()); +%> + + + + 首页 + + + + + +
+
+
+ +
+
+
+

+

+ 点击进入管理页面 + +

+ +