parent
453f34870a
commit
ff2699b6b7
@ -1,8 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="BUILD_PROCESS_ADDITIONAL_VM_OPTIONS" value="-Djps.track.ap.dependencies=false" />
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="demo" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="demo" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="recommend@localhost" uuid="272a5bbc-bbf4-4536-9a5a-013ae1d74b7f">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306/recommend</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="AdditionalModuleElements">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
</component>
|
||||
</module>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/backend/src/main/java" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/sharePlatform/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/backend/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/demo.iml" filepath="$PROJECT_DIR$/.idea/demo.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,33 +0,0 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* 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.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenWrapperDownloader {
|
||||
|
||||
private static final String WRAPPER_VERSION = "0.5.6";
|
||||
/**
|
||||
* 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/"
|
||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 {
|
||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
||||
String username = System.getenv("MVNW_USERNAME");
|
||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
@ -1,322 +0,0 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven Start Up Batch script
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# M2_HOME - location of maven2's installed home dir
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ]; then
|
||||
|
||||
if [ -f /etc/mavenrc ]; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ]; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false
|
||||
darwin=false
|
||||
mingw=false
|
||||
case "$(uname)" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true ;;
|
||||
Darwin*)
|
||||
darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
export JAVA_HOME="$(/usr/libexec/java_home)"
|
||||
else
|
||||
export JAVA_HOME="/Library/Java/Home"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -r /etc/gentoo-release ]; then
|
||||
JAVA_HOME=$(java-config --jre-home)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$M2_HOME" ]; then
|
||||
## resolve links - $0 may be a link to maven's home
|
||||
PRG="$0"
|
||||
|
||||
# need this for relative symlinks
|
||||
while [ -h "$PRG" ]; do
|
||||
ls=$(ls -ld "$PRG")
|
||||
link=$(expr "$ls" : '.*-> \(.*\)$')
|
||||
if expr "$link" : '/.*' >/dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG="$(dirname "$PRG")/$link"
|
||||
fi
|
||||
done
|
||||
|
||||
saveddir=$(pwd)
|
||||
|
||||
M2_HOME=$(dirname "$PRG")/..
|
||||
|
||||
# make it fully qualified
|
||||
M2_HOME=$(cd "$M2_HOME" && pwd)
|
||||
|
||||
cd "$saveddir"
|
||||
# echo Using m2 at $M2_HOME
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=$(cygpath --unix "$M2_HOME")
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME="$( (
|
||||
cd "$M2_HOME"
|
||||
pwd
|
||||
))"
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="$( (
|
||||
cd "$JAVA_HOME"
|
||||
pwd
|
||||
))"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="$(which javac)"
|
||||
if [ -n "$javaExecutable" ] && ! [ "$(expr \"$javaExecutable\" : '\([^ ]*\)')" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=$(which readlink)
|
||||
if [ ! $(expr "$readLink" : '\([^ ]*\)') = "no" ]; then
|
||||
if $darwin; then
|
||||
javaHome="$(dirname \"$javaExecutable\")"
|
||||
javaExecutable="$(cd \"$javaHome\" && pwd -P)/javac"
|
||||
else
|
||||
javaExecutable="$(readlink -f \"$javaExecutable\")"
|
||||
fi
|
||||
javaHome="$(dirname \"$javaExecutable\")"
|
||||
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ]; then
|
||||
if [ -n "$JAVA_HOME" ]; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="$(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
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||
else
|
||||
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||
fi
|
||||
while IFS="=" read key value; do
|
||||
case "$key" in wrapperUrl)
|
||||
jarUrl="$value"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done <"$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Downloading from: $jarUrl"
|
||||
fi
|
||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if $cygwin; then
|
||||
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
|
||||
fi
|
||||
|
||||
if command -v wget >/dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found wget ... using wget"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget "$jarUrl" -O "$wrapperJarPath"
|
||||
else
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl >/dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found curl ... using curl"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||
else
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||
fi
|
||||
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Falling back to using Java to download"
|
||||
fi
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaClass=$(cygpath --path --windows "$javaClass")
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
# Compiling the Java class
|
||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||
fi
|
||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
# Running the downloader
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Running MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo $MAVEN_PROJECTBASEDIR
|
||||
fi
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=$(cygpath --path --windows "$M2_HOME")
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
@ -1,182 +0,0 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Maven Start Up Batch script
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM M2_HOME - location of maven2's installed home dir
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%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.5.6/maven-wrapper-0.5.6.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% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %DOWNLOAD_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%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%
|
@ -1,126 +0,0 @@
|
||||
<?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.5.0</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>demo</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>demo</name>
|
||||
<description>recommend project for Spring Boot</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!--mybatis-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.3.1.tmp</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.18</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.10</version>
|
||||
</dependency>
|
||||
<!-- 添加 模板引擎 依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<!--代码生成器-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>3.3.1.tmp</version>
|
||||
</dependency>
|
||||
<!--Swagger-->
|
||||
<dependency>
|
||||
<groupId>com.spring4all</groupId>
|
||||
<artifactId>swagger-spring-boot-starter</artifactId>
|
||||
<version>1.7.1.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!--使用日志slf4j+logback-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</dependency>
|
||||
<!--使用aop-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<!--spring整合shiro-->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<version>1.4.0</version>
|
||||
</dependency>
|
||||
<!--fastjson Json处理工具包-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.76</version>
|
||||
</dependency>
|
||||
<!-- redis-->
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
<version>2.5.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>1.4.1.RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
@ -1,15 +0,0 @@
|
||||
package com.example.demo;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.example.demo.mapper")
|
||||
@EnableCaching
|
||||
public class DemoApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package com.example.demo.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
// 跨域访问控制
|
||||
@Configuration
|
||||
public class CorsConfig {
|
||||
private CorsConfiguration buildConfig(){
|
||||
CorsConfiguration corsConfiguration=new CorsConfiguration();
|
||||
// 允许任何域名使用
|
||||
corsConfiguration.addAllowedOriginPattern("*");
|
||||
// 允许任何请求头使用
|
||||
corsConfiguration.addAllowedHeader("*");
|
||||
// 允许任何方法
|
||||
corsConfiguration.addAllowedMethod("*");
|
||||
// 允许携带信息
|
||||
corsConfiguration.setAllowCredentials(true);
|
||||
return corsConfiguration;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter(){
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
// 对接口配置跨域设置
|
||||
source.registerCorsConfiguration("/**", buildConfig());
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package com.example.demo.config;
|
||||
|
||||
import com.example.demo.entity.Permission;
|
||||
import com.example.demo.entity.Role;
|
||||
import com.example.demo.entity.User;
|
||||
import com.example.demo.service.UserService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authc.SimpleAuthenticationInfo;
|
||||
import org.apache.shiro.authz.AuthorizationInfo;
|
||||
import org.apache.shiro.authz.SimpleAuthorizationInfo;
|
||||
import org.apache.shiro.realm.AuthorizingRealm;
|
||||
import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.apache.shiro.util.ByteSource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class EnceladusShiroRealm extends AuthorizingRealm {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
// 进行权限校验时调用
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection){
|
||||
SimpleAuthorizationInfo simpleAuthorizationInfo=new SimpleAuthorizationInfo();
|
||||
String userName=(String) principalCollection.getPrimaryPrincipal();
|
||||
User user=userService.findAllUserInfoByUsername(userName);
|
||||
List<String> stringRoleList=new ArrayList<>();
|
||||
List<String> stringPermissionList=new ArrayList<>();
|
||||
List<Role> roleList=user.getRoleList();
|
||||
|
||||
for(Role role:roleList){
|
||||
stringRoleList.add(role.getName());
|
||||
List<Permission> permissionList=role.getPermissionList();
|
||||
for(Permission p:permissionList){
|
||||
if (null != p) {
|
||||
stringPermissionList.add(p.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
simpleAuthorizationInfo.addRoles(stringRoleList);
|
||||
simpleAuthorizationInfo.addStringPermissions(stringPermissionList);
|
||||
SecurityUtils.getSubject().getSession().setAttribute("roleList", stringRoleList);
|
||||
return simpleAuthorizationInfo;
|
||||
}
|
||||
|
||||
// 登录校验调用
|
||||
@Override
|
||||
protected SimpleAuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
|
||||
|
||||
String username=(String) token.getPrincipal();
|
||||
System.out.println("principal:"+username);
|
||||
User user=userService.findAllUserInfoByUsername(username);
|
||||
System.out.println("principal password:"+user.getPassWord());
|
||||
|
||||
String passWord=user.getPassWord();
|
||||
if(null==passWord|| "".equals(passWord)){
|
||||
return null;
|
||||
}
|
||||
return new SimpleAuthenticationInfo(user.getUserName(), user.getPassWord(), ByteSource.Util.bytes(user.getSalt()), getName());
|
||||
}
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
package com.example.demo.config;
|
||||
|
||||
import com.example.demo.util.PasswordHelper;
|
||||
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
import org.apache.shiro.session.mgt.SessionManager;
|
||||
import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO;
|
||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
public class ShiroConfig {
|
||||
|
||||
@Bean
|
||||
public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager){
|
||||
ShiroFilterFactoryBean shiroFilterFactoryBean=new ShiroFilterFactoryBean();
|
||||
shiroFilterFactoryBean.setSecurityManager(securityManager);
|
||||
|
||||
Map<String, Filter> customFilterMap = new LinkedHashMap<>();
|
||||
customFilterMap.put("corsAuthenticationFilter",new CORSAuthenticationFilter());
|
||||
shiroFilterFactoryBean.setFilters(customFilterMap);
|
||||
|
||||
Map<String,String> filterChainDefinitionMap=new LinkedHashMap<>();
|
||||
|
||||
//author url定义必须通过认证才可以访问
|
||||
//anon url可以匿名访问
|
||||
shiroFilterFactoryBean.setLoginUrl("/login");
|
||||
shiroFilterFactoryBean.setUnauthorizedUrl("/unauthor");
|
||||
shiroFilterFactoryBean.setSuccessUrl("/home/index");
|
||||
|
||||
// 过滤器 按照顺序进行拦截
|
||||
// author 所有已登陆用户可访问
|
||||
// roles 有指定角色的用户可访问,通过[ ]指定具体角色,这里的角色名称与数据库中配置一致
|
||||
// perms 有指定权限的用户可访问,通过[ ]指定具体权限,这里的权限名称与数据库中配置一致
|
||||
// anon 所有用户可访问,通常作为指定页面的静态资源时使用
|
||||
filterChainDefinitionMap.put("/*", "anon");
|
||||
filterChainDefinitionMap.put("/logout","logout");
|
||||
filterChainDefinitionMap.put("/login","anon");
|
||||
filterChainDefinitionMap.put("/cart","roles[member]");
|
||||
filterChainDefinitionMap.put("/myOrder","roles[member]");
|
||||
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
|
||||
return shiroFilterFactoryBean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HashedCredentialsMatcher hashedCredentialsMatcher(){
|
||||
HashedCredentialsMatcher hashedCredentialsMatcher=new HashedCredentialsMatcher();
|
||||
hashedCredentialsMatcher.setHashAlgorithmName(PasswordHelper.ALGORITHM_NAME);
|
||||
hashedCredentialsMatcher.setHashIterations(PasswordHelper.HASH_ITERATIONS);
|
||||
return hashedCredentialsMatcher;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EnceladusShiroRealm shiroRealm(){
|
||||
EnceladusShiroRealm enceladusShiroRealm=new EnceladusShiroRealm();
|
||||
enceladusShiroRealm.setCredentialsMatcher(hashedCredentialsMatcher());
|
||||
return enceladusShiroRealm;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SecurityManager securityManager(){
|
||||
DefaultWebSecurityManager securityManager=new DefaultWebSecurityManager();
|
||||
securityManager.setRealm(shiroRealm());
|
||||
securityManager.setSessionManager(sessionManager());
|
||||
return securityManager;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PasswordHelper passwordHelper(){
|
||||
return new PasswordHelper();
|
||||
}
|
||||
|
||||
// 将重写的shiro session注册
|
||||
@Bean
|
||||
public SessionManager sessionManager(){
|
||||
ShiroSession shiroSession=new ShiroSession();
|
||||
shiroSession.setSessionDAO(new EnterpriseCacheSessionDAO());
|
||||
return shiroSession;
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package com.example.demo.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
// 配置图片路径
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
// 和页面有关的图片放在项目的img目录下
|
||||
registry.addResourceHandler("/img/**").addResourceLocations("classpath:/img/");
|
||||
}
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.example.demo.entity.CartItem;
|
||||
import com.example.demo.entity.Goods;
|
||||
import com.example.demo.entity.User;
|
||||
import com.example.demo.service.CartItemService;
|
||||
import com.example.demo.service.GoodsService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cart")
|
||||
public class CartItemController {
|
||||
|
||||
@Autowired
|
||||
private CartItemService cartItemService;
|
||||
|
||||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
|
||||
// 添加租赁物品到购物车
|
||||
@RequestMapping("/add")
|
||||
@Transactional(rollbackFor = {RuntimeException.class, Error.class})
|
||||
public String add(@RequestBody Map<String,Object> map){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
Integer goodsId= (Integer) map.get("goodsId");
|
||||
QueryWrapper<Goods> goodsQueryWrapper=new QueryWrapper<>();
|
||||
goodsQueryWrapper.eq("goods_id",goodsId);
|
||||
Goods goods=goodsService.getOne(goodsQueryWrapper);
|
||||
System.out.println(goods);
|
||||
CartItem cartItem=new CartItem();
|
||||
cartItem.setUserId(user.getUserId());
|
||||
cartItem.setGoodsId(goods.getGoodsId());
|
||||
cartItem.setGoodsCount(1);
|
||||
cartItem.setIsDeleted(0);
|
||||
cartItem.setPrice(goods.getGoodsPrice());
|
||||
cartItem.setGoodsCoverImg(goods.getGoodsCoverImg());
|
||||
cartItem.setGoodsName(goods.getGoodsName());
|
||||
System.out.println(cartItem);
|
||||
cartItemService.save(cartItem);
|
||||
return cartItem.getCartItemId().toString();
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
// 读取购物车
|
||||
@RequestMapping("/list")
|
||||
public String list(){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
Integer id=user.getUserId();
|
||||
System.out.println("id:"+id);
|
||||
QueryWrapper<CartItem> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("user_id",id);
|
||||
List<CartItem> cartItemList=cartItemService.list(wrapper);
|
||||
System.out.println(cartItemList.toString());
|
||||
return JSON.toJSONString(cartItemList);
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
// 删除购物车租赁物品
|
||||
@RequestMapping("/delete")
|
||||
public String delete(@RequestBody Map<String, Object> map){
|
||||
Integer itemId= (Integer) map.get("cartItemId");
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
Integer id=user.getUserId();
|
||||
System.out.println("id:"+id);
|
||||
QueryWrapper<CartItem> wrapper = new QueryWrapper<>();
|
||||
wrapper.and(i->i.eq("user_id",id).eq("cart_item_id",itemId));
|
||||
boolean isDelete=cartItemService.remove(wrapper);
|
||||
if(isDelete){
|
||||
return "success";
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
// 修改购物车项目
|
||||
@RequestMapping("/update")
|
||||
public String update(@RequestBody CartItem cartItem){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
Integer id=user.getUserId();
|
||||
Integer carItemId=cartItem.getCartItemId();
|
||||
System.out.println("id:"+id);
|
||||
QueryWrapper<CartItem> wrapper = new QueryWrapper<>();
|
||||
wrapper.and(i->i.eq("user_id",id).eq("cart_item_id", carItemId));
|
||||
boolean isUpdate=cartItemService.update(cartItem,wrapper);
|
||||
if(isUpdate){
|
||||
return "success";
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.example.demo.entity.Category;
|
||||
import com.example.demo.service.CategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/category")
|
||||
public class CategoryController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
// 列出所有分类
|
||||
@RequestMapping("/list")
|
||||
public String list(){
|
||||
QueryWrapper<Category> wrapper = new QueryWrapper<>();
|
||||
QueryWrapper<Category> childrenWrapper = new QueryWrapper<>();
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
wrapper.eq("parent_id", 0);
|
||||
List<Category> categoryParentList=categoryService.list(wrapper);
|
||||
childrenWrapper.ne("parent_id", 0);
|
||||
List<Category> categoryChildrenList=categoryService.list(childrenWrapper);
|
||||
result.put("categoryParentList",categoryParentList);
|
||||
result.put("categoryChildrenList",categoryChildrenList);
|
||||
return JSON.toJSONString(result);
|
||||
}
|
||||
|
||||
// 列出所有子分类
|
||||
@RequestMapping("/listChildrenCategory")
|
||||
public String listChildrenCategory(){
|
||||
QueryWrapper<Category> childrenWrapper = new QueryWrapper<>();
|
||||
childrenWrapper.eq("category_level", 2);
|
||||
List<Category> categoryChildrenList=categoryService.list(childrenWrapper);
|
||||
return JSON.toJSONString(categoryChildrenList);
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.example.demo.entity.Entrust;
|
||||
import com.example.demo.entity.User;
|
||||
import com.example.demo.service.EntrustService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/entrust")
|
||||
public class EntrustController {
|
||||
|
||||
@Autowired
|
||||
private EntrustService entrustService;
|
||||
|
||||
// 用户发布一个委托
|
||||
@RequestMapping("/add")
|
||||
public String add(@RequestBody Map<String,Object> entrustMap){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
Entrust entrust=new Entrust();
|
||||
entrust.setEGoodsName((String) entrustMap.get("eGoodsName"));
|
||||
entrust.setEGoodsIntro((String) entrustMap.get("eGoodsIntro"));
|
||||
entrust.setEGoodsCategory((Integer) entrustMap.get("eGoodsCategory"));
|
||||
entrust.setEGoodsCoverImg((String) entrustMap.get("eGoodsCoverImg"));
|
||||
entrust.setEGoodsCarousel((String) entrustMap.get("eGoodsCarousel"));
|
||||
entrust.setEGoodsDetailContent((String) entrustMap.get("eGoodsDetailContent"));
|
||||
entrust.setEGoodsPrice(Double.parseDouble((String) entrustMap.get("eGoodsPrice")));
|
||||
entrust.setEStockNum((Integer) entrustMap.get("eStockNum"));
|
||||
System.out.println(entrust);
|
||||
entrustService.save(entrust);
|
||||
return entrust.getEntrustId().toString();
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
// 列出所有委托
|
||||
@RequestMapping("/list")
|
||||
public String list(){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
boolean isAdmin=SecurityUtils.getSubject().hasRole("admin");
|
||||
if(null!=user){
|
||||
if(isAdmin){
|
||||
List<Entrust> entrustList=entrustService.list();
|
||||
return JSON.toJSONString(entrustList);
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
// 根据用户id列出委托
|
||||
@RequestMapping("/listById")
|
||||
public String listById(@RequestBody Map<String,Object> map){
|
||||
Integer id= (Integer) map.get("entrustId");
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
System.out.println("编辑委托:"+id);
|
||||
boolean isAdmin=SecurityUtils.getSubject().hasRole("admin");
|
||||
if(null!=user){
|
||||
if(isAdmin){
|
||||
QueryWrapper<Entrust> entrustQueryWrapper = new QueryWrapper<>();
|
||||
entrustQueryWrapper.eq("entrust_id",id);
|
||||
Entrust entrust=entrustService.getOne(entrustQueryWrapper);
|
||||
return JSON.toJSONString(entrust);
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import com.example.demo.entity.User;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
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;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/file")
|
||||
public class FileController {
|
||||
|
||||
@RequestMapping("/upload")
|
||||
public String fileUpload(@RequestParam(value = "img") MultipartFile file){
|
||||
System.out.println("进入上传");
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
System.out.println(user);
|
||||
if(null!=user){
|
||||
if(file.isEmpty()){
|
||||
System.out.println("文件是空的");
|
||||
return "fail";
|
||||
}
|
||||
System.out.println("有文件");
|
||||
// 文件名
|
||||
String fileName = file.getOriginalFilename();
|
||||
System.out.println(fileName);
|
||||
// 后缀名
|
||||
// String suffixName = fileName.substring(fileName.lastIndexOf("."));
|
||||
// 上传后的路径
|
||||
String filePath = "/project/gitProject_recommend/src/demo/backend/target/classes/img/";
|
||||
// 新文件名
|
||||
UUID uuid=UUID.randomUUID();
|
||||
fileName = uuid + ".jpg";
|
||||
System.out.println(fileName);
|
||||
File dest = new File(filePath + fileName);
|
||||
if (!dest.getParentFile().exists()) {
|
||||
dest.getParentFile().mkdirs();
|
||||
}
|
||||
try {
|
||||
file.transferTo(dest);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return uuid.toString();
|
||||
}else {
|
||||
System.out.println("没有用户");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.example.demo.entity.Goods;
|
||||
import com.example.demo.entity.User;
|
||||
import com.example.demo.service.EntrustService;
|
||||
import com.example.demo.service.GoodsService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/goods")
|
||||
public class GoodsController {
|
||||
|
||||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
|
||||
@Autowired
|
||||
private EntrustService entrustService;
|
||||
|
||||
// 根据关键字搜索租赁物品
|
||||
@RequestMapping("/search")
|
||||
@Cacheable(value = "platRedis",key = "#map")
|
||||
public String search(@RequestBody Map<String,Object> map){
|
||||
String key= (String) map.get("key");
|
||||
QueryWrapper<Goods> wrapper = new QueryWrapper<>();
|
||||
wrapper.like("goods_name",key);
|
||||
System.out.println(key);
|
||||
List<Goods> goodsList=goodsService.list(wrapper);
|
||||
return JSON.toJSONString(goodsList);
|
||||
}
|
||||
|
||||
// 获取物品详情
|
||||
@RequestMapping("/detail")
|
||||
public String detail(@RequestBody Map<String,Object> map){
|
||||
Integer key= (Integer) map.get("key");
|
||||
QueryWrapper<Goods> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("goods_id",key);
|
||||
System.out.println(key);
|
||||
Goods goods=goodsService.getOne(wrapper);
|
||||
return JSON.toJSONString(goods);
|
||||
}
|
||||
|
||||
// 从委托添加租赁物品
|
||||
@RequestMapping("/add")
|
||||
@Transactional(rollbackFor = {RuntimeException.class, Error.class})
|
||||
public String add(@RequestBody Map<String,Object> map){
|
||||
Goods goods=JSON.parseObject(JSON.toJSONString(map.get("entrust")),Goods.class);
|
||||
Double price=Double.valueOf((Integer)map.get("itPrice"));
|
||||
Integer entrustId=(Integer)map.get("entrustId");
|
||||
goods.setGoodsPrice(price);
|
||||
System.out.println(price);
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
boolean isAdmin=SecurityUtils.getSubject().hasRole("admin");
|
||||
if(null!=user){
|
||||
if(isAdmin){
|
||||
System.out.println(goods);
|
||||
goods.setGoodsStatus(1);
|
||||
goodsService.save(goods);
|
||||
entrustService.removeById(entrustId);
|
||||
return goods.getGoodsId().toString();
|
||||
}else {
|
||||
return "not admin";
|
||||
}
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/searchByOrder")
|
||||
public String searchByOrder(@RequestBody Map<String,Object> map){
|
||||
String key= (String) map.get("key");
|
||||
String order= (String) map.get("order");
|
||||
QueryWrapper<Goods> wrapper = new QueryWrapper<>();
|
||||
wrapper.like("goods_name",key);
|
||||
wrapper.orderByAsc(order);
|
||||
System.out.println(key);
|
||||
List<Goods> goodsList=goodsService.list(wrapper);
|
||||
return JSON.toJSONString(goodsList);
|
||||
}
|
||||
}
|
||||
|
@ -1,91 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import com.example.demo.entity.User;
|
||||
import com.example.demo.entity.UserRole;
|
||||
import com.example.demo.service.UserRoleService;
|
||||
import com.example.demo.service.UserService;
|
||||
import com.example.demo.util.PasswordHelper;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.IncorrectCredentialsException;
|
||||
import org.apache.shiro.authc.UnknownAccountException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/home")
|
||||
public class HomeController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private UserRoleService userRoleService;
|
||||
|
||||
@Autowired
|
||||
public PasswordHelper passwordHelper;
|
||||
|
||||
// 登录
|
||||
@RequestMapping("/login")
|
||||
public String login(@RequestBody Map<String,Object> map){
|
||||
String userName= (String) map.get("userName");
|
||||
String passWord= (String) map.get("passWord");
|
||||
UsernamePasswordToken usernamePasswordToken=new UsernamePasswordToken(userName,passWord);
|
||||
Subject subject= SecurityUtils.getSubject();
|
||||
try{
|
||||
System.out.println("执行login前:");
|
||||
subject.login(usernamePasswordToken);
|
||||
}catch (IncorrectCredentialsException ice){
|
||||
return "password error!";
|
||||
}catch (UnknownAccountException uae){
|
||||
return "username error!";
|
||||
}
|
||||
|
||||
User user=userService.findAllUserInfoByUsername(userName);
|
||||
subject.getSession().setAttribute("user",user);
|
||||
Serializable tokenId = subject.getSession().getId();
|
||||
boolean isAdmin=SecurityUtils.getSubject().hasRole("admin");
|
||||
System.out.println(isAdmin);
|
||||
System.out.println(SecurityUtils.getSubject().getSession().getAttribute("roleList"));
|
||||
return String.valueOf(tokenId);
|
||||
}
|
||||
|
||||
// 注册
|
||||
@RequestMapping("/register")
|
||||
@Transactional(rollbackFor = {RuntimeException.class, Error.class})
|
||||
public String register(@RequestBody User user){
|
||||
|
||||
System.out.println(user);
|
||||
Date d = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
user.setCreateTime(sdf.format(d));
|
||||
passwordHelper.encryptPassword(user);
|
||||
|
||||
userService.register(user);
|
||||
UserRole userRole=new UserRole();
|
||||
userRole.setUserId(user.getUserId());
|
||||
userRole.setRoleId(1);
|
||||
userRoleService.save(userRole);
|
||||
if(null!=user.getUserId()){
|
||||
return "success";
|
||||
}
|
||||
return "fail";
|
||||
}
|
||||
|
||||
// 登出
|
||||
@RequestMapping("/logout")
|
||||
public String register(){
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
subject.logout();
|
||||
return "logout success";
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.example.demo.entity.IndexConfig;
|
||||
import com.example.demo.service.IndexConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@RestController
|
||||
@RequestMapping("/index-config")
|
||||
public class IndexConfigController {
|
||||
|
||||
@Autowired
|
||||
private IndexConfigService indexConfigService;
|
||||
|
||||
// 获取推荐列表
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestBody Map<String,Object> map){
|
||||
Integer indexType= (Integer) map.get("indexType");
|
||||
QueryWrapper<IndexConfig> indexConfigQueryWrapper=new QueryWrapper<>();
|
||||
indexConfigQueryWrapper.eq("config_type",indexType);
|
||||
List<IndexConfig> indexConfigList= indexConfigService.list(indexConfigQueryWrapper);
|
||||
if(null!=indexConfigList){
|
||||
return JSON.toJSONString(indexConfigList);
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.example.demo.entity.CartItem;
|
||||
import com.example.demo.entity.Order;
|
||||
import com.example.demo.entity.OrderItem;
|
||||
import com.example.demo.entity.User;
|
||||
import com.example.demo.service.CartItemService;
|
||||
import com.example.demo.service.OrderItemService;
|
||||
import com.example.demo.service.OrderService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
public class OrderController {
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@Autowired
|
||||
private OrderItemService orderItemService;
|
||||
|
||||
@Autowired
|
||||
private CartItemService cartItemService;
|
||||
|
||||
// 添加订单
|
||||
@RequestMapping("/add")
|
||||
public String add(@RequestBody Order order){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
System.out.println(order);
|
||||
order.setUserId(user.getUserId());
|
||||
order.setUserAddress(user.getAddress());
|
||||
order.setUserName(user.getUserName());
|
||||
order.setUserPhone(user.getPhone());
|
||||
order.setOrderNum(createNum());
|
||||
orderService.save(order);
|
||||
return order.getOrderId().toString();
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
// 根据用户列出订单列表
|
||||
@RequestMapping("/listByUser")
|
||||
public String listByUser(){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
System.out.println(user.getUserId());
|
||||
QueryWrapper<Order> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("user_id",user.getUserId());
|
||||
List<Order> orderList=orderService.list(wrapper);
|
||||
for(Order order : orderList){
|
||||
if(null!=order.getOrderId()){
|
||||
QueryWrapper<OrderItem> orderItemWrapper = new QueryWrapper<>();
|
||||
orderItemWrapper.eq("order_id",order.getOrderId());
|
||||
List<OrderItem> orderItemList=orderItemService.list(orderItemWrapper);
|
||||
order.setOrderItemList(orderItemList);
|
||||
}
|
||||
}
|
||||
return JSON.toJSONString(orderList);
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
// 随机生成订单号
|
||||
private String createNum(){
|
||||
// 获取当前时间
|
||||
SimpleDateFormat dmDate = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
|
||||
// 定义随机数
|
||||
Random random = new Random();
|
||||
// 随机数长度位数
|
||||
int ran = random.nextInt(1000000);
|
||||
|
||||
Date date = new Date();
|
||||
String dateran = dmDate.format(date);
|
||||
String randomMath = dateran+ran;
|
||||
return randomMath;
|
||||
}
|
||||
|
||||
// 从购物车直接下单
|
||||
@RequestMapping("/addOrderByCart")
|
||||
@Transactional(rollbackFor = {RuntimeException.class, Error.class})
|
||||
public String addOrderByCart(@RequestBody Map<String,Object> map) throws ParseException {
|
||||
List<CartItem> cartItemList=JSON.parseArray(JSON.toJSONString(map.get("cartItemList")), CartItem.class);
|
||||
Double totalPrice= Double.parseDouble((String) map.get("totalPrice"));
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
System.out.println(cartItemList);
|
||||
System.out.println(totalPrice);
|
||||
Order order=new Order();
|
||||
order.setOrderNum(createNum());
|
||||
order.setUserId(user.getUserId());
|
||||
order.setTotalPrice(totalPrice);
|
||||
order.setPayStatus(1);
|
||||
Date dNow = new Date( );
|
||||
SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");
|
||||
order.setPayTime(ft.format(dNow));
|
||||
order.setOrderStatus(1);
|
||||
order.setUserName(user.getUserName());
|
||||
order.setUserPhone(user.getPhone());
|
||||
order.setUserAddress(user.getAddress());
|
||||
order.setCreateTime(ft.format(dNow));
|
||||
boolean isSaveOrder=orderService.save(order);
|
||||
if(isSaveOrder){
|
||||
Integer orderId=order.getOrderId();
|
||||
for(CartItem item:cartItemList){
|
||||
OrderItem tmp=new OrderItem();
|
||||
tmp.setOrderId(orderId);
|
||||
tmp.setGoodsId(item.getGoodsId());
|
||||
tmp.setGoodsName(item.getGoodsName());
|
||||
tmp.setGoodsCoverImg(item.getGoodsCoverImg());
|
||||
tmp.setPrice(item.getSingleTotalPrice());
|
||||
tmp.setGoodsCount(item.getGoodsCount());
|
||||
String format = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
tmp.setCreateTime(item.getCreateTime().split("T")[0]);
|
||||
tmp.setEndTime(item.getEndTime().split("T")[0]);
|
||||
tmp.setUserId(user.getUserId());
|
||||
boolean isSaveOrderItem=orderItemService.save(tmp);
|
||||
if(isSaveOrderItem){
|
||||
QueryWrapper<CartItem> cartItemQueryWrapper=new QueryWrapper<>();
|
||||
cartItemQueryWrapper.eq("cart_item_id",item.getCartItemId());
|
||||
cartItemService.remove(cartItemQueryWrapper);
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return "success";
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.example.demo.entity.OrderItem;
|
||||
import com.example.demo.entity.User;
|
||||
import com.example.demo.service.OrderItemService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/orderItem")
|
||||
public class OrderItemController {
|
||||
|
||||
@Autowired
|
||||
private OrderItemService orderItemService;
|
||||
|
||||
// 增加物品项
|
||||
@RequestMapping("/add")
|
||||
public String add(@RequestBody OrderItem orderItem){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
System.out.println(orderItem);
|
||||
orderItem.setUserId(user.getUserId());
|
||||
orderItemService.save(orderItem);
|
||||
return orderItem.getOrderItemId().toString();
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
// 根据订单列出订单项
|
||||
@RequestMapping("/listByOrder")
|
||||
public String listByOrder(@RequestBody Map<String, Object> map){
|
||||
Integer orderId= (Integer) map.get("orderId");
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
System.out.println(orderId);
|
||||
QueryWrapper<OrderItem> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("order_id",orderId);
|
||||
List<OrderItem> orderItemList=orderItemService.list(wrapper);
|
||||
return JSON.toJSONString(orderItemList);
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
// 根据用户列出订单项
|
||||
@RequestMapping("/listByUser")
|
||||
public List<OrderItem> listByUser(){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
if(null!=user){
|
||||
QueryWrapper<OrderItem> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("user_id",user.getUserId());
|
||||
List<OrderItem> orderItemList=orderItemService.list(wrapper);
|
||||
return orderItemList;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/demo/permission")
|
||||
public class PermissionController {
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/demo/role")
|
||||
public class RoleController {
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/demo/role-permission")
|
||||
public class RolePermissionController {
|
||||
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.example.demo.entity.User;
|
||||
import com.example.demo.service.UserService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
// 获取用户信息
|
||||
@RequestMapping("/userInfo")
|
||||
public String userInfo(){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
String result;
|
||||
if(null!=user){
|
||||
User tmp=new User();
|
||||
tmp.setName(user.getName());
|
||||
tmp.setPhone(user.getPhone());
|
||||
tmp.setAddress(user.getAddress());
|
||||
tmp.setSex(user.getSex());
|
||||
tmp.setUserId(user.getUserId());
|
||||
result=JSON.toJSONString(tmp);
|
||||
return result;
|
||||
}
|
||||
return "not login";
|
||||
}
|
||||
|
||||
// 判断是否为管理员
|
||||
@RequestMapping("/isAdmin")
|
||||
public boolean isAdmin(){
|
||||
User user = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
boolean isAdmin=SecurityUtils.getSubject().hasRole("admin");
|
||||
return isAdmin;
|
||||
}
|
||||
|
||||
@RequestMapping("/editUserInfo")
|
||||
public String editUserInfo(@RequestBody User user){
|
||||
User tmp = (User) SecurityUtils.getSubject().getSession().getAttribute("user");
|
||||
String result;
|
||||
System.out.println(user);
|
||||
if(null!=user){
|
||||
Integer id=tmp.getUserId();
|
||||
QueryWrapper<User> userQueryWrapper=new QueryWrapper<>();
|
||||
userQueryWrapper.eq("user_id",id);
|
||||
boolean isEdit=userService.update(user,userQueryWrapper);
|
||||
if(isEdit){
|
||||
return "success";
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}else {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/demo/user-role")
|
||||
public class UserRoleController {
|
||||
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="CartItem对象", description="")
|
||||
public class CartItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "购物项id")
|
||||
@TableId(value = "cart_item_id", type = IdType.AUTO)
|
||||
private Integer cartItemId;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "物品id")
|
||||
private Integer goodsId;
|
||||
|
||||
@ApiModelProperty(value = "物品数量")
|
||||
private Integer goodsCount;
|
||||
|
||||
@ApiModelProperty(value = "删除标识字段(0-未删除 1-已删除)")
|
||||
private Integer isDeleted;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "单项价")
|
||||
private double price;
|
||||
|
||||
@ApiModelProperty(value = "物品图片")
|
||||
private String goodsCoverImg;
|
||||
|
||||
@ApiModelProperty(value = "物品名称")
|
||||
private String goodsName;
|
||||
|
||||
@ApiModelProperty(value = "总租赁天数")
|
||||
@TableField(exist = false)
|
||||
private Integer totalDay;
|
||||
|
||||
@ApiModelProperty(value = "单项总价")
|
||||
@TableField(exist = false)
|
||||
private double singleTotalPrice;
|
||||
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="Entrust对象", description="")
|
||||
public class Entrust implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "委托id")
|
||||
@TableId(value = "entrust_id", type = IdType.AUTO)
|
||||
private Integer entrustId;
|
||||
|
||||
@ApiModelProperty(value = "委托物品名称")
|
||||
private String eGoodsName;
|
||||
|
||||
@ApiModelProperty(value = "物品简介")
|
||||
private String eGoodsIntro;
|
||||
|
||||
@ApiModelProperty(value = "物品分类id")
|
||||
private Integer eGoodsCategory;
|
||||
|
||||
@ApiModelProperty(value = "物品主图片")
|
||||
private String eGoodsCoverImg;
|
||||
|
||||
@ApiModelProperty(value = "物品轮播图片")
|
||||
private String eGoodsCarousel;
|
||||
|
||||
@ApiModelProperty(value = "物品详情")
|
||||
private String eGoodsDetailContent;
|
||||
|
||||
@ApiModelProperty(value = "委托租赁单价 元/天")
|
||||
private Double eGoodsPrice;
|
||||
|
||||
@ApiModelProperty(value = "委托数量")
|
||||
private Integer eStockNum;
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="IndexConfig对象", description="")
|
||||
public class IndexConfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "首页配置项id")
|
||||
@TableId(value = "config_id", type = IdType.AUTO)
|
||||
private Integer configId;
|
||||
|
||||
@ApiModelProperty(value = "显示名称")
|
||||
private String configName;
|
||||
|
||||
@ApiModelProperty(value = "1-今日推进 2-今日优惠 3-为您推荐")
|
||||
private Integer configType;
|
||||
|
||||
@ApiModelProperty(value = "物品id")
|
||||
private Integer goodsId;
|
||||
|
||||
@ApiModelProperty(value = "删除标识字段(0-未删除 1-已删除)")
|
||||
private Integer isDeleted;
|
||||
|
||||
@ApiModelProperty(value = "物品图片")
|
||||
private String goodsCoverImg;
|
||||
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="Order对象", description="")
|
||||
@TableName(value = "orderKK")
|
||||
public class Order implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "订单表id")
|
||||
@TableId(value = "order_id", type = IdType.AUTO)
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private String orderNum;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "订单总价")
|
||||
private Double totalPrice;
|
||||
|
||||
@ApiModelProperty(value = "支付状态:0.未支付,1.支付成功,-1:支付失败")
|
||||
private Integer payStatus;
|
||||
|
||||
@ApiModelProperty(value = "支付时间")
|
||||
private String payTime;
|
||||
|
||||
@ApiModelProperty(value = "订单状态:0.待支付 1.已支付 2.配货完成 3:出库成功 4.交易成功 -1.手动关闭 -2.超时关闭 -3.商家关闭")
|
||||
private Integer orderStatus;
|
||||
|
||||
@ApiModelProperty(value = "订单内容描述")
|
||||
private String extraInfo;
|
||||
|
||||
@ApiModelProperty(value = "收货人姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "收货人手机号")
|
||||
private String userPhone;
|
||||
|
||||
@ApiModelProperty(value = "收货人地址")
|
||||
private String userAddress;
|
||||
|
||||
@ApiModelProperty(value = "删除标识字段(0-未删除 1-已删除)")
|
||||
private Integer isDeleted;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "结束租赁时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "订单项列表")
|
||||
@TableField(exist = false) //非数据库字段
|
||||
private List<OrderItem> orderItemList;
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="OrderItem对象", description="")
|
||||
public class OrderItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "订单项id")
|
||||
@TableId(value = "order_item_id", type = IdType.AUTO)
|
||||
private Integer orderItemId;
|
||||
|
||||
@ApiModelProperty(value = "关联订单id")
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty(value = "关联物品id")
|
||||
private Integer goodsId;
|
||||
|
||||
@ApiModelProperty(value = "物品名称")
|
||||
private String goodsName;
|
||||
|
||||
@ApiModelProperty(value = "物品主图")
|
||||
private String goodsCoverImg;
|
||||
|
||||
@ApiModelProperty(value = "物品价格")
|
||||
private Double price;
|
||||
|
||||
@ApiModelProperty(value = "物品数量")
|
||||
private Integer goodsCount;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "结束租赁时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="Permission对象", description="")
|
||||
public class Permission implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "权限名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "接口路径")
|
||||
private String url;
|
||||
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="Role对象", description="")
|
||||
public class Role implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "角色名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String description;
|
||||
|
||||
// 权限集合
|
||||
@ApiModelProperty(value = "权限集合")
|
||||
@TableField(exist = false) //非数据库字段
|
||||
private List<Permission> permissionList = new ArrayList<>();
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="RolePermission对象", description="")
|
||||
public class RolePermission implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "角色id")
|
||||
private Integer roleId;
|
||||
|
||||
@ApiModelProperty(value = "权限id")
|
||||
private Integer permissionId;
|
||||
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="User对象", description="")
|
||||
public class User implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "用户主键id")
|
||||
@TableId(value = "user_id", type = IdType.AUTO)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "性别")
|
||||
private String sex;
|
||||
|
||||
@ApiModelProperty(value = "电话号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "登录用户名")
|
||||
@TableField("userName")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "MD5加密后的密码")
|
||||
@TableField("passWord")
|
||||
private String passWord;
|
||||
|
||||
@ApiModelProperty(value = "收货地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
@TableField("createTime")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "加密盐")
|
||||
@TableField("createTime")
|
||||
private String salt;
|
||||
// 角色集合
|
||||
@ApiModelProperty(value = "角色集合")
|
||||
@TableField(exist = false) //非数据库字段
|
||||
private List<Role> roleList = new ArrayList<>();
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="UserRole对象", description="")
|
||||
public class UserRole implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "角色id")
|
||||
private Integer roleId;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
private String remarks;
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.CartItem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface CartItemMapper extends BaseMapper<CartItem> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.Category;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface CategoryMapper extends BaseMapper<Category> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.Entrust;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface EntrustMapper extends BaseMapper<Entrust> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.Goods;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface GoodsMapper extends BaseMapper<Goods> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.IndexConfig;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface IndexConfigMapper extends BaseMapper<IndexConfig> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.OrderItem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface OrderItemMapper extends BaseMapper<OrderItem> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.Order;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface OrderMapper extends BaseMapper<Order> {
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.Permission;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface PermissionMapper extends BaseMapper<Permission> {
|
||||
|
||||
public Permission listPermissionCascadeByRole(Integer roleId);
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.Role;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RoleMapper extends BaseMapper<Role> {
|
||||
public List<Role> listRoleCascadeByUser(Integer userId);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.RolePermission;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface RolePermissionMapper extends BaseMapper<RolePermission> {
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.User;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
public User findAllUserInfoByUsername(String userName);
|
||||
|
||||
public void register(User user);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.mapper;
|
||||
|
||||
import com.example.demo.entity.UserRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface UserRoleMapper extends BaseMapper<UserRole> {
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?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.example.demo.mapper.CartItemMapper">
|
||||
|
||||
</mapper>
|
@ -1,5 +0,0 @@
|
||||
<?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.example.demo.mapper.CategoryMapper">
|
||||
|
||||
</mapper>
|
@ -1,5 +0,0 @@
|
||||
<?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.example.demo.mapper.EntrustMapper">
|
||||
|
||||
</mapper>
|
@ -1,5 +0,0 @@
|
||||
<?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.example.demo.mapper.GoodsMapper">
|
||||
|
||||
</mapper>
|
@ -1,5 +0,0 @@
|
||||
<?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.example.demo.mapper.IndexConfigMapper">
|
||||
|
||||
</mapper>
|
@ -1,5 +0,0 @@
|
||||
<?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.example.demo.mapper.OrderItemMapper">
|
||||
|
||||
</mapper>
|
@ -1,5 +0,0 @@
|
||||
<?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.example.demo.mapper.OrderMapper">
|
||||
|
||||
</mapper>
|
@ -1,23 +0,0 @@
|
||||
<?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.example.demo.mapper.PermissionMapper">
|
||||
|
||||
<resultMap id="permissionResultMap" type="com.example.demo.entity.Permission">
|
||||
<id column="id" property="id"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="url" property="url"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="listPermissionCascadeByRole" resultType="com.example.demo.entity.Permission">
|
||||
select
|
||||
permission.id id,permission.`name` name,permission.url url
|
||||
from
|
||||
role_permission
|
||||
left join
|
||||
permission
|
||||
on
|
||||
role_permission.permission_id=permission.id
|
||||
where
|
||||
role_permission.role_id=#{roleId}
|
||||
</select>
|
||||
</mapper>
|
@ -1,26 +0,0 @@
|
||||
<?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.example.demo.mapper.RoleMapper">
|
||||
|
||||
<resultMap id="roleResultMap" type="com.example.demo.entity.Role">
|
||||
<id column="id" property="id"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="description" property="description"/>
|
||||
<collection property="permissionList" select="com.example.demo.mapper.PermissionMapper.listPermissionCascadeByRole" column="{roleId=id}"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="listRoleCascadeByUser" resultMap="roleResultMap">
|
||||
select
|
||||
role.id id,
|
||||
role.name name,
|
||||
role.description description
|
||||
from
|
||||
user_role
|
||||
left join
|
||||
role
|
||||
on
|
||||
user_role.role_id=role.id
|
||||
where
|
||||
user_role.user_id=#{userId}
|
||||
</select>
|
||||
</mapper>
|
@ -1,5 +0,0 @@
|
||||
<?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.example.demo.mapper.RolePermissionMapper">
|
||||
|
||||
</mapper>
|
@ -1,31 +0,0 @@
|
||||
<?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.example.demo.mapper.UserMapper">
|
||||
|
||||
<resultMap id="userResultMap" type="com.example.demo.entity.User">
|
||||
<id column="user_id" property="userId" />
|
||||
<result column="name" property="name"/>
|
||||
<result column="sex" property="sex"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="userName" property="userName"/>
|
||||
<result column="passWord" property="passWord"/>
|
||||
<result column="address" property="address"/>
|
||||
<result column="createTime" property="createTime"/>
|
||||
<result column="salt" property="salt"/>
|
||||
<collection property="roleList" select="com.example.demo.mapper.RoleMapper.listRoleCascadeByUser" column="{userId=user_id}"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<select id="findAllUserInfoByUsername" resultMap="userResultMap">
|
||||
select
|
||||
*
|
||||
from
|
||||
user
|
||||
where
|
||||
userName=#{userName}
|
||||
</select>
|
||||
|
||||
<insert id="register" useGeneratedKeys="true" keyProperty="userId" parameterType="com.example.demo.entity.User">
|
||||
INSERT into user(`name`,`sex`,`phone`,userName,`passWord`,`address`,`createTime`,salt) VALUES(#{name},#{sex},#{phone},#{userName},#{passWord},#{address},#{createTime},#{salt});
|
||||
</insert>
|
||||
</mapper>
|
@ -1,5 +0,0 @@
|
||||
<?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.example.demo.mapper.UserRoleMapper">
|
||||
|
||||
</mapper>
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.CartItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface CartItemService extends IService<CartItem> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.Category;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface CategoryService extends IService<Category> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.Entrust;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface EntrustService extends IService<Entrust> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.Goods;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface GoodsService extends IService<Goods> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.IndexConfig;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface IndexConfigService extends IService<IndexConfig> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface OrderItemService extends IService<OrderItem> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.Order;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface OrderService extends IService<Order> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.Permission;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface PermissionService extends IService<Permission> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.RolePermission;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface RolePermissionService extends IService<RolePermission> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.Role;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface RoleService extends IService<Role> {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.UserRole;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface UserRoleService extends IService<UserRole> {
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import com.example.demo.entity.User;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface UserService extends IService<User> {
|
||||
|
||||
public User findAllUserInfoByUsername(String username);
|
||||
|
||||
public void register(User user);
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.CartItem;
|
||||
import com.example.demo.mapper.CartItemMapper;
|
||||
import com.example.demo.service.CartItemService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CartItemServiceImpl extends ServiceImpl<CartItemMapper, CartItem> implements CartItemService {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.Category;
|
||||
import com.example.demo.mapper.CategoryMapper;
|
||||
import com.example.demo.service.CategoryService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.Entrust;
|
||||
import com.example.demo.mapper.EntrustMapper;
|
||||
import com.example.demo.service.EntrustService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> implements EntrustService {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.Goods;
|
||||
import com.example.demo.mapper.GoodsMapper;
|
||||
import com.example.demo.service.GoodsService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.IndexConfig;
|
||||
import com.example.demo.mapper.IndexConfigMapper;
|
||||
import com.example.demo.service.IndexConfigService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class IndexConfigServiceImpl extends ServiceImpl<IndexConfigMapper, IndexConfig> implements IndexConfigService {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.OrderItem;
|
||||
import com.example.demo.mapper.OrderItemMapper;
|
||||
import com.example.demo.service.OrderItemService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class OrderItemServiceImpl extends ServiceImpl<OrderItemMapper, OrderItem> implements OrderItemService {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.Order;
|
||||
import com.example.demo.mapper.OrderMapper;
|
||||
import com.example.demo.service.OrderService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.Permission;
|
||||
import com.example.demo.mapper.PermissionMapper;
|
||||
import com.example.demo.service.PermissionService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, Permission> implements PermissionService {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.RolePermission;
|
||||
import com.example.demo.mapper.RolePermissionMapper;
|
||||
import com.example.demo.service.RolePermissionService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class RolePermissionServiceImpl extends ServiceImpl<RolePermissionMapper, RolePermission> implements RolePermissionService {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.Role;
|
||||
import com.example.demo.mapper.RoleMapper;
|
||||
import com.example.demo.service.RoleService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.UserRole;
|
||||
import com.example.demo.mapper.UserRoleMapper;
|
||||
import com.example.demo.service.UserRoleService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService {
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.example.demo.service.impl;
|
||||
|
||||
import com.example.demo.entity.User;
|
||||
import com.example.demo.mapper.UserMapper;
|
||||
import com.example.demo.service.UserService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public User findAllUserInfoByUsername(String username){
|
||||
return userMapper.findAllUserInfoByUsername(username);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(User user) {
|
||||
userMapper.register(user);
|
||||
}
|
||||
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package com.example.demo.util;
|
||||
|
||||
import com.example.demo.entity.User;
|
||||
import org.apache.shiro.crypto.RandomNumberGenerator;
|
||||
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
|
||||
import org.apache.shiro.crypto.hash.SimpleHash;
|
||||
import org.apache.shiro.util.ByteSource;
|
||||
|
||||
// 密码加密
|
||||
public class PasswordHelper {
|
||||
private RandomNumberGenerator randomNumberGenerator = new SecureRandomNumberGenerator();
|
||||
public static final String ALGORITHM_NAME = "md5"; // 基础散列算法
|
||||
public static final int HASH_ITERATIONS = 2; // 自定义散列次数
|
||||
|
||||
public void encryptPassword(User user) {
|
||||
user.setSalt(randomNumberGenerator.nextBytes().toHex());
|
||||
String newPassword = new SimpleHash(ALGORITHM_NAME, user.getPassWord(),
|
||||
ByteSource.Util.bytes(user.getSalt()), HASH_ITERATIONS).toHex();
|
||||
user.setPassWord(newPassword);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue