Browse Source

官网后台

xue 5 years ago
parent
commit
79419ae012
40 changed files with 2067 additions and 0 deletions
  1. 2 0
      .idea/vcs.xml
  2. 31 0
      official_backend/.gitignore
  3. 114 0
      official_backend/.mvn/wrapper/MavenWrapperDownloader.java
  4. BIN
      official_backend/.mvn/wrapper/maven-wrapper.jar
  5. 1 0
      official_backend/.mvn/wrapper/maven-wrapper.properties
  6. 286 0
      official_backend/mvnw
  7. 161 0
      official_backend/mvnw.cmd
  8. 91 0
      official_backend/pom.xml
  9. 15 0
      official_backend/src/main/java/com/hssx/ysofficial/YsofficialApplication.java
  10. 62 0
      official_backend/src/main/java/com/hssx/ysofficial/controller/ArticleController.java
  11. 43 0
      official_backend/src/main/java/com/hssx/ysofficial/controller/BannerPicturesController.java
  12. 30 0
      official_backend/src/main/java/com/hssx/ysofficial/controller/CommentController.java
  13. 53 0
      official_backend/src/main/java/com/hssx/ysofficial/controller/CooperationsController.java
  14. 71 0
      official_backend/src/main/java/com/hssx/ysofficial/entity/Article.java
  15. 54 0
      official_backend/src/main/java/com/hssx/ysofficial/entity/BannerPictures.java
  16. 66 0
      official_backend/src/main/java/com/hssx/ysofficial/entity/Comment.java
  17. 53 0
      official_backend/src/main/java/com/hssx/ysofficial/entity/Cooperations.java
  18. 45 0
      official_backend/src/main/java/com/hssx/ysofficial/filter/CORSFilter.java
  19. 18 0
      official_backend/src/main/java/com/hssx/ysofficial/mapper/ArticleMapper.java
  20. 20 0
      official_backend/src/main/java/com/hssx/ysofficial/mapper/BannerPicturesMapper.java
  21. 16 0
      official_backend/src/main/java/com/hssx/ysofficial/mapper/CommentMapper.java
  22. 18 0
      official_backend/src/main/java/com/hssx/ysofficial/mapper/CooperationsMapper.java
  23. 23 0
      official_backend/src/main/java/com/hssx/ysofficial/service/ArticleService.java
  24. 20 0
      official_backend/src/main/java/com/hssx/ysofficial/service/BannerPicturesService.java
  25. 17 0
      official_backend/src/main/java/com/hssx/ysofficial/service/CommentService.java
  26. 21 0
      official_backend/src/main/java/com/hssx/ysofficial/service/CooperationsService.java
  27. 127 0
      official_backend/src/main/java/com/hssx/ysofficial/service/impl/ArticleServiceImpl.java
  28. 83 0
      official_backend/src/main/java/com/hssx/ysofficial/service/impl/BannerPicturesServiceImpl.java
  29. 35 0
      official_backend/src/main/java/com/hssx/ysofficial/service/impl/CommentServiceImpl.java
  30. 103 0
      official_backend/src/main/java/com/hssx/ysofficial/service/impl/CooperationsServiceImpl.java
  31. 204 0
      official_backend/src/main/java/com/hssx/ysofficial/utility/CodeGenerator.java
  32. 27 0
      official_backend/src/main/java/com/hssx/ysofficial/utility/FileUtil.java
  33. 37 0
      official_backend/src/main/java/com/hssx/ysofficial/utility/HttpRespMsg.java
  34. 24 0
      official_backend/src/main/resources/application.properties
  35. 20 0
      official_backend/src/main/resources/mapper/ArticleMapper.xml
  36. 20 0
      official_backend/src/main/resources/mapper/BannerPicturesMapper.xml
  37. 19 0
      official_backend/src/main/resources/mapper/CommentMapper.xml
  38. 20 0
      official_backend/src/main/resources/mapper/CooperationsMapper.xml
  39. 16 0
      official_backend/src/test/java/com/hssx/ysofficial/YsofficialApplicationTests.java
  40. 1 0
      official_frontend

+ 2 - 0
.idea/vcs.xml

@@ -2,5 +2,7 @@
 <project version="4">
   <component name="VcsDirectoryMappings">
     <mapping directory="" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/official_frontend" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/ysofficial" vcs="Git" />
   </component>
 </project>

+ 31 - 0
official_backend/.gitignore

@@ -0,0 +1,31 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**
+!**/src/test/**
+
+### 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/
+
+### VS Code ###
+.vscode/

+ 114 - 0
official_backend/.mvn/wrapper/MavenWrapperDownloader.java

@@ -0,0 +1,114 @@
+/*
+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.
+*/
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+    /**
+     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+     */
+    private static final String DEFAULT_DOWNLOAD_URL =
+            "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";
+
+    /**
+     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+     * use instead of the default one.
+     */
+    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+            ".mvn/wrapper/maven-wrapper.properties";
+
+    /**
+     * Path where the maven-wrapper.jar will be saved to.
+     */
+    private static final String MAVEN_WRAPPER_JAR_PATH =
+            ".mvn/wrapper/maven-wrapper.jar";
+
+    /**
+     * Name of the property which should be used to override the default download url for the wrapper.
+     */
+    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+    public static void main(String args[]) {
+        System.out.println("- Downloader started");
+        File baseDirectory = new File(args[0]);
+        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+        // If the maven-wrapper.properties exists, read it and check if it contains a custom
+        // wrapperUrl parameter.
+        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+        String url = DEFAULT_DOWNLOAD_URL;
+        if (mavenWrapperPropertyFile.exists()) {
+            FileInputStream mavenWrapperPropertyFileInputStream = null;
+            try {
+                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+                Properties mavenWrapperProperties = new Properties();
+                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+            } catch (IOException e) {
+                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+            } finally {
+                try {
+                    if (mavenWrapperPropertyFileInputStream != null) {
+                        mavenWrapperPropertyFileInputStream.close();
+                    }
+                } catch (IOException e) {
+                    // Ignore ...
+                }
+            }
+        }
+        System.out.println("- Downloading from: : " + url);
+
+        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+        if (!outputFile.getParentFile().exists()) {
+            if (!outputFile.getParentFile().mkdirs()) {
+                System.out.println(
+                        "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+            }
+        }
+        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+        try {
+            downloadFileFromURL(url, outputFile);
+            System.out.println("Done");
+            System.exit(0);
+        } catch (Throwable e) {
+            System.out.println("- Error downloading");
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+        URL website = new URL(urlString);
+        ReadableByteChannel rbc;
+        rbc = Channels.newChannel(website.openStream());
+        FileOutputStream fos = new FileOutputStream(destination);
+        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+        fos.close();
+        rbc.close();
+    }
+
+}

BIN
official_backend/.mvn/wrapper/maven-wrapper.jar


+ 1 - 0
official_backend/.mvn/wrapper/maven-wrapper.properties

@@ -0,0 +1 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip

+ 286 - 0
official_backend/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
+#
+#    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.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# 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.2/maven-wrapper-0.4.2.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 "$@"

+ 161 - 0
official_backend/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    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 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.2/maven-wrapper-0.4.2.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%

+ 91 - 0
official_backend/pom.xml

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.1.8.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.hssx</groupId>
+    <artifactId>ysofficial</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>ysofficial</name>
+    <description>official website management system for yunsu</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.1.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.1.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.7</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+            <version>2.3.23</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-engine-core</artifactId>
+            <version>2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.4</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 15 - 0
official_backend/src/main/java/com/hssx/ysofficial/YsofficialApplication.java

@@ -0,0 +1,15 @@
+package com.hssx.ysofficial;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@MapperScan("com.hssx.ysofficial.mapper")
+public class YsofficialApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(YsofficialApplication.class, args);
+    }
+
+}

+ 62 - 0
official_backend/src/main/java/com/hssx/ysofficial/controller/ArticleController.java

@@ -0,0 +1,62 @@
+package com.hssx.ysofficial.controller;
+
+
+import com.hssx.ysofficial.entity.Article;
+import com.hssx.ysofficial.service.ArticleService;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-15
+ */
+@RestController
+@RequestMapping("/article")
+public class ArticleController {
+    @Autowired
+    private ArticleService articleService;
+
+    @RequestMapping("/getArticle")
+    public HttpRespMsg getArticle(){
+        return articleService.getArticleAll();
+    }
+
+    @RequestMapping("/getArticleById")
+    public HttpRespMsg getArticleById(@RequestParam Integer id){
+        return articleService.getArticleById(id);
+    }
+
+    @RequestMapping("/getArticleByType")
+    public HttpRespMsg getAdvantage(String type){
+        return articleService.getArticleByType(type);
+    }
+
+    @RequestMapping("/editArticle")
+    public HttpRespMsg editArticle(Article article){
+        return articleService.editArticle(article);
+    }
+
+    @RequestMapping("/deleteArticleById")
+    public HttpRespMsg deleteArticleById(@RequestParam Integer id){
+        return articleService.deleteArticleById(id);
+    }
+
+    @RequestMapping("/switchArticleSticky")
+    public HttpRespMsg switchArticleSticky(@RequestParam Integer id){
+        return articleService.switchSticky(id);
+    }
+
+    @RequestMapping("/switchArticlePosition")
+    public HttpRespMsg switchArticlePosition(@RequestParam Integer id, @RequestParam Integer position){
+        return articleService.switchPosition(id, position);
+    }
+}
+

+ 43 - 0
official_backend/src/main/java/com/hssx/ysofficial/controller/BannerPicturesController.java

@@ -0,0 +1,43 @@
+package com.hssx.ysofficial.controller;
+
+
+import com.hssx.ysofficial.entity.BannerPictures;
+import com.hssx.ysofficial.service.BannerPicturesService;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * <p>
+ * the pictures of banner 前端控制器
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-11
+ */
+@RestController
+@RequestMapping("/banner-pictures")
+public class BannerPicturesController {
+    @Autowired
+    private BannerPicturesService bannerPicturesService;
+
+    @RequestMapping("/uploadBanner")
+    public HttpRespMsg uploadBanner(@RequestParam MultipartFile multipartFile){
+        return bannerPicturesService.uploadBanner(multipartFile);
+    }
+
+    @RequestMapping("/getBannerUrl")
+    public HttpRespMsg getBannerUrl(){
+        return bannerPicturesService.getBanners();
+    }
+
+    @RequestMapping("/deleteBanner")
+    public HttpRespMsg deleteBanner(@RequestParam Integer id){
+        return bannerPicturesService.deleteBannerById(id);
+    }
+}
+

+ 30 - 0
official_backend/src/main/java/com/hssx/ysofficial/controller/CommentController.java

@@ -0,0 +1,30 @@
+package com.hssx.ysofficial.controller;
+
+
+import com.hssx.ysofficial.service.CommentService;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * the comments left by customers 前端控制器
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-22
+ */
+@RestController
+@RequestMapping("/comment")
+public class CommentController {
+    @Autowired
+    private CommentService commentService;
+
+    @RequestMapping("/getComments")
+    public HttpRespMsg getComments(){
+        return commentService.getComments();
+    }
+}
+

+ 53 - 0
official_backend/src/main/java/com/hssx/ysofficial/controller/CooperationsController.java

@@ -0,0 +1,53 @@
+package com.hssx.ysofficial.controller;
+
+
+import com.hssx.ysofficial.entity.Cooperations;
+import com.hssx.ysofficial.mapper.CooperationsMapper;
+import com.hssx.ysofficial.service.CooperationsService;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * <p>
+ * the cooperations of client company and high school 前端控制器
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-14
+ */
+@RestController
+@RequestMapping("/cooperations")
+public class CooperationsController {
+    @Autowired
+    private CooperationsService cooperationsService;
+
+    @RequestMapping("/getCooperations")
+    public HttpRespMsg getCooperation(){
+        return cooperationsService.getCooperations();
+    }
+
+    @RequestMapping("/addCooperation")
+    public HttpRespMsg addCooperation(
+            Cooperations cooperations,
+            MultipartFile multipartFile){
+        return cooperationsService.addCooperations(cooperations, multipartFile);
+    }
+
+    @RequestMapping("/deleteCooperation")
+    public HttpRespMsg deleteCooperation(Integer id){
+        return cooperationsService.deleteCooperationsById(id);
+    }
+
+    @RequestMapping("/editCooperation")
+    public HttpRespMsg editCooperation(
+            Cooperations cooperations,
+            MultipartFile multipartFile){
+        return cooperationsService.editCooperations(cooperations, multipartFile);
+    }
+}
+

+ 71 - 0
official_backend/src/main/java/com/hssx/ysofficial/entity/Article.java

@@ -0,0 +1,71 @@
+package com.hssx.ysofficial.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("article")
+public class Article extends Model<Article> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * the title of articles
+     */
+    @TableField("title")
+    private String title;
+
+    /**
+     * the content of article
+     */
+    @TableField("content")
+    private String content;
+
+    /**
+     * the type of article
+     */
+    @TableField("type")
+    private String type;
+
+    /**
+     * whether the article is sticked or not
+     */
+    @TableField("sticky")
+    private Integer sticky;
+
+    /**
+     * the position of article in the list
+     */
+    @TableField("position")
+    private Integer position;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 54 - 0
official_backend/src/main/java/com/hssx/ysofficial/entity/BannerPictures.java

@@ -0,0 +1,54 @@
+package com.hssx.ysofficial.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * the pictures of banner
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("banner_pictures")
+public class BannerPictures extends Model<BannerPictures> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("url")
+    private String url;
+
+    @TableField("file_name")
+    private String fileName;
+
+    @TableField("file_size")
+    private String fileSize;
+
+    @TableField("file_type")
+    private String fileType;
+
+    @TableField("upload_indate")
+    private LocalDateTime uploadIndate;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 66 - 0
official_backend/src/main/java/com/hssx/ysofficial/entity/Comment.java

@@ -0,0 +1,66 @@
+package com.hssx.ysofficial.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * the comments left by customers
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("comment")
+public class Comment extends Model<Comment> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * the name of customer
+     */
+    @TableField("name")
+    private String name;
+
+    /**
+     * the phone number of customer
+     */
+    @TableField("phone")
+    private String phone;
+
+    /**
+     * the main content left by customer
+     */
+    @TableField("comment")
+    private String comment;
+
+    /**
+     * the timestamp when the customer left the message
+     */
+    @TableField("indate")
+    private LocalDateTime indate;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 53 - 0
official_backend/src/main/java/com/hssx/ysofficial/entity/Cooperations.java

@@ -0,0 +1,53 @@
+package com.hssx.ysofficial.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * the cooperations of client company and high school
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("cooperations")
+public class Cooperations extends Model<Cooperations> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("name")
+    private String name;
+
+    @TableField("description")
+    private String description;
+
+    @TableField("image_url")
+    private String imageUrl;
+
+    @TableField("type")
+    private Integer type;
+
+    @TableField("sticky")
+    private Integer sticky;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 45 - 0
official_backend/src/main/java/com/hssx/ysofficial/filter/CORSFilter.java

@@ -0,0 +1,45 @@
+package com.hssx.ysofficial.filter;
+
+import org.springframework.stereotype.Component;
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+//拦截器添加跨域支持(如果是web.xml配置拦截器,请将@component删除)
+@Component
+public class CORSFilter implements Filter {
+    @Override
+    public void init(FilterConfig filterConfig) throws ServletException {
+
+    }
+
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException, IOException {
+//        HttpServletRequest request = (HttpServletRequest) request;
+//        HttpServletResponse response = (HttpServletResponse) response;
+////        response.setHeader("Access-Control-Allow-Origin", "*");
+//        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+//        response.setHeader("Access-Control-Max-Age", "3600");
+//        response.setHeader("Access-Control-Allow-Headers", "x-requested-with");
+//        response.setHeader("Access-Control-Allow-Credentials", "true"); //是否支持cookie跨域
+//        filterChain.doFilter(servletRequest, servletResponse);
+//
+//    }
+        HttpServletResponse res = (HttpServletResponse) response;
+        res.addHeader("Access-Control-Allow-Credentials", "true");//是否支持cookie跨域
+        res.addHeader("Access-Control-Allow-Origin", "*");
+        res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
+        res.addHeader("Access-Control-Allow-Headers", "Content-Type,X-CAF-Authorization-Token,sessionToken,X-TOKEN");
+        if (((HttpServletRequest) request).getMethod().equals("OPTIONS")) {
+            response.getWriter().println("ok");
+            return;
+        }
+        filterChain.doFilter(request, response);
+    }
+
+    @Override
+    public void destroy() {
+
+    }
+}

+ 18 - 0
official_backend/src/main/java/com/hssx/ysofficial/mapper/ArticleMapper.java

@@ -0,0 +1,18 @@
+package com.hssx.ysofficial.mapper;
+
+import com.hssx.ysofficial.entity.Article;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Select;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-15
+ */
+public interface ArticleMapper extends BaseMapper<Article> {
+    @Select("SELECT MAX(position)+1 AS new_position FROM article;")
+    public Integer getNewPosition();
+}

+ 20 - 0
official_backend/src/main/java/com/hssx/ysofficial/mapper/BannerPicturesMapper.java

@@ -0,0 +1,20 @@
+package com.hssx.ysofficial.mapper;
+
+import com.hssx.ysofficial.entity.BannerPictures;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * the pictures of banner Mapper 接口
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-11
+ */
+public interface BannerPicturesMapper extends BaseMapper<BannerPictures> {
+
+}

+ 16 - 0
official_backend/src/main/java/com/hssx/ysofficial/mapper/CommentMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.ysofficial.mapper;
+
+import com.hssx.ysofficial.entity.Comment;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * the comments left by customers Mapper 接口
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-22
+ */
+public interface CommentMapper extends BaseMapper<Comment> {
+
+}

+ 18 - 0
official_backend/src/main/java/com/hssx/ysofficial/mapper/CooperationsMapper.java

@@ -0,0 +1,18 @@
+package com.hssx.ysofficial.mapper;
+
+import com.hssx.ysofficial.entity.Cooperations;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+ * <p>
+ * the cooperations of client company and high school Mapper 接口
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-14
+ */
+public interface CooperationsMapper extends BaseMapper<Cooperations> {
+
+}

+ 23 - 0
official_backend/src/main/java/com/hssx/ysofficial/service/ArticleService.java

@@ -0,0 +1,23 @@
+package com.hssx.ysofficial.service;
+
+import com.hssx.ysofficial.entity.Article;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-15
+ */
+public interface ArticleService extends IService<Article> {
+    HttpRespMsg getArticleAll();
+    HttpRespMsg getArticleById(Integer id);
+    HttpRespMsg getArticleByType(String Type);
+    HttpRespMsg editArticle(Article article);
+    HttpRespMsg deleteArticleById(Integer id);
+    HttpRespMsg switchSticky(Integer id);
+    HttpRespMsg switchPosition(Integer id, Integer position);
+}

+ 20 - 0
official_backend/src/main/java/com/hssx/ysofficial/service/BannerPicturesService.java

@@ -0,0 +1,20 @@
+package com.hssx.ysofficial.service;
+
+import com.hssx.ysofficial.entity.BannerPictures;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * <p>
+ * the pictures of banner 服务类
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-11
+ */
+public interface BannerPicturesService extends IService<BannerPictures> {
+    HttpRespMsg uploadBanner(MultipartFile multipartFile);
+    HttpRespMsg getBanners();
+    HttpRespMsg deleteBannerById(Integer id);
+}

+ 17 - 0
official_backend/src/main/java/com/hssx/ysofficial/service/CommentService.java

@@ -0,0 +1,17 @@
+package com.hssx.ysofficial.service;
+
+import com.hssx.ysofficial.entity.Comment;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+
+/**
+ * <p>
+ * the comments left by customers 服务类
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-22
+ */
+public interface CommentService extends IService<Comment> {
+    HttpRespMsg getComments();
+}

+ 21 - 0
official_backend/src/main/java/com/hssx/ysofficial/service/CooperationsService.java

@@ -0,0 +1,21 @@
+package com.hssx.ysofficial.service;
+
+import com.hssx.ysofficial.entity.Cooperations;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * <p>
+ * the cooperations of client company and high school 服务类
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-14
+ */
+public interface CooperationsService extends IService<Cooperations> {
+    HttpRespMsg getCooperations();
+    HttpRespMsg addCooperations(Cooperations cooperations, MultipartFile multipartFile);
+    HttpRespMsg deleteCooperationsById(Integer id);
+    HttpRespMsg editCooperations(Cooperations cooperations, MultipartFile multipartFile);
+}

+ 127 - 0
official_backend/src/main/java/com/hssx/ysofficial/service/impl/ArticleServiceImpl.java

@@ -0,0 +1,127 @@
+package com.hssx.ysofficial.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hssx.ysofficial.entity.Article;
+import com.hssx.ysofficial.mapper.ArticleMapper;
+import com.hssx.ysofficial.service.ArticleService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.hibernate.validator.constraints.EAN;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.sql.SQLOutput;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-15
+ */
+@Service
+public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
+    @Resource
+    private ArticleMapper articleMapper;
+
+    @Override
+    public HttpRespMsg getArticleAll(){
+        Map<String, Object> map = new HashMap<>();
+        map.put("article", articleMapper.selectList(new QueryWrapper<>()));
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        httpRespMsg.data = map;
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg getArticleById(Integer id){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        httpRespMsg.data = articleMapper.selectById(id);
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg getArticleByType(String type){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        Article article = new Article();
+        article.setType(type);
+        httpRespMsg.data = articleMapper.selectList(
+                new QueryWrapper<Article>()
+                .eq("type", type)
+                .orderByAsc("position"));
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg editArticle(Article article){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        if(article != null){
+            Integer id = article.getId();
+            if(id == null){
+                article.setPosition(articleMapper.getNewPosition());
+                articleMapper.insert(article);
+            }else{
+                articleMapper.updateById(article);
+            }
+        }else{
+            httpRespMsg.setError("information not found");
+        }
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg deleteArticleById(Integer id){
+        articleMapper.deleteById(id);
+        return new HttpRespMsg();
+    }
+
+    @Override
+    public HttpRespMsg switchSticky(Integer id){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        Article article = articleMapper.selectById(id);
+        if(article != null){
+            article.setSticky(article.getSticky() == 1? 0: 1);
+            articleMapper.updateById(article);
+        }else{
+            httpRespMsg.setError("id is not found");
+        }
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg switchPosition(Integer id, Integer position){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        Article currentArticle = articleMapper.selectById(id);
+        //用id查找到文章后
+        if(currentArticle != null){
+            Integer currentPosition = currentArticle.getPosition();
+            QueryWrapper<Article> queryWrapper;
+            if(position == 0){
+                //跟上一个互换的话
+                queryWrapper = new QueryWrapper<Article>()
+                        .eq("type", "case")
+                        .gt("position", currentPosition);
+            }else{
+                //跟下一个互换的话
+                queryWrapper = new QueryWrapper<Article>()
+                        .eq("type", "case")
+                        .lt("position", currentPosition);
+            }
+            if(articleMapper.selectCount(queryWrapper) > 0){
+                Article targetArticle = articleMapper.selectList(queryWrapper).get(0);
+                currentArticle.setPosition(targetArticle.getPosition());
+                targetArticle.setPosition(currentPosition);
+                articleMapper.updateById(currentArticle);
+                articleMapper.updateById(targetArticle);
+            }else{
+                httpRespMsg.setError("position can not switch");
+            };
+        }else{
+            httpRespMsg.setError("article not found");
+        }
+        return httpRespMsg;
+    }
+}

+ 83 - 0
official_backend/src/main/java/com/hssx/ysofficial/service/impl/BannerPicturesServiceImpl.java

@@ -0,0 +1,83 @@
+package com.hssx.ysofficial.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hssx.ysofficial.entity.BannerPictures;
+import com.hssx.ysofficial.mapper.BannerPicturesMapper;
+import com.hssx.ysofficial.service.BannerPicturesService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+import com.hssx.ysofficial.utility.FileUtil;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.util.*;
+
+/**
+ * <p>
+ * the pictures of banner 服务实现类
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-11
+ */
+@Service
+public class BannerPicturesServiceImpl extends ServiceImpl<BannerPicturesMapper, BannerPictures> implements BannerPicturesService {
+
+    @Value("${upload.path}")
+    private String uploadPath;
+
+    @Value("${download.path}")
+    private String downloadPath;
+
+    @Resource
+    private BannerPicturesMapper bannerPicturesMapper;
+
+    @Override
+    public HttpRespMsg uploadBanner(MultipartFile multipartFile){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        if(multipartFile != null){
+            BannerPictures bannerPictures = new BannerPictures();
+            String fileName = multipartFile.getOriginalFilename();
+            File direction = new File(uploadPath);
+            String rand = UUID.randomUUID().toString().replaceAll("-", "");
+            String suffix = fileName.substring(fileName.lastIndexOf("."));
+            String storedFileName = rand + suffix;
+            bannerPictures.setUrl("/upload/" + storedFileName);
+            bannerPictures.setFileName(multipartFile.getOriginalFilename());
+            bannerPictures.setFileType(suffix);
+            bannerPictures.setFileSize(FileUtil.getReadableFileSize(multipartFile.getSize()));
+            bannerPictures.setUploadIndate(LocalDateTime.now());
+            try {
+                File savedFile = new File(direction, storedFileName);
+                savedFile.createNewFile();
+                multipartFile.transferTo(savedFile);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            bannerPicturesMapper.insert(bannerPictures);
+        }else{
+            httpRespMsg.setError("File Not Exist");
+        }
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg getBanners(){
+        Map<String, Object> map = new HashMap<>();
+        map.put("banner", bannerPicturesMapper.selectList(new QueryWrapper<>()));
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        httpRespMsg.data = map;
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg deleteBannerById(Integer id){
+        bannerPicturesMapper.deleteById(id);
+        return new HttpRespMsg();
+    }
+}

+ 35 - 0
official_backend/src/main/java/com/hssx/ysofficial/service/impl/CommentServiceImpl.java

@@ -0,0 +1,35 @@
+package com.hssx.ysofficial.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
+import com.hssx.ysofficial.entity.Comment;
+import com.hssx.ysofficial.mapper.CommentMapper;
+import com.hssx.ysofficial.service.CommentService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * <p>
+ * the comments left by customers 服务实现类
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-22
+ */
+@Service
+public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements CommentService {
+
+    @Resource
+    private CommentMapper commentMapper;
+
+    @Override
+    public HttpRespMsg getComments(){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        httpRespMsg.data = commentMapper.selectList(new QueryWrapper<Comment>());
+        return httpRespMsg;
+    }
+}

+ 103 - 0
official_backend/src/main/java/com/hssx/ysofficial/service/impl/CooperationsServiceImpl.java

@@ -0,0 +1,103 @@
+package com.hssx.ysofficial.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hssx.ysofficial.entity.Cooperations;
+import com.hssx.ysofficial.mapper.CooperationsMapper;
+import com.hssx.ysofficial.service.CooperationsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * <p>
+ * the cooperations of client company and high school 服务实现类
+ * </p>
+ *
+ * @author Reiskuchen
+ * @since 2019-10-14
+ */
+@Service
+public class CooperationsServiceImpl extends ServiceImpl<CooperationsMapper, Cooperations> implements CooperationsService {
+
+    @Value("${upload.path}")
+    private String uploadPath;
+
+    @Value("${download.path}")
+    private String downloadPath;
+
+    @Resource
+    private CooperationsMapper cooperationsMapper;
+
+    public HttpRespMsg getCooperations(){
+        Map<String, Object> map = new HashMap<>();
+        map.put("cooperations", cooperationsMapper.selectList(new QueryWrapper<>()));
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        httpRespMsg.data = map;
+        return httpRespMsg;
+    };
+
+    public HttpRespMsg addCooperations(Cooperations cooperations, MultipartFile multipartFile){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        if(cooperations != null && multipartFile != null){
+            String fileName = multipartFile.getOriginalFilename();
+            File direction = new File(uploadPath);
+            String rand = UUID.randomUUID().toString().replaceAll("-", "");
+            String suffix = fileName.substring(fileName.lastIndexOf("."));
+            String storedFileName = rand + suffix;
+            try {
+                File savedFile = new File(direction, storedFileName);
+                savedFile.createNewFile();
+                multipartFile.transferTo(savedFile);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            cooperations.setImageUrl("/upload/" + storedFileName);
+            cooperationsMapper.insert(cooperations);
+        }else{
+            httpRespMsg.setError("lack of file or information");
+        }
+        return httpRespMsg;
+    };
+
+    public HttpRespMsg editCooperations(Cooperations cooperations, MultipartFile multipartFile){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        if(cooperations != null && cooperations.getId() != null){
+            if(multipartFile != null){
+                String fileName = multipartFile.getOriginalFilename();
+                File direction = new File(uploadPath);
+                String rand = UUID.randomUUID().toString().replaceAll("-", "");
+                String suffix = fileName.substring(fileName.lastIndexOf("."));
+                String storedFileName = rand + suffix;
+                try {
+                    File savedFile = new File(direction, storedFileName);
+                    savedFile.createNewFile();
+                    multipartFile.transferTo(savedFile);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                cooperations.setImageUrl("/upload/" + storedFileName);
+            }
+            cooperationsMapper.updateById(cooperations);
+        }else{
+            httpRespMsg.setError("lack of information");
+        }
+        return httpRespMsg;
+    };
+
+    public HttpRespMsg deleteCooperationsById(Integer id){
+        cooperationsMapper.deleteById(id);
+        return new HttpRespMsg();
+    };
+
+    public HttpRespMsg editCooperations(){
+        return null;
+    };
+}

+ 204 - 0
official_backend/src/main/java/com/hssx/ysofficial/utility/CodeGenerator.java

@@ -0,0 +1,204 @@
+package com.hssx.ysofficial.utility;
+
+import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.InjectionConfig;
+import com.baomidou.mybatisplus.generator.config.*;
+import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
+import com.baomidou.mybatisplus.generator.config.po.TableInfo;
+import com.baomidou.mybatisplus.generator.config.rules.FileType;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+/**
+ *      mybatis-plus代码生成器
+ *      <dependency>
+ *          <groupId>com.baomidou</groupId>
+ *          <artifactId>mybatis-plus-generator</artifactId>
+ *          <version>3.1.2</version>
+ *      </dependency>
+ *
+ *      <dependency>
+ *          <groupId>com.baomidou</groupId>
+ *          <artifactId>mybatis-plus-boot-starter</artifactId>
+ *          <version>3.1.2</version>
+ *      </dependency>
+ *
+ *      执行 main 方法控制台输入模块表名回车自动生成对应项目目录中
+ */
+public class CodeGenerator {
+    public static String scanner(String tip) {
+        Scanner scanner = new Scanner(System.in);
+        StringBuilder help = new StringBuilder();
+        help.append("请输入" + tip + ":");
+        System.out.println(help.toString());
+        if (scanner.hasNext()) {
+            String ipt = scanner.next();
+            if (StringUtils.isNotEmpty(ipt)) {
+                return ipt;
+            }
+        }
+        throw new MybatisPlusException("请输入正确的" + tip + "!");
+    }
+
+    public static void main(String[] args) {
+        //代码生成器
+        AutoGenerator ag = new AutoGenerator();
+
+        //全局配置
+        GlobalConfig gc = new GlobalConfig();
+        //自定义文件命名 %s自动填充表实体属性
+//        gc.setMapperName("%sDao");
+//        gc.setXmlName("%sMapper");
+//        gc.setServiceName("%sService");
+//        gc.setServiceImplName("%sServiceImap");
+//        gc.setControllerName("%sController");
+        //生成的代码存放到某个路径下
+//        gc.setOutputDir("E://");
+        //生成的代码位置为当前项目
+        String projectPath = System.getProperty("user.dir");
+        gc.setOutputDir(projectPath + "/src/main/java");
+        gc.setAuthor("Reiskuchen");
+        gc.setOpen(false);
+        gc.setFileOverride(false);
+        gc.setActiveRecord(true);
+        //%s是实体类类名占位符 不配置这行的话 对于User会生成IUserService 配置后即可生成UserService
+        gc.setServiceName("%sService");
+        //XML二级缓存
+//      gc.setEnableCache(true);
+        //XML ResultMap
+        gc.setBaseResultMap(true);
+        //XML columList
+        gc.setBaseColumnList(true);
+        //实体属性Swagger2注解
+        //gc.setSwagger2(true);
+        ag.setGlobalConfig(gc);
+
+        //数据源配置
+        DataSourceConfig dsc = new DataSourceConfig();
+        dsc.setUrl("jdbc:mysql://118.190.47.230:3306/cloud_model_website?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8");
+//        dsc.setSchemaName("world");
+        dsc.setDriverName("com.mysql.cj.jdbc.Driver");
+        dsc.setUsername("root");
+        dsc.setPassword("p011430seya1026");
+        ag.setDataSource(dsc);
+
+        //包配置
+        PackageConfig pc = new PackageConfig();
+        //若果需要在Parent(此处即com.example.plus)下新建模块时打开下面注释,后续在控制台提示输入模块时,输入想要新建的模块名就可以
+//        pc.setModuleName(scanner("模块名"));
+        pc.setParent("com.hssx.ysofficial");
+        ag.setPackageInfo(pc);
+
+        //自定义配置
+        InjectionConfig cfg = new InjectionConfig() {
+            @Override
+            public void initMap() {
+                // to do nothing
+            }
+        };
+
+        //以下为两种模板来生成*mapper.xml文件,任选一种即可,不同的模板对应不同的依赖
+        //模板引擎freemarker依赖
+        /**
+         *         <dependency>
+         *             <groupId>org.freemarker</groupId>
+         *             <artifactId>freemarker</artifactId>
+         *             <version>2.3.23</version>
+         *         </dependency>
+         */
+//        String templatePath = "/templates/mapper.xml.ftl";
+
+        //模板引擎velocity依赖。
+        /**
+         *         <dependency>
+         *             <groupId>org.apache.velocity</groupId>
+         *             <artifactId>velocity-engine-core</artifactId>
+         *             <version>2.0</version>
+         *         </dependency>
+         */
+        String templatePath = "/templates/mapper.xml.vm";
+
+        //自定义输出配置
+        List<FileOutConfig> focList = new ArrayList<>();
+        //自定义配置会被优先输出
+        focList.add(new FileOutConfig(templatePath) {
+            @Override
+            public String outputFile(TableInfo tableInfo) {
+                if(pc.getModuleName() == null){
+                    return projectPath + "/src/main/resources/mapper/"
+                            + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
+                }else{
+                    //自定义输出文件名 Entity设置了前后缀 此处xml名称会跟着发生变化
+                    return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
+                            + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
+                }
+            }
+        });
+
+        cfg.setFileCreate(new IFileCreate() {
+            @Override
+            public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
+                //判断自定义文件夹是否需要创建 这里调用默认的方法
+                checkDir(filePath);
+                //对于已存在的文件 只需重复生成 entity 和 mapper.xml
+                File file = new File(filePath);
+                boolean exist = file.exists();
+                if(exist){
+                    return filePath.endsWith("Mapper.xml")||FileType.ENTITY==fileType;
+                }
+                //不存在的文件都需要创建
+                return  true;
+            }
+        });
+        cfg.setFileOutConfigList(focList);
+        ag.setCfg(cfg);
+        ag.setTemplate(new TemplateConfig().setXml(null));
+
+        //配置模板
+//        TemplateConfig templateConfig = new TemplateConfig();
+
+        //配置自定义输出模板
+        //指定自定义模板路径 不要带上.ftl/.vm 会根据使用的模板引擎自动识别
+//        templateConfig.setEntity("templates/entity2.java");
+//        templateConfig.setService();
+//        templateConfig.setController();
+//        templateConfig.setXml(null);
+//        ag.setTemplate(templateConfig);
+
+        //策略配置
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setNaming(NamingStrategy.underline_to_camel);
+        strategy.setColumnNaming(NamingStrategy.underline_to_camel);
+        //若想要生成的实体类继承某个类,则可打开下面注释。写上需要继承的类的位置即可
+//        strategy.setSuperEntityClass("com.baomidou.ant.common.BaseEntity");
+        //实体是否为lombok模型(默认 false)
+        strategy.setEntityLombokModel(true);
+        //对控制器生成 @RestController 注解
+        strategy.setRestControllerStyle(true);
+        //是否生成实体时 生成字段注解
+        strategy.setEntityTableFieldAnnotationEnable(true);
+//        strategy.setEntitySerialVersionUID(false)//加此行不生成生成实体类序列化编号,不加默认生成
+        //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
+//        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
+        //单独生成逗号隔开
+//        strategy.setInclude("");
+        //全生成
+        strategy.setExclude();
+        //多个英文逗号隔开
+//        strategy.setInclude(scanner("user").split(","));
+        strategy.setControllerMappingHyphenStyle(true);
+        //数据库表前缀 不配置这行的话生成的类会带有T如:TUser 配置后即可将前缀去掉
+        strategy.setTablePrefix("");
+        ag.setStrategy(strategy);
+
+//        ag.setTemplateEngine(new FreemarkerTemplateEngine());
+        ag.execute();
+    }
+}

+ 27 - 0
official_backend/src/main/java/com/hssx/ysofficial/utility/FileUtil.java

@@ -0,0 +1,27 @@
+package com.hssx.ysofficial.utility;
+
+public class FileUtil {
+
+	/**
+	 * 获取容易识别的文件大小,比如KB, MB, GB
+	 * @param size
+	 * @return
+	 */
+	public static String getReadableFileSize(long size) {
+		if (size < 1024) {//1K以内
+			return size + "byte";
+		} else if (size < 1024 * 1024) {//1M以内
+			return String.format("%.1fKB", (size*1.0f/1024));
+		} else if (size < 1024 * 1024 * 1024) {//1G以内
+			return String.format("%.1fMB", (size*1.0f/1024/1024));
+		} else {
+			return String.format("%.1fGB", (size*1.0f/1024/1024/1024));
+		}
+	}
+	public static void main(String[] args) {
+		long l = 1024 * 1024 * 1 * 1024;
+		System.out.println(getReadableFileSize(l));
+		String substring = "/upload/af9db74095354187b5ee17bce73b6b82.jpg".substring("/upload/".length());
+		System.out.println(substring);
+	}
+}

+ 37 - 0
official_backend/src/main/java/com/hssx/ysofficial/utility/HttpRespMsg.java

@@ -0,0 +1,37 @@
+package com.hssx.ysofficial.utility;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import java.io.Serializable;
+
+public class HttpRespMsg implements Serializable {
+
+    //状态码 ok 或 error
+    public String code;
+
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public String msg;
+
+    //JSON格式的数据内容 或压缩格式的压缩字符串
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public Object data;
+
+    public HttpRespMsg() {
+        code = "ok";
+    }
+
+    public void setError(String errorMsg) {
+        code = "error";
+        msg = errorMsg;
+    }
+
+    public String toJSONStr() {
+        JSONObject json = new JSONObject();
+        json.put("code", code);
+        json.put("data", data);
+        json.put("msg", msg);
+
+        return json.toJSONString();
+    }
+}

+ 24 - 0
official_backend/src/main/resources/application.properties

@@ -0,0 +1,24 @@
+#服务端配置
+server.port=8088
+server.servlet.context-path=/
+server.tomcat.uri-encoding=UTF-8
+server.tomcat.max-http-post-size=-1
+server.max-http-header-size=102400
+server.connection-timeout=18000000s
+
+#Mybatis-plus
+mybatis-plus.type-aliases-package=com.hssx.ysofficial.entity/*
+mybatis-plus.mapper-locations=mapper/*.xml
+
+#数据库
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_model_website?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+spring.datasource.username=root
+spring.datasource.password=p011430seya1026
+spring.datasource.hikari.max-lifetime=540000
+
+#文件上传路径
+upload.path=D:/ysofficial/upload/
+
+#文件下载路径
+download.path=D:/ysofficial/download/

+ 20 - 0
official_backend/src/main/resources/mapper/ArticleMapper.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hssx.ysofficial.mapper.ArticleMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.ysofficial.entity.Article">
+        <id column="id" property="id" />
+        <result column="title" property="title" />
+        <result column="content" property="content" />
+        <result column="type" property="type" />
+        <result column="sticky" property="sticky" />
+        <result column="position" property="position" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, title, content, type, sticky, position
+    </sql>
+
+</mapper>

+ 20 - 0
official_backend/src/main/resources/mapper/BannerPicturesMapper.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hssx.ysofficial.mapper.BannerPicturesMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.ysofficial.entity.BannerPictures">
+        <id column="id" property="id" />
+        <result column="url" property="url" />
+        <result column="file_name" property="fileName" />
+        <result column="file_size" property="fileSize" />
+        <result column="file_type" property="fileType" />
+        <result column="upload_indate" property="uploadIndate" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, url, file_name, file_size, file_type, upload_indate
+    </sql>
+
+</mapper>

+ 19 - 0
official_backend/src/main/resources/mapper/CommentMapper.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hssx.ysofficial.mapper.CommentMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.ysofficial.entity.Comment">
+        <id column="id" property="id" />
+        <result column="name" property="name" />
+        <result column="phone" property="phone" />
+        <result column="comment" property="comment" />
+        <result column="indate" property="indate" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, name, phone, comment, indate
+    </sql>
+
+</mapper>

+ 20 - 0
official_backend/src/main/resources/mapper/CooperationsMapper.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hssx.ysofficial.mapper.CooperationsMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.ysofficial.entity.Cooperations">
+        <id column="id" property="id" />
+        <result column="name" property="name" />
+        <result column="description" property="description" />
+        <result column="image_url" property="imageUrl" />
+        <result column="type" property="type" />
+        <result column="sticky" property="sticky" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, name, description, image_url, type, sticky
+    </sql>
+
+</mapper>

+ 16 - 0
official_backend/src/test/java/com/hssx/ysofficial/YsofficialApplicationTests.java

@@ -0,0 +1,16 @@
+package com.hssx.ysofficial;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class YsofficialApplicationTests {
+
+    @Test
+    public void contextLoads() {
+    }
+
+}

+ 1 - 0
official_frontend

@@ -0,0 +1 @@
+Subproject commit 03252825b19caad39af6cdd3102fc05590374c70