parent
0997c366d2
commit
33171b8177
@ -0,0 +1,2 @@
|
|||||||
|
# Project exclude paths
|
||||||
|
/target/
|
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<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>
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="@localhost" uuid="a372ad42-6e95-4846-8755-751ba1d0097d">
|
||||||
|
<driver-ref>mysql.8</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,20 @@
|
|||||||
|
<?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>
|
@ -0,0 +1,14 @@
|
|||||||
|
<?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$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="azul-17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,124 @@
|
|||||||
|
<?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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,169 @@
|
|||||||
|
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.example</groupId>
|
||||||
|
<artifactId>demo</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>16</source>
|
||||||
|
<target>16</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <build>-->
|
||||||
|
<!-- <plugins>-->
|
||||||
|
<!-- <plugin>-->
|
||||||
|
<!-- <groupId>org.apache.maven.plugins</groupId>-->
|
||||||
|
<!-- <artifactId>maven-compiler-plugin</artifactId>-->
|
||||||
|
<!-- <configuration>-->
|
||||||
|
<!-- <source>16</source>-->
|
||||||
|
<!-- <target>16</target>-->
|
||||||
|
<!-- </configuration>-->
|
||||||
|
<!-- </plugin>-->
|
||||||
|
<!-- </plugins>-->
|
||||||
|
<!-- </build>-->
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.7.5</version>
|
||||||
|
<relativePath/>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- json-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<version>2.8.5</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.fasterxml.jackson.core</groupId>-->
|
||||||
|
<!-- <artifactId>jackson-databind</artifactId>-->
|
||||||
|
<!-- <version>2.12.5</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!--lombok-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.24</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.24</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- json-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<version>2.8.5</version>
|
||||||
|
</dependency>
|
||||||
|
<!--lombok-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.24</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>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.baomidou</groupId>-->
|
||||||
|
<!-- <artifactId>mybatis-plus-generator</artifactId>-->
|
||||||
|
<!-- <version>3.0.5</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-test</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-test</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.thymeleaf</groupId>-->
|
||||||
|
<!-- <artifactId>thymeleaf-spring6</artifactId>-->
|
||||||
|
<!-- <version>3.1.1.RELEASE</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.thymeleaf.extras</groupId>-->
|
||||||
|
<!-- <artifactId>thymeleaf-extras-java8time</artifactId>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
<artifactId>velocity</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>io.springfox</groupId>-->
|
||||||
|
<!-- <artifactId>springfox-boot-starter</artifactId>-->
|
||||||
|
<!-- <version>3.0.0</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,22 @@
|
|||||||
|
package com;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
|
//扫描文件夹
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.Chlin.blog.mapper")
|
||||||
|
@ComponentScan("com.Chlin.blog.mapper")
|
||||||
|
//@ComponentScan("com.Chlin.blog.controller")
|
||||||
|
@ComponentScan("com.Chlin.blog.dao")
|
||||||
|
@ComponentScan({"com.Chlin.blog.controller", "com.Chlin.blog.service.impl"})
|
||||||
|
//@ComponentScan("com.Chlin.blog.service.impl")
|
||||||
|
//@ComponentScan("com.Chlin.blog")
|
||||||
|
public class Application {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(Application.class,args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.Chlin.blog.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/blog/department")
|
||||||
|
public class DepartmentController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
|||||||
|
package com.Chlin.blog.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.Orders;
|
||||||
|
import com.Chlin.blog.entity.User;
|
||||||
|
import com.Chlin.blog.service.DishService;
|
||||||
|
import com.Chlin.blog.service.OrderService;
|
||||||
|
import com.Chlin.blog.service.UserService;
|
||||||
|
import com.Chlin.blog.service.impl.DishServiceImpl;
|
||||||
|
import com.Chlin.blog.service.impl.OrderServiceImpl;
|
||||||
|
import com.Chlin.blog.service.impl.UserServiceImpl;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import lombok.val;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/blog/order")
|
||||||
|
public class OrderController {
|
||||||
|
@Autowired
|
||||||
|
OrderService orderService=new OrderServiceImpl();
|
||||||
|
@Autowired
|
||||||
|
DishService dishService=new DishServiceImpl();
|
||||||
|
@Autowired
|
||||||
|
UserService userService=new UserServiceImpl();
|
||||||
|
|
||||||
|
Gson gson=new Gson();
|
||||||
|
|
||||||
|
@PostMapping("/payment1")
|
||||||
|
public ResponseEntity<String> payment(@RequestBody String json, HttpServletRequest request){
|
||||||
|
|
||||||
|
HttpSession session=request.getSession();
|
||||||
|
User user=(User) session.getAttribute("onlineUsers");
|
||||||
|
System.out.println(user.toString());
|
||||||
|
//获得当前选中的订单
|
||||||
|
Orders orders=gson.fromJson(json,Orders.class);
|
||||||
|
|
||||||
|
//查询数据库中的订单
|
||||||
|
Orders orders1 = orderService.listByUseridAndDishId(orders);
|
||||||
|
|
||||||
|
if(user.getBalance().compareTo(orders1.getPaidAmount())>0){
|
||||||
|
final val subtract = user.getBalance().subtract(orders1.getAmount());
|
||||||
|
user.setBalance(subtract);
|
||||||
|
//订单完成,设置订单状态,更新订单完成时间
|
||||||
|
orders1.setStatus(1);
|
||||||
|
orders1.setCompleteTime(new Date());
|
||||||
|
//跟新用户跟订单状态
|
||||||
|
userService.saveOrUpdate(user);
|
||||||
|
//更新在线用户数据
|
||||||
|
session.setAttribute("onlineUsers",user);
|
||||||
|
//更新订单
|
||||||
|
orderService.updateById(orders1);
|
||||||
|
return ResponseEntity.ok("有订单,正在计算中,支付成功");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("余额不足了");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.Chlin.blog.dao;
|
||||||
|
import com.Chlin.blog.entity.Dish;
|
||||||
|
import com.Chlin.blog.mapper.DishMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单的Dao层
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class DishDao {
|
||||||
|
/**
|
||||||
|
* 私有构造
|
||||||
|
*/
|
||||||
|
private static DishDao instance;
|
||||||
|
|
||||||
|
private DishDao() {
|
||||||
|
// 私有构造函数
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DishDao getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new DishDao();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DishMapper dishMapper;
|
||||||
|
|
||||||
|
public void setDishMapper(DishMapper dishMapper) {
|
||||||
|
this.dishMapper = dishMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基本crud
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查找所有
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Dish> selectAll() {
|
||||||
|
List<Dish> dishes = dishMapper.selectList(null);
|
||||||
|
return dishes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @param dish
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int insertDishData(Dish dish) {
|
||||||
|
return dishMapper.insert(dish);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id更新
|
||||||
|
*/
|
||||||
|
public int upDataUserMassageById( Dish dish) {
|
||||||
|
return dishMapper.updateById(dish);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id删除
|
||||||
|
*/
|
||||||
|
public int deleteUserMassageById(Dish dish) {
|
||||||
|
return dishMapper.deleteById(dish);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.Chlin.blog.dao;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.Orders;
|
||||||
|
import com.Chlin.blog.mapper.OrdersMapper;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单的dao层
|
||||||
|
*/
|
||||||
|
public class OrderDao {
|
||||||
|
/**
|
||||||
|
* 私有构造
|
||||||
|
*/
|
||||||
|
private OrderDao() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OrderDao getInstance() {
|
||||||
|
return new OrderDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基本crud
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查找所有
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Orders> selectAll(OrdersMapper ordersMapper){
|
||||||
|
List<Orders> orders = ordersMapper.selectList(null);
|
||||||
|
return orders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param ordersMapper
|
||||||
|
* @param orders
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int insertOrderData(OrdersMapper ordersMapper, Orders orders){
|
||||||
|
return ordersMapper.insert(orders);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据id更新
|
||||||
|
*/
|
||||||
|
public int upDataUserMassageById(OrdersMapper ordersMapper, Orders orders){
|
||||||
|
return ordersMapper.updateById(orders);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id删除
|
||||||
|
*/
|
||||||
|
public int deleteUserMassageById(OrdersMapper ordersMapperr, Orders orders){
|
||||||
|
return ordersMapperr.deleteById(orders);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.Chlin.blog.dao;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.User;
|
||||||
|
import com.Chlin.blog.mapper.UserMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户跟数据库交互层crud
|
||||||
|
*/
|
||||||
|
public class UserDao {
|
||||||
|
|
||||||
|
private UserDao() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UserDao getInstance() {
|
||||||
|
return new UserDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查找所有
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<User> selectAll(UserMapper userMapper){
|
||||||
|
List<User> users = userMapper.selectList(null);
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param userMapper
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int insertUserData(UserMapper userMapper,User user){
|
||||||
|
return userMapper.insert(user);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据id更新
|
||||||
|
*/
|
||||||
|
public int upDataUserMassageById(UserMapper userMapper,User user){
|
||||||
|
return userMapper.updateById(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id删除
|
||||||
|
*/
|
||||||
|
public int deleteUserMassageById(UserMapper userMapper,User user){
|
||||||
|
return userMapper.deleteById(user);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.Chlin.blog.dao;
|
||||||
|
|
||||||
|
import com.Chlin.blog.mapper.UserMapper;
|
||||||
|
import lombok.val;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class userDaotest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserMapper userMapper ;
|
||||||
|
@Test
|
||||||
|
public void testone(){
|
||||||
|
UserDao userDao=UserDao.getInstance();
|
||||||
|
val users = userDao.selectAll(userMapper);
|
||||||
|
users.forEach(System.out::println);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.Chlin.blog.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.io.Serializable;
|
||||||
|
//import io.swagger.annotations.ApiModel;
|
||||||
|
//import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
//@ApiModel(value="Department对象", description="")
|
||||||
|
public class Department implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Department setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Department setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Department{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name=" + name +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,144 @@
|
|||||||
|
package com.Chlin.blog.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
//import io.swagger.annotations.ApiModel;
|
||||||
|
//import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 一个菜品dish类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
//@ApiModel(value="Dish对象", description="")
|
||||||
|
@Data
|
||||||
|
public class Dish implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
private Integer categoryId=0;
|
||||||
|
|
||||||
|
private Integer monthlySales;
|
||||||
|
|
||||||
|
private Integer inventory;
|
||||||
|
|
||||||
|
// @ApiModelProperty(value = "状态:0-下架,1-上架")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dish setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dish setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dish setPrice(BigDecimal price) {
|
||||||
|
this.price = price;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCategoryId() {
|
||||||
|
return categoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dish setCategoryId(Integer categoryId) {
|
||||||
|
this.categoryId = categoryId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMonthlySales() {
|
||||||
|
return monthlySales;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dish setMonthlySales(Integer monthlySales) {
|
||||||
|
this.monthlySales = monthlySales;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getInventory() {
|
||||||
|
return inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dish setInventory(Integer inventory) {
|
||||||
|
this.inventory = inventory;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dish setStatus(Integer status) {
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dish setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dish setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Dish{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name=" + name +
|
||||||
|
", price=" + price +
|
||||||
|
", categoryId=" + categoryId +
|
||||||
|
", monthlySales=" + monthlySales +
|
||||||
|
", inventory=" + inventory +
|
||||||
|
", status=" + status +
|
||||||
|
", createTime=" + createTime +
|
||||||
|
", updateTime=" + updateTime +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,157 @@
|
|||||||
|
package com.Chlin.blog.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.io.Serializable;
|
||||||
|
//import io.swagger.annotations.ApiModel;
|
||||||
|
//import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
//@ApiModel(value="Order对象", description="")
|
||||||
|
public class Orders implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
private Integer dishId;
|
||||||
|
|
||||||
|
//购买数量
|
||||||
|
private Integer count;
|
||||||
|
|
||||||
|
//单个金额
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
//支付金额paid=count+amount
|
||||||
|
private BigDecimal paidAmount;
|
||||||
|
|
||||||
|
// @ApiModelProperty(value = "状态:0-未付款,1-已付款")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
// @ApiModelProperty(value = "支付类型:1-余额;2-现金")
|
||||||
|
private Integer payType;
|
||||||
|
|
||||||
|
private Date completeTime;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders setUserId(Integer userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDishId() {
|
||||||
|
return dishId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders setDishId(Integer dishId) {
|
||||||
|
this.dishId = dishId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders setCount(Integer count) {
|
||||||
|
this.count = count;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders setAmount(BigDecimal amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPaidAmount() {
|
||||||
|
return paidAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders setPaidAmount(BigDecimal paidAmount) {
|
||||||
|
this.paidAmount = paidAmount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders setStatus(Integer status) {
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPayType() {
|
||||||
|
return payType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders setPayType(Integer payType) {
|
||||||
|
this.payType = payType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCompleteTime() {
|
||||||
|
return completeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders setCompleteTime(Date completeTime) {
|
||||||
|
this.completeTime = completeTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Orders setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Orders{" +
|
||||||
|
"id=" + id +
|
||||||
|
", userId=" + userId +
|
||||||
|
", dishId=" + dishId +
|
||||||
|
", count=" + count +
|
||||||
|
", amount=" + amount +
|
||||||
|
", paidAmount=" + paidAmount +
|
||||||
|
", status=" + status +
|
||||||
|
", payType=" + payType +
|
||||||
|
", completeTime=" + completeTime +
|
||||||
|
", createTime=" + createTime +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,204 @@
|
|||||||
|
package com.Chlin.blog.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.io.Serializable;
|
||||||
|
//import io.swagger.annotations.ApiModel;
|
||||||
|
//import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
//@ApiModel(value="User对象", description="")
|
||||||
|
public class User implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private String realName;
|
||||||
|
|
||||||
|
// @ApiModelProperty(value = "用户类型:0-学生,1-员工")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private String studentId;
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
private Integer phone;
|
||||||
|
|
||||||
|
private Integer grade;
|
||||||
|
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
private Date registerTime;
|
||||||
|
|
||||||
|
private Date lastLoginTime;
|
||||||
|
private boolean rememberpassword;
|
||||||
|
private String signatures;
|
||||||
|
|
||||||
|
public boolean isRememberpassword() {
|
||||||
|
return rememberpassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getSignatures() {
|
||||||
|
return signatures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSignatures(String signatures) {
|
||||||
|
this.signatures = signatures;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// public static long getSerialVersionUID() {
|
||||||
|
// return serialVersionUID;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public boolean isRememberPassword() {
|
||||||
|
return rememberpassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRememberPassword(boolean rememberPassword) {
|
||||||
|
this.rememberpassword = rememberPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRealName() {
|
||||||
|
return realName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User setRealName(String realName) {
|
||||||
|
this.realName = realName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User setType(Integer type) {
|
||||||
|
this.type = type;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStudentId() {
|
||||||
|
return studentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User setStudentId(String studentId) {
|
||||||
|
this.studentId = studentId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(Integer phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getGrade() {
|
||||||
|
return grade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User setGrade(Integer grade) {
|
||||||
|
this.grade = grade;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getBalance() {
|
||||||
|
return balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User setBalance(BigDecimal balance) {
|
||||||
|
this.balance = balance;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getRegisterTime() {
|
||||||
|
return registerTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User setRegisterTime(Date registerTime) {
|
||||||
|
this.registerTime = registerTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastLoginTime() {
|
||||||
|
return lastLoginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User setLastLoginTime(Date lastLoginTime) {
|
||||||
|
this.lastLoginTime = lastLoginTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "User{" +
|
||||||
|
"id=" + id +
|
||||||
|
", username=" + username +
|
||||||
|
", password=" + password +
|
||||||
|
", realName=" + realName +
|
||||||
|
", type=" + type +
|
||||||
|
", studentId=" + studentId +
|
||||||
|
", email=" + email +
|
||||||
|
", phone=" + phone +
|
||||||
|
", grade=" + grade +
|
||||||
|
", balance=" + balance +
|
||||||
|
", signatures=" + signatures +
|
||||||
|
", registerTime=" + registerTime +
|
||||||
|
", lastLoginTime=" + lastLoginTime +
|
||||||
|
", rememberPassword=" + rememberpassword +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.Chlin.blog.mapper;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.Department;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
public interface DepartmentMapper extends BaseMapper<Department> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.Chlin.blog.mapper;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.Dish;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
//@Mapper
|
||||||
|
public interface DishMapper extends BaseMapper<Dish> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.Chlin.blog.mapper;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.Orders;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface OrdersMapper extends BaseMapper<Orders> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.Chlin.blog.mapper;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.User;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface UserMapper extends BaseMapper<User> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
<?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.Chlin.blog.mapper.DepartmentMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?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.Chlin.blog.mapper.DishMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?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.Chlin.blog.mapper.OrdersMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?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.Chlin.blog.mapper.UserMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.Chlin.blog.service;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.Department;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
public interface DepartmentService extends IService<Department> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.Chlin.blog.service;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.Dish;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类的接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
public interface DishService extends IService<Dish> {
|
||||||
|
|
||||||
|
int insertNewDish(Dish dish);
|
||||||
|
|
||||||
|
List<Dish> listByEntity(Dish dish);
|
||||||
|
boolean updateBatchByDishList(List<Dish> dishList);
|
||||||
|
Dish listByEntityID(Dish dish);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.Chlin.blog.service;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.Dish;
|
||||||
|
import com.Chlin.blog.entity.Orders;
|
||||||
|
import com.Chlin.blog.entity.User;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
public interface OrderService extends IService<Orders> {
|
||||||
|
Orders createOrder(User user, Dish dish);
|
||||||
|
|
||||||
|
List<Orders> listByUserStudentId(Integer intger);
|
||||||
|
Orders listByUseridAndDishId(Orders orders);
|
||||||
|
|
||||||
|
void setOrder(Orders order);
|
||||||
|
boolean removeByUseridAndDishId(Integer userid,Integer dishId);
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.Chlin.blog.service;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.User;
|
||||||
|
import com.Chlin.blog.mapper.UserMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
public interface UserService extends IService<User> {
|
||||||
|
boolean login(UserMapper userMapper, User user);
|
||||||
|
int register(UserMapper userMapper,User user);
|
||||||
|
User rememberPassword(HttpServletRequest request,User user);
|
||||||
|
int upUserMassage(UserMapper userMapper,User user);
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.Chlin.blog.service.impl;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.Department;
|
||||||
|
import com.Chlin.blog.mapper.DepartmentMapper;
|
||||||
|
import com.Chlin.blog.service.DepartmentService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Chlin
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
//package com.Chlin.config;
|
||||||
|
//
|
||||||
|
//import com.baomidou.mybatisplus.core.injector.ISqlInjector;
|
||||||
|
//import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||||
|
//import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
//import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
//import org.springframework.context.annotation.Bean;
|
||||||
|
//import org.springframework.context.annotation.Configuration;
|
||||||
|
//import org.springframework.context.annotation.Profile;
|
||||||
|
//import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
//
|
||||||
|
//@MapperScan("com.Chlin.mapper")
|
||||||
|
//@EnableTransactionManagement
|
||||||
|
//@Configuration
|
||||||
|
//public class MyBatisConfig {
|
||||||
|
// //注册乐观锁插件
|
||||||
|
// @Bean
|
||||||
|
// public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor(){
|
||||||
|
// return new OptimisticLockerInnerInterceptor();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //分页插件
|
||||||
|
// @Bean
|
||||||
|
// public PaginationInnerInterceptor paginationInnerInterceptor(){
|
||||||
|
// return new PaginationInnerInterceptor();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //逻辑删除插件
|
||||||
|
//// @Bean
|
||||||
|
//// public ISqlInjector sqlInjector(){
|
||||||
|
//// return new LogicSqlInjector();
|
||||||
|
//// }
|
||||||
|
// //执行效率插件
|
||||||
|
//// @Bean
|
||||||
|
//// @Profile({"dev,test"})
|
||||||
|
//// public
|
||||||
|
//}
|
@ -0,0 +1,116 @@
|
|||||||
|
package com.Chlin;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.Dish;
|
||||||
|
import com.Chlin.blog.entity.Orders;
|
||||||
|
import com.Chlin.blog.entity.User;
|
||||||
|
import com.Chlin.blog.mapper.DishMapper;
|
||||||
|
import com.Chlin.blog.mapper.UserMapper;
|
||||||
|
import com.Chlin.blog.service.OrderService;
|
||||||
|
import com.Chlin.blog.service.impl.DishServiceImpl;
|
||||||
|
import com.Chlin.blog.service.impl.OrderServiceImpl;
|
||||||
|
import com.Chlin.blog.service.impl.UserServiceImpl;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import lombok.val;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class test {
|
||||||
|
@Autowired
|
||||||
|
private UserMapper userMapper;
|
||||||
|
private UserServiceImpl userService=new UserServiceImpl();
|
||||||
|
@Test
|
||||||
|
public void testRegister(){
|
||||||
|
|
||||||
|
User user=new User();
|
||||||
|
user.setId(1110);
|
||||||
|
user.setUsername("xiao");
|
||||||
|
user.setPassword("00000000");
|
||||||
|
user.setRealName("Joh");
|
||||||
|
user.setType(0);
|
||||||
|
user.setStudentId("00000000");
|
||||||
|
user.setEmail("E1234560");
|
||||||
|
user.setPhone(2);
|
||||||
|
user.setGrade(10);
|
||||||
|
user.setBalance(new BigDecimal("1000.00"));
|
||||||
|
user.setRegisterTime(new Date());
|
||||||
|
user.setLastLoginTime(new Date());
|
||||||
|
System.out.println(userService.register(userMapper,user));
|
||||||
|
}
|
||||||
|
@Autowired
|
||||||
|
public DishServiceImpl dishService;
|
||||||
|
@Test
|
||||||
|
public void testDishINsert(){
|
||||||
|
Dish dish=new Dish();
|
||||||
|
dish.setName("酸汤鱼");
|
||||||
|
dish.setInventory(10);
|
||||||
|
dish.setPrice(new BigDecimal(10));
|
||||||
|
dishService.save(dish);
|
||||||
|
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testList(){
|
||||||
|
Dish dish=new Dish();
|
||||||
|
dish.setName("酸汤鱼");
|
||||||
|
dish.setPrice(new BigDecimal(16));
|
||||||
|
// dishService.listByEntity(dish).forEach(System.out::println);
|
||||||
|
dish.setId(1);
|
||||||
|
dishService.updateById(dish);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
OrderService orderService=new OrderServiceImpl();
|
||||||
|
@Test
|
||||||
|
public void testOrder(){
|
||||||
|
|
||||||
|
User user=new User();
|
||||||
|
user.setId(1110);
|
||||||
|
user.setUsername("xiao");
|
||||||
|
user.setPassword("00000000");
|
||||||
|
user.setRealName("Joh");
|
||||||
|
user.setType(0);
|
||||||
|
user.setStudentId("00000000");
|
||||||
|
user.setEmail("E1234560");
|
||||||
|
user.setPhone(2);
|
||||||
|
user.setGrade(10);
|
||||||
|
user.setBalance(new BigDecimal("1000.00"));
|
||||||
|
user.setRegisterTime(new Date());
|
||||||
|
user.setLastLoginTime(new Date());
|
||||||
|
Dish dish=new Dish();
|
||||||
|
dish.setName("酸汤鱼");
|
||||||
|
dish.setPrice(new BigDecimal(16));
|
||||||
|
// dishService.listByEntity(dish).forEach(System.out::println);
|
||||||
|
dish.setId(1);
|
||||||
|
val order = orderService.createOrder(user, dish);
|
||||||
|
order.setId(2);
|
||||||
|
orderService.save(order);
|
||||||
|
// final val dish1 = dishService.listByEntityID(dish);
|
||||||
|
// final val byId = dishService.getById(dish.getId());
|
||||||
|
// System.out.println(byId);
|
||||||
|
// Orders orders=new Orders();
|
||||||
|
// orders.setUserId(2);
|
||||||
|
// orders.setDishId(2);
|
||||||
|
// final val orders1 = orderService.listByUseridAndDishId(orders);
|
||||||
|
// System.out.println(orders1);
|
||||||
|
// orderService.save(order);
|
||||||
|
|
||||||
|
// orderService.listByUserStudentId(1).forEach(System.out::println);
|
||||||
|
// orderService.removeByUseridAndDishId(1,1);
|
||||||
|
|
||||||
|
}
|
||||||
|
Gson gson=new Gson();
|
||||||
|
@Test
|
||||||
|
public void jsonTest(){
|
||||||
|
|
||||||
|
String jsonData="{\"name\":\"rstyj\",\"price\":1111,\"updateTime\":\"2023-08-31 22:31:33\",\"monthlySales\":3,\"inventory\":0}";
|
||||||
|
Dish dish=gson.fromJson(jsonData,Dish.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
//package com;
|
||||||
|
//
|
||||||
|
//import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
|
//import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
//import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||||
|
//
|
||||||
|
//import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
|
||||||
|
//import com.baomidou.mybatisplus.generator.config.GlobalConfig;
|
||||||
|
//
|
||||||
|
//import com.baomidou.mybatisplus.generator.config.PackageConfig;
|
||||||
|
//import com.baomidou.mybatisplus.generator.config.StrategyConfig;
|
||||||
|
//import com.baomidou.mybatisplus.generator.config.po.TableFill;
|
||||||
|
//import com.baomidou.mybatisplus.generator.config.rules.DateType;
|
||||||
|
//import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
|
||||||
|
//import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||||
|
//import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
|
||||||
|
//import lombok.val;
|
||||||
|
//
|
||||||
|
//import java.sql.Types;
|
||||||
|
//import java.util.ArrayList;
|
||||||
|
//import java.util.Collections;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 代码自动生成器
|
||||||
|
// */
|
||||||
|
//public class ClinCode {
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// String property = System.getProperty("user.dir");
|
||||||
|
// property=property+"/src/main/java";
|
||||||
|
//// FastAutoGenerator fastAutoGenerator = FastAutoGenerator.create("url", "username", "password")
|
||||||
|
////
|
||||||
|
//// .globalConfig(builder -> {
|
||||||
|
//// builder.author("Chlin") // 设置作者
|
||||||
|
//// .enableSwagger() // 开启 swagger 模式
|
||||||
|
//// .fileOverride() // 覆盖已生成文件
|
||||||
|
//// .outputDir("D://"); // 指定输出目录
|
||||||
|
//// });
|
||||||
|
//// System.out.println(property);
|
||||||
|
// AutoGenerator autoGenerator = new AutoGenerator();
|
||||||
|
//
|
||||||
|
// //配置策略
|
||||||
|
// //全局配置
|
||||||
|
// GlobalConfig gc=new GlobalConfig();
|
||||||
|
// gc.setAuthor("Chlin");
|
||||||
|
// gc.setOutputDir(property);
|
||||||
|
// gc.setOpen(false);
|
||||||
|
// gc.setFileOverride(false);
|
||||||
|
// gc.setServiceName("%sService");
|
||||||
|
// gc.setDateType(DateType.ONLY_DATE);
|
||||||
|
// gc.setSwagger2(true);
|
||||||
|
//
|
||||||
|
// autoGenerator.setGlobalConfig(gc);
|
||||||
|
//
|
||||||
|
// DataSourceConfig dataSourceConfig=new DataSourceConfig();
|
||||||
|
// dataSourceConfig.setUrl("jdbc:mysql://localhost:3306/meal_card_management?characterEncoding=UTF-8&serverTimezone=UTC");
|
||||||
|
// dataSourceConfig.setUsername("root");
|
||||||
|
// dataSourceConfig.setPassword("2605274496");
|
||||||
|
// dataSourceConfig.setDbType(DbType.MYSQL);
|
||||||
|
// dataSourceConfig.setDriverName("com.mysql.cj.jdbc.Driver");
|
||||||
|
//
|
||||||
|
// autoGenerator.setDataSource(dataSourceConfig);
|
||||||
|
//
|
||||||
|
// //包配置
|
||||||
|
// PackageConfig packageConfig=new PackageConfig();
|
||||||
|
// packageConfig.setModuleName("blog");
|
||||||
|
// packageConfig.setParent("com.Chlin");
|
||||||
|
// packageConfig.setEntity("entity");
|
||||||
|
// packageConfig.setService("service");
|
||||||
|
// packageConfig.setController("controller");
|
||||||
|
// packageConfig.setMapper("mapper");
|
||||||
|
//
|
||||||
|
// autoGenerator.setPackageInfo(packageConfig);
|
||||||
|
//
|
||||||
|
// //策略配置
|
||||||
|
// StrategyConfig strategyConfig=new StrategyConfig();
|
||||||
|
// strategyConfig.setInclude("department","dish","order","user");//要映射的表名
|
||||||
|
// strategyConfig.setNaming(NamingStrategy.underline_to_camel);
|
||||||
|
// strategyConfig.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||||
|
// strategyConfig.setEntityBuilderModel(true);
|
||||||
|
// strategyConfig.setLogicDeleteFieldName("deleted");
|
||||||
|
//
|
||||||
|
// //自动填充配置
|
||||||
|
// TableFill gmtCreate=new TableFill("gmt_create", FieldFill.INSERT);
|
||||||
|
// TableFill gmtModified=new TableFill("gmt_modified",FieldFill.INSERT_UPDATE);
|
||||||
|
// ArrayList<TableFill> tableFills=new ArrayList<>();
|
||||||
|
// tableFills.add(gmtCreate);
|
||||||
|
// tableFills.add(gmtModified);
|
||||||
|
// strategyConfig.setTableFillList(tableFills);
|
||||||
|
//
|
||||||
|
// strategyConfig.setVersionFieldName("version");
|
||||||
|
// strategyConfig.setRestControllerStyle(true);
|
||||||
|
// strategyConfig.setControllerMappingHyphenStyle(true);
|
||||||
|
//
|
||||||
|
// autoGenerator.setStrategy(strategyConfig);
|
||||||
|
//
|
||||||
|
// autoGenerator.execute();
|
||||||
|
// }
|
||||||
|
//}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com;
|
||||||
|
|
||||||
|
import com.Chlin.blog.entity.User;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用来测试一些工具
|
||||||
|
*/
|
||||||
|
public class testMain {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
User user=new User();
|
||||||
|
user.setPassword("12345");
|
||||||
|
user.setEmail("derthyj");
|
||||||
|
user.setId(10);
|
||||||
|
User user1=new User();
|
||||||
|
user1.setId(1);
|
||||||
|
user1.setPassword("12345");
|
||||||
|
user1.setEmail("cfyasgu");
|
||||||
|
try {
|
||||||
|
System.out.println((copyChangedFields(user,user1).toString()));
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static Object copyChangedFields(Object source, Object target) throws IllegalAccessException {
|
||||||
|
|
||||||
|
Class<?> sourceClass = source.getClass();
|
||||||
|
Class<?> targetClass = target.getClass();
|
||||||
|
|
||||||
|
// 两个对象类类型必须相同
|
||||||
|
if (!sourceClass.equals(targetClass)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object copiedTarget = null;
|
||||||
|
try {
|
||||||
|
copiedTarget = targetClass.newInstance();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 如果目标对象无法实例化,直接返回
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Field[] fields = sourceClass.getDeclaredFields();
|
||||||
|
|
||||||
|
fields = Arrays.stream(fields)
|
||||||
|
.filter(f -> !Modifier.isStatic(f.getModifiers()) || !Modifier.isFinal(f.getModifiers()))
|
||||||
|
.toArray(Field[]::new);
|
||||||
|
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
// 获取源对象和目标对象的字段值
|
||||||
|
Object sourceValue = field.get(source);
|
||||||
|
Object targetValue = field.get(target);
|
||||||
|
|
||||||
|
// 比较两个值
|
||||||
|
if (!Objects.equals(sourceValue, targetValue)) {
|
||||||
|
|
||||||
|
// 设置不同的值到复制的目标对象
|
||||||
|
field.set(copiedTarget, targetValue);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// 相同的值也需要设置到复制的目标对象
|
||||||
|
field.set(copiedTarget, targetValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return copiedTarget;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
server:
|
||||||
|
port: 90
|
||||||
|
#spring.profiles.active=dev
|
||||||
|
spring.datasource.username: root
|
||||||
|
spring.datasource.password: 2605274496
|
||||||
|
spring.datasource.url: jdbc:mysql://localhost:3306/meal_card_management?characterEncoding=UTF-8&serverTimezone=UTC
|
||||||
|
spring.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
|
#日志
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
configuration:
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
global-config:
|
||||||
|
db-config:
|
||||||
|
logic-delete-value: 1
|
||||||
|
logic-not-delete-value: 0
|
||||||
|
#图标
|
||||||
|
# spring.mvc.favicon.enabled=false
|
||||||
|
# spring.web.resources.static-locations=classpath:/static/
|
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
hello world
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
ergrtehtryjuy
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,229 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
<script src="axios.js"></script>
|
||||||
|
<script src="vue.js"></script>
|
||||||
|
<script src="index.js"></script>
|
||||||
|
<link rel="stylesheet" href="index.css">
|
||||||
|
<style>
|
||||||
|
.el-header, .el-footer {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-aside {
|
||||||
|
background-color:#F2F6FC;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 650px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-main {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
color: #FFFFFF;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 10px;
|
||||||
|
}
|
||||||
|
.articleName{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
/*.articleShow{*/
|
||||||
|
|
||||||
|
/* margin:auto;*/
|
||||||
|
/* !*height: 600px;*!*/
|
||||||
|
/* width: 800px;*/
|
||||||
|
/* !*text-align:center;*!*/
|
||||||
|
/* background-color:#FFFFFF;*/
|
||||||
|
/* border-radius: 20px;*/
|
||||||
|
/* position: absolute;*/
|
||||||
|
/* top: 1px;*/
|
||||||
|
/* left: 0;*/
|
||||||
|
/* right: 0;*/
|
||||||
|
/* bottom: 0;*/
|
||||||
|
/* white-space:pre-wrap;*/
|
||||||
|
|
||||||
|
/*}*/
|
||||||
|
#text{
|
||||||
|
overflow:hidden;
|
||||||
|
background: #ffffff;
|
||||||
|
width:800px;
|
||||||
|
font-family: "Helvetica Neue";
|
||||||
|
line-height:1.5;
|
||||||
|
font-size: 20px;
|
||||||
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
#author{
|
||||||
|
margin-left: 900px;
|
||||||
|
}
|
||||||
|
#date{
|
||||||
|
margin-left: 900px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
|
||||||
|
<!-- <el-container>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- </el-container>-->
|
||||||
|
|
||||||
|
<el-page-header @back="goBack" content="阅读">
|
||||||
|
</el-page-header>
|
||||||
|
<el-container>
|
||||||
|
<template>
|
||||||
|
<el-header v-model="re.articleName">{{re.articleName}}</el-header>
|
||||||
|
|
||||||
|
<span id="author" v-model="re.authorName">作者:{{re.authorName}}</span>
|
||||||
|
<span id="date">录入时间:{{re.date}}</span>
|
||||||
|
|
||||||
|
<el-main >
|
||||||
|
<textarea id="text"
|
||||||
|
:rows="30"
|
||||||
|
cols="50"
|
||||||
|
disabled
|
||||||
|
v-model="re.article" >
|
||||||
|
</textarea>
|
||||||
|
<!-- {{re.article}}-->
|
||||||
|
</el-main>
|
||||||
|
<!-- <el-empty > -->
|
||||||
|
<!-- </el-empty>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
</template>
|
||||||
|
<el-footer>
|
||||||
|
<el-button style="margin-top: 12px; margin-left: 10px" @click="last">上一篇</el-button>
|
||||||
|
<el-button style="margin-top: 12px; margin-left: 10px" @click="back">{{updata?'保存':'修改'}}</el-button>
|
||||||
|
<!-- <el-button style="margin-top: 12px; margin-right: 10px" @click="back">保存</el-button>-->
|
||||||
|
<el-button id="concern" @click="concern">{{shou?'取消收藏':'收藏'}}</el-button>
|
||||||
|
<el-button style="margin-top: 12px; margin-right: 10px" @click="next">下一篇</el-button>
|
||||||
|
</el-footer>
|
||||||
|
</el-container>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var reads;
|
||||||
|
new Vue({
|
||||||
|
el:"#app",
|
||||||
|
data() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
shou:false,
|
||||||
|
updata:false,
|
||||||
|
activeIndex: '3',
|
||||||
|
re:{
|
||||||
|
articleName: '',
|
||||||
|
article: '',
|
||||||
|
authorName: '',
|
||||||
|
date:'',
|
||||||
|
concern:false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
var _this=this
|
||||||
|
window.onload=function(){
|
||||||
|
// document.getElementById("text")
|
||||||
|
axios.post("http://localhost:90/myArticle_war/reads").then(function (resp) {
|
||||||
|
var da=resp.data;
|
||||||
|
da.date=timestampToTime(resp.data.date)
|
||||||
|
_this.re=da;
|
||||||
|
if(_this.re.concern){
|
||||||
|
_this.shou=!_this.shou;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
goBack() {
|
||||||
|
window.location.href='FirstPage.html'
|
||||||
|
},
|
||||||
|
next(){
|
||||||
|
alert(this.re.article)
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
back(){
|
||||||
|
var up=document.getElementById("text");
|
||||||
|
var c=document.getElementById("text");
|
||||||
|
this.updata=!this.updata;
|
||||||
|
if(this.updata){
|
||||||
|
up.removeAttribute("disabled");
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
|
||||||
|
c.setAttribute("disabled","disabled")
|
||||||
|
axios.post("http://localhost:90/myArticle_war/revise",this.re).then(function (resp) {
|
||||||
|
var ans=resp.data
|
||||||
|
if(ans.an){
|
||||||
|
alert("修改成功");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
alert("修改失败");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}},
|
||||||
|
concern(){
|
||||||
|
var _this=this;
|
||||||
|
var as={
|
||||||
|
articleName: _this.re.articleName,
|
||||||
|
article: _this.re.article,
|
||||||
|
authorName: _this.re.authorName,
|
||||||
|
date:_this.re.date,
|
||||||
|
}
|
||||||
|
if(this.shou)
|
||||||
|
{
|
||||||
|
axios.post("http://localhost:90/myArticle_war/celConcern",as).then(function (resp){
|
||||||
|
var ans1=resp.data;
|
||||||
|
if(ans1.value2)
|
||||||
|
{
|
||||||
|
_this.shou=!_this.shou
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}else {
|
||||||
|
axios.post("http://localhost:90/myArticle_war/celConcern",as).then(function (resp){
|
||||||
|
var ans=resp.data;
|
||||||
|
if(ans.value1)
|
||||||
|
{
|
||||||
|
alert("收藏成功")
|
||||||
|
_this.shou=!_this.shou
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
alert("收藏失败,不能收藏自己的作品")
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
function timestampToTime(timestamp) {
|
||||||
|
var date = new Date(timestamp);
|
||||||
|
var Y = date.getFullYear() + '-';
|
||||||
|
var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1):date.getMonth()+1) + '-';
|
||||||
|
var D = (date.getDate()< 10 ? '0'+date.getDate():date.getDate())+ ' ';
|
||||||
|
var h = (date.getHours() < 10 ? '0'+date.getHours():date.getHours())+ ':';
|
||||||
|
var m = (date.getMinutes() < 10 ? '0'+date.getMinutes():date.getMinutes()) + ':';
|
||||||
|
var s = date.getSeconds() < 10 ? '0'+date.getSeconds():date.getSeconds();
|
||||||
|
return Y+M+D+h+m+s;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,298 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>concern</title>
|
||||||
|
<script src="axios.js"></script>
|
||||||
|
<script src="vue.js"></script>
|
||||||
|
<script src="index.js"></script>
|
||||||
|
<link rel="stylesheet" href="index.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<el-page-header @back="back" content="">
|
||||||
|
</el-page-header>
|
||||||
|
<el-tabs type="border-card" v-model="ins" @tab-click="loadPage">
|
||||||
|
<el-tab-pane label="个人页面" name="first">
|
||||||
|
<template>
|
||||||
|
<div class="demo-type">
|
||||||
|
<el-avatar :size="150" src="" @error="errorHandler">
|
||||||
|
<img src=""/>
|
||||||
|
</el-avatar>
|
||||||
|
</div>
|
||||||
|
<el-skeleton :rows="3" animated />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-descriptions class="margin-top" title="" :column="10" >
|
||||||
|
<template slot="extra">
|
||||||
|
<el-button type="primary" size="small" v-model="but" @click="Concerns">{{but?'取消关注':'关注'}}</el-button>
|
||||||
|
</template>
|
||||||
|
<el-descriptions-item label="用户名" v-model="his.username">{{his.username}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="id" v-model="his.id">{{his.id}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="居住地"></el-descriptions-item>
|
||||||
|
<el-descriptions-item label="个性签名" v-model="his.signature">
|
||||||
|
<el-tag size="small">{{his.signature}}</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<!-- <el-descriptions-item label="注册时间">date</el-descriptions-item>-->
|
||||||
|
</el-descriptions>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-collapse v-model="activeNames" @change="handleChange" accordion>
|
||||||
|
<el-collapse-item title="它的文章" name="1" >
|
||||||
|
<template >
|
||||||
|
<el-table
|
||||||
|
:data="hisArticle"
|
||||||
|
style="width: 100%"
|
||||||
|
:default-sort = "{prop: 'date', order: 'descending'}"
|
||||||
|
:data="tableData"
|
||||||
|
tooltip-effect="dark"
|
||||||
|
style="width: 100%"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
@cell-click="readArticles"
|
||||||
|
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
type="index"
|
||||||
|
width="50">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="articleName"
|
||||||
|
label="作品名称"
|
||||||
|
sortable
|
||||||
|
align="center"
|
||||||
|
width="180">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="date"
|
||||||
|
label="发布时间"
|
||||||
|
align="center"
|
||||||
|
sortable
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" @click.native.prevent="downloads(scope.row)">下载</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
</el-collapse-item>
|
||||||
|
<el-collapse-item title="收藏" name="2">
|
||||||
|
<template >
|
||||||
|
<el-table
|
||||||
|
:data="hisConcern"
|
||||||
|
style="width: 100%"
|
||||||
|
:default-sort = "{prop: 'date', order: 'descending'}"
|
||||||
|
:data="tableData"
|
||||||
|
tooltip-effect="dark"
|
||||||
|
style="width: 100%"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
@cell-click="readArticles"
|
||||||
|
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
type="index"
|
||||||
|
width="50">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="articleName"
|
||||||
|
label="作品名称"
|
||||||
|
sortable
|
||||||
|
align="center"
|
||||||
|
width="180">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="date"
|
||||||
|
label="发布时间"
|
||||||
|
align="center"
|
||||||
|
sortable
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="authorName"
|
||||||
|
label="作者"
|
||||||
|
align="center"
|
||||||
|
sortable
|
||||||
|
width="180">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" @click.native.prevent="downloads(scope.row)">下载</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
</el-collapse-item>
|
||||||
|
<el-collapse-item title="关注" name="3">
|
||||||
|
<div>简化流程:设计简洁直观的操作流程;</div>
|
||||||
|
<div>清晰明确:语言表达清晰且表意明确,让用户快速理解进而作出决策;</div>
|
||||||
|
<div>帮助用户识别:界面简单直白,让用户快速识别而非回忆,减少用户记忆负担。</div>
|
||||||
|
</el-collapse-item>
|
||||||
|
<el-collapse-item title="浏览记录" name="4">
|
||||||
|
<template >
|
||||||
|
<el-table
|
||||||
|
:data="BrowsingRecords"
|
||||||
|
style="width: 100%"
|
||||||
|
:default-sort = "{prop: 'date', order: 'descending'}"
|
||||||
|
ref="multipleTable"
|
||||||
|
:data="tableData"
|
||||||
|
tooltip-effect="dark"
|
||||||
|
style="width: 100%"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
@cell-click="readArticles"
|
||||||
|
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
prop="articleName"
|
||||||
|
label="作品名称"
|
||||||
|
sortable
|
||||||
|
align="center"
|
||||||
|
width="180">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="authorName"
|
||||||
|
label="作者"
|
||||||
|
align="center"
|
||||||
|
sortable
|
||||||
|
width="180">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="date"
|
||||||
|
label="发布时间"
|
||||||
|
align="center"
|
||||||
|
sortable
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<el-button size="mini">下载</el-button>
|
||||||
|
|
||||||
|
<!-- @click="concern"-->
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
</el-collapse-item>
|
||||||
|
<el-collapse-item title="管理账号" name="5">
|
||||||
|
<div>用户决策:根据场景可给予用户操作建议或安全提示,但不能代替用户进行决策;</div>
|
||||||
|
<div>结果可控:用户可以自由的进行操作,包括撤销、回退和终止当前操作等。</div>
|
||||||
|
</el-collapse-item>
|
||||||
|
<el-collapse-item title="修改资料卡片" >
|
||||||
|
<div>用户决策:根据场景可给予用户操作建议或安全提示,但不能代替用户进行决策;</div>
|
||||||
|
<div>结果可控:用户可以自由的进行操作,包括撤销、回退和终止当前操作等。</div>
|
||||||
|
</el-collapse-item>
|
||||||
|
</el-collapse>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
new Vue({
|
||||||
|
el:"#app",
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
but:false,
|
||||||
|
ins:'first',
|
||||||
|
activeNames:['1'],
|
||||||
|
/**
|
||||||
|
*wd
|
||||||
|
*/
|
||||||
|
his:{
|
||||||
|
username:'',
|
||||||
|
id:'',
|
||||||
|
signature:'',
|
||||||
|
co:false
|
||||||
|
},
|
||||||
|
hisArticle:[{
|
||||||
|
articleName:'0',
|
||||||
|
authorName: '1',
|
||||||
|
date: '2',
|
||||||
|
article:'3'
|
||||||
|
},],
|
||||||
|
hisConcern:[{
|
||||||
|
articleName:'xsui',
|
||||||
|
authorName: 'dsoih',
|
||||||
|
date: 'skjbc',
|
||||||
|
article:'3'
|
||||||
|
},],
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
,
|
||||||
|
mounted(){
|
||||||
|
var _this=this;
|
||||||
|
window.onload=function (){
|
||||||
|
axios.post("http://localhost:90/myArticle_war/loadCencorn1").then(function (resp) {
|
||||||
|
var m=resp.data;
|
||||||
|
_this.his.id = m.id;
|
||||||
|
_this.his.username = m.username;
|
||||||
|
_this.his.signature = m.signature;
|
||||||
|
_this.his.co=m.concern;
|
||||||
|
if(_this.his.co){
|
||||||
|
_this.but = !_this.but
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
back() {
|
||||||
|
window.location.href = 'FirstPage.html'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
cancelConcern(row) {
|
||||||
|
var c = {
|
||||||
|
articleName: row.articleName,
|
||||||
|
authorName: row.authorName,
|
||||||
|
article: row.article,
|
||||||
|
date: row.date
|
||||||
|
}
|
||||||
|
axios.post("http://localhost:90/myArticle_war/celConcern", c).then(function (resp) {
|
||||||
|
var a = resp.data;
|
||||||
|
if (a.value2) {
|
||||||
|
alert("取消成功")
|
||||||
|
} else {
|
||||||
|
alert("取消失败")
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
|
Concerns() {
|
||||||
|
var _this = this;
|
||||||
|
var as = this.his;
|
||||||
|
if (this.but) {
|
||||||
|
axios.post("http://localhost:90/myArticle_war/concerns1", as).then(function (resp) {
|
||||||
|
var ans1 = resp.data;
|
||||||
|
if (ans1.value2) {
|
||||||
|
_this.but = !_this.but
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
axios.post("http://localhost:90/myArticle_war/concerns1", as).then(function (resp) {
|
||||||
|
var ans = resp.data;
|
||||||
|
if (ans.value1) {
|
||||||
|
alert("关注成功")
|
||||||
|
_this.but = !_this.but
|
||||||
|
} else {
|
||||||
|
alert("关注失败")
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
After Width: | Height: | Size: 163 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,195 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
<script src="axios.js"></script>
|
||||||
|
<script src="vue.js"></script>
|
||||||
|
<script src="index.js"></script>
|
||||||
|
<link rel="stylesheet" href="index.css">
|
||||||
|
<style>
|
||||||
|
.backgrounds{
|
||||||
|
margin:auto;
|
||||||
|
height: 50px;
|
||||||
|
width: 300px;
|
||||||
|
/*text-align:center;*/
|
||||||
|
background-color:#fff;
|
||||||
|
border-radius: 20px;
|
||||||
|
position: absolute;
|
||||||
|
top: 1px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
.err_msg{
|
||||||
|
color: red;
|
||||||
|
border: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="backgrounds">
|
||||||
|
<div id="app">
|
||||||
|
<el-form :label-position="labelPosition" label-width="80px" :model="user" >
|
||||||
|
<el-form-item label="账号:">
|
||||||
|
<el-input v-model="user.id" id="ids"></el-input>
|
||||||
|
<span id="username_err" class="err_msg" style="display:none" >账号错误</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="密码:">
|
||||||
|
<el-input v-model="user.password" type="password" id="password"></el-input>
|
||||||
|
<span id="password_err" class="err_msg" style="display: none"> 密码格式不对</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr div style="margin-left: 20px">
|
||||||
|
<td>
|
||||||
|
<el-switch
|
||||||
|
v-model="user.value1"
|
||||||
|
active-text="记住密码"
|
||||||
|
@change="remember"
|
||||||
|
>
|
||||||
|
</el-switch>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><el-button type="primary" round @click="login()">登录</el-button></td>
|
||||||
|
<td><el-button type="primary" round @click="register">注册</el-button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var ans=true;
|
||||||
|
var ans1=true;
|
||||||
|
// window.onload=function(){
|
||||||
|
// axios.post("http://localhost:90/Demo/cookies",this.user.value1).then(function(resp){
|
||||||
|
// alert(resp.data())
|
||||||
|
//
|
||||||
|
// })
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
axios.defaults.withCredentials=true;
|
||||||
|
new Vue({
|
||||||
|
el:"#app",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
labelPosition: 'left',
|
||||||
|
user: {
|
||||||
|
id: '',
|
||||||
|
password: '',
|
||||||
|
value1:true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
var _this=this;
|
||||||
|
window.onload=function () {
|
||||||
|
alert("你好")
|
||||||
|
if (_this.user.value1) {
|
||||||
|
axios.post("http://localhost:90/blog/user/loadLogin").then(function (resp) {
|
||||||
|
var a1 = resp.data;
|
||||||
|
_this.user.id=a1.studentId;
|
||||||
|
_this.user.password=a1.password;
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var idInput= document.getElementById("ids");
|
||||||
|
idInput.onblur=function (){
|
||||||
|
var id=idInput.value.trim();
|
||||||
|
if(id==='')
|
||||||
|
{
|
||||||
|
document.getElementById("username_err").style.display='';
|
||||||
|
ans=false;
|
||||||
|
}
|
||||||
|
else if(id.length<8||id.length>12)
|
||||||
|
{
|
||||||
|
ans=false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
document.getElementById("username_err").style.display='none';
|
||||||
|
ans=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
var passwordInput =document.getElementById("password");
|
||||||
|
passwordInput.onblur=function ()
|
||||||
|
{
|
||||||
|
var password=passwordInput.value.trim();
|
||||||
|
|
||||||
|
if(password.length>=8&&password.length<=16)
|
||||||
|
{
|
||||||
|
document.getElementById("password_err").style.display='none';
|
||||||
|
ans1=true;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
document.getElementById("password_err").style.display='';
|
||||||
|
ans1=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
login() {
|
||||||
|
var users={
|
||||||
|
studentId:this.user.id,
|
||||||
|
password: this.user.password,
|
||||||
|
rememberPassword :this.user.value1
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ans&&ans1){
|
||||||
|
axios.post("http://localhost:90/blog/user/login",users).then(function (resp) {
|
||||||
|
if (resp.status === 200) {
|
||||||
|
// 操作成功的逻辑
|
||||||
|
window.location.href='FirstPage.html'
|
||||||
|
// 执行其他操作,如跳转页面或刷新数据
|
||||||
|
} else {
|
||||||
|
// 操作失败的逻辑
|
||||||
|
alert("登录失败,你可能没有注册该账户");
|
||||||
|
// 执行其他操作,如显示错误信息或重新尝试操作
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
// 处理请求错误的逻辑
|
||||||
|
console.log(error);
|
||||||
|
alert("请求出错");
|
||||||
|
// 执行其他操作,如显示错误信息或重新尝试操作
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
register(){
|
||||||
|
window.location.href='register.html'
|
||||||
|
}
|
||||||
|
,remember(){
|
||||||
|
var _this=this;
|
||||||
|
var studentid={
|
||||||
|
studentId:this.user.id
|
||||||
|
}
|
||||||
|
var values={
|
||||||
|
value1:this.user.value1
|
||||||
|
}
|
||||||
|
if(this.user.value1)
|
||||||
|
{
|
||||||
|
axios.post("http://localhost:90/blog/user/remember",studentid).then(function (resp) {
|
||||||
|
var a1 = resp.data;
|
||||||
|
_this.user.id=a1.studentId;
|
||||||
|
_this.user.password=a1.password;
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// _this.user.id='';
|
||||||
|
_this.user.password='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>>
|
@ -0,0 +1,163 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
<script src="axios.js"></script>
|
||||||
|
<script src="vue.js"></script>
|
||||||
|
<script src="index.js"></script>
|
||||||
|
<link rel="stylesheet" href="index.css">
|
||||||
|
<style>
|
||||||
|
.backgrounds{
|
||||||
|
margin:auto;
|
||||||
|
height: 50px;
|
||||||
|
width: 300px;
|
||||||
|
/*text-align:center;*/
|
||||||
|
background-color:#fff;
|
||||||
|
border-radius: 20px;
|
||||||
|
position: absolute;
|
||||||
|
top: 1px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
.err_msg{
|
||||||
|
color: red;
|
||||||
|
border: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="backgrounds">
|
||||||
|
<div id="app">
|
||||||
|
<el-form :label-position="labelPosition" label-width="80px" :model="user" >
|
||||||
|
<el-form-item label="名字:">
|
||||||
|
<el-input v-model="user.username"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="学工号:">
|
||||||
|
<el-input v-model="user.id" id="ids"></el-input>
|
||||||
|
<span id="username_err" class="err_msg" style="display:none" >账号格式错误</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="密码:">
|
||||||
|
<el-input v-model="user.password" type="password" id="password"></el-input>
|
||||||
|
<span id="password_err" class="err_msg" style="display: none"> 密码格式不对</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="确认密码:">
|
||||||
|
<el-input v-model="user.passwords" type="password" id="passwords"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<el-button type="primary" round @click="register">注册</el-button>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<el-button type="primary" round @click="goBackLogin">返回登录</el-button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var ans=false;
|
||||||
|
var ans1=false;
|
||||||
|
// window.onload=function(){
|
||||||
|
// axios.post("http://localhost:90/Demo/cookies",this.user.value1).then(function(resp){
|
||||||
|
// alert(resp.data())
|
||||||
|
//
|
||||||
|
// })
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
new Vue({
|
||||||
|
el:"#app",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
labelPosition: 'left',
|
||||||
|
user: {
|
||||||
|
username:'',
|
||||||
|
id: '',
|
||||||
|
password: '',
|
||||||
|
passwords: '',
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
var idInput= document.getElementById("ids");
|
||||||
|
idInput.onblur=function (){
|
||||||
|
var id=idInput.value.trim();
|
||||||
|
if(id==='')
|
||||||
|
{
|
||||||
|
document.getElementById("username_err").style.display='';
|
||||||
|
ans=false;
|
||||||
|
}
|
||||||
|
else if(id.length<8||id.length>12)
|
||||||
|
{
|
||||||
|
ans=false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
document.getElementById("username_err").style.display='none';
|
||||||
|
ans=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
var passwordInput =document.getElementById("password");
|
||||||
|
passwordInput.onblur=function ()
|
||||||
|
{
|
||||||
|
var password=passwordInput.value.trim();
|
||||||
|
|
||||||
|
if(password.length>=8&&password.length<=16)
|
||||||
|
{
|
||||||
|
document.getElementById("password_err").style.display='none';
|
||||||
|
ans1=true;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
document.getElementById("password_err").style.display='';
|
||||||
|
ans1=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
register() {
|
||||||
|
_this=this
|
||||||
|
if(this.user.password===this.user.passwords){
|
||||||
|
|
||||||
|
var registerUser={
|
||||||
|
username:_this.user.username,
|
||||||
|
studentId:_this.user.id,
|
||||||
|
password:_this.user.password
|
||||||
|
}
|
||||||
|
if((ans&&ans1)){
|
||||||
|
axios.post("http://localhost:90/blog/user/register",registerUser).then(function (resp) {
|
||||||
|
var ans=resp.data;
|
||||||
|
if(ans.value4){
|
||||||
|
alert("注册成功,请登录")
|
||||||
|
window.location.href='login.html';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
alert("注册失败")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
alert("错误")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alert("两次密码不一致")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
goBackLogin(){
|
||||||
|
window.location.href='login.html'
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,240 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
<script src="axios.js"></script>
|
||||||
|
<script src="vue.js"></script>
|
||||||
|
<script src="index.js"></script>
|
||||||
|
<link rel="stylesheet" href="index.css">
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<!-- <el-tabs type="border-card" @tab-click="run" v-model="as">-->
|
||||||
|
<!-- <el-tab-pane >-->
|
||||||
|
<!-- <span slot="label" v-model="" ><i class="el-icon-date"></i> 我的行程</span>-->
|
||||||
|
<!-- 我的行程-->
|
||||||
|
<!-- </el-tab-pane>-->
|
||||||
|
<!-- <el-tab-pane label="消息中心">消息中心</el-tab-pane>-->
|
||||||
|
<!-- <el-tab-pane label="角色管理">角色管理</el-tab-pane>-->
|
||||||
|
<!-- <el-tab-pane label="定时任务补偿">定时任务补偿</el-tab-pane>-->
|
||||||
|
<!-- </el-tabs>-->
|
||||||
|
<!-- <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" >-->
|
||||||
|
<!-- <el-menu-item index="1" @click="run1()" >首页</el-menu-item>-->
|
||||||
|
<!-- <el-menu-item index="2" @click="run2()" >个人中心</el-menu-item>-->
|
||||||
|
<!-- <el-menu-item index="3" @click="run3()" >文章</el-menu-item>-->
|
||||||
|
<!-- <el-menu-item index="4" @click="run4()" >订单管理</el-menu-item>-->
|
||||||
|
<!-- <el-menu-item index="5" @click="run4()" >-->
|
||||||
|
<!-- <el-input v-model="input" placeholder="请输入内容">-->
|
||||||
|
<!-- </el-input>-->
|
||||||
|
<!-- <el-button round>搜索</el-button>-->
|
||||||
|
<!-- </el-menu-item>-->
|
||||||
|
|
||||||
|
<!-- </el-menu>-->
|
||||||
|
<!-- <el-container>-->
|
||||||
|
<!-- <el-container>-->
|
||||||
|
<!-- <el-aside width="200px">Aside</el-aside>-->
|
||||||
|
<!-- <el-main>-->
|
||||||
|
<!--<!– 按钮列表 –>-->
|
||||||
|
<!-- <template>-->
|
||||||
|
<!-- <el-button type="warning" type="text" @click="BulkDeletion">批量删除</el-button>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- <el-button type="primary" @click="dialogFormVisible = true" round >新增</el-button>-->
|
||||||
|
<!--<!– 弹出框–>-->
|
||||||
|
<!-- <el-dialog title="" :visible.sync="dialogFormVisible">-->
|
||||||
|
<!-- <el-container>-->
|
||||||
|
<!-- <el-header align="center">-->
|
||||||
|
<!-- <el-input v-model="newArticleName" placeholder="请输入标题" ></el-input>-->
|
||||||
|
<!-- </el-header>-->
|
||||||
|
<!-- <el-main>-->
|
||||||
|
<!-- 正文:-->
|
||||||
|
<!-- <el-input-->
|
||||||
|
<!-- type="textarea"-->
|
||||||
|
<!-- placeholder="请输入内容"-->
|
||||||
|
<!-- :rows="20"-->
|
||||||
|
<!-- v-model="newArticle"-->
|
||||||
|
<!-- placeholder=" ">-->
|
||||||
|
<!-- </el-input>-->
|
||||||
|
<!-- </el-main>-->
|
||||||
|
<!-- <el-footer align="right">-->
|
||||||
|
<!-- <el-button type="primary" round >确认发布</el-button>-->
|
||||||
|
<!-- </el-footer>-->
|
||||||
|
<!-- </el-container>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- </el-dialog>-->
|
||||||
|
|
||||||
|
<!--<!– 作品列表 –>-->
|
||||||
|
|
||||||
|
|
||||||
|
<template >
|
||||||
|
<el-table @row-click="run"
|
||||||
|
:data="tableData"
|
||||||
|
style="width: 100%"
|
||||||
|
:default-sort = "{prop: 'date', order: 'descending'}"
|
||||||
|
ref="multipleTable"
|
||||||
|
:data="tableData"
|
||||||
|
tooltip-effect="dark"
|
||||||
|
style="width: 100%"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
type="selection"
|
||||||
|
width="55" >
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column @cell-click="run"
|
||||||
|
prop="articleName"
|
||||||
|
label="作品名称"
|
||||||
|
sortable
|
||||||
|
align="center"
|
||||||
|
width="180">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="authorName"
|
||||||
|
label="作者"
|
||||||
|
align="center"
|
||||||
|
sortable
|
||||||
|
width="180">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="date"
|
||||||
|
label="发布时间"
|
||||||
|
align="center"
|
||||||
|
:formatter="formatter">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<el-button size="mini">收藏</el-button>
|
||||||
|
<el-button size="mini" >删除</el-button>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</el-container>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
new Vue({
|
||||||
|
|
||||||
|
el:"#app",
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
as:['1'],
|
||||||
|
activeIndex: '3',
|
||||||
|
input:'',
|
||||||
|
multipleSelection: [],
|
||||||
|
tableData: [{
|
||||||
|
articleName:'百年',
|
||||||
|
authorName: '王小虎',
|
||||||
|
date: '2016-05-02'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
articleName:'百年',
|
||||||
|
authorName: '王小虎',
|
||||||
|
date: '2016-05-02'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
articleName:'百年',
|
||||||
|
authorName: '王小虎',
|
||||||
|
date: '2016-05-02'
|
||||||
|
},
|
||||||
|
|
||||||
|
],
|
||||||
|
dialogFormVisible: false,
|
||||||
|
newArticleName:'',
|
||||||
|
newArticle:''
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
handleSelect(key, keyPath){
|
||||||
|
console.log(key, keyPath);
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
this.multipleSelection = val;
|
||||||
|
console.log(this.multipleSelection)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
Deletion(){
|
||||||
|
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
BulkDeletion() {
|
||||||
|
if (this.multipleSelection.length !== 0) {
|
||||||
|
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$message({
|
||||||
|
/**
|
||||||
|
* 确认后操作
|
||||||
|
*/
|
||||||
|
type: 'success',
|
||||||
|
message: '删除成功!'
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消删除'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message(
|
||||||
|
{
|
||||||
|
type:'info',
|
||||||
|
message:'还没有选中'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
,
|
||||||
|
/**
|
||||||
|
* 跳转
|
||||||
|
*/
|
||||||
|
run(){
|
||||||
|
alert(this.as)
|
||||||
|
var a=this.as;
|
||||||
|
if(a==1)
|
||||||
|
{
|
||||||
|
alert("5");
|
||||||
|
}
|
||||||
|
if(a==2)
|
||||||
|
{
|
||||||
|
alert("dsuh")
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
run2(){
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
run3(){
|
||||||
|
|
||||||
|
},
|
||||||
|
run4(){
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>ml>
|
@ -0,0 +1,60 @@
|
|||||||
|
//package com;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//import org.junit.Test;
|
||||||
|
//import org.junit.runner.RunWith;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
//import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
//
|
||||||
|
//import java.util.Date;
|
||||||
|
//import java.util.List;
|
||||||
|
//@RunWith(SpringRunner.class)
|
||||||
|
//@SpringBootTest
|
||||||
|
//public class demo {
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private UserMapper userMapper;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
////查
|
||||||
|
// @Test
|
||||||
|
// public void di(){
|
||||||
|
// System.out.println("get");
|
||||||
|
// List<User> users = userMapper.selectList(null);
|
||||||
|
// users.forEach(System.out::println);
|
||||||
|
// System.out.println("kkk");
|
||||||
|
// }
|
||||||
|
// //插入
|
||||||
|
// @Test
|
||||||
|
// public void testInsert()
|
||||||
|
// {
|
||||||
|
// User user=new User();
|
||||||
|
// user.setUserid(12);
|
||||||
|
// user.setUsername("xiaoming");
|
||||||
|
// user.setPassword("123456789");
|
||||||
|
// user.setName("xiao");
|
||||||
|
// user.setEmail("2605527@qq.com");
|
||||||
|
// user.setRegistrationdate(new Date());
|
||||||
|
// int result=userMapper.insert(user);
|
||||||
|
// System.out.println(result);
|
||||||
|
// System.out.println(user);
|
||||||
|
// }
|
||||||
|
// //更新
|
||||||
|
// @Test
|
||||||
|
// public void updata(){
|
||||||
|
// User user=new User();
|
||||||
|
// user.setUserid(123456);
|
||||||
|
// user.setPassword("18224978448");
|
||||||
|
// user.setPhone("110");
|
||||||
|
// int i=userMapper.updateById(user);
|
||||||
|
// System.out.println(i);
|
||||||
|
// }
|
||||||
|
// @Test
|
||||||
|
// public void dete(){
|
||||||
|
// User user=new User();
|
||||||
|
// user.setUserid(1234567);
|
||||||
|
// userMapper.deleteById(user);
|
||||||
|
// }
|
||||||
|
//}
|
Binary file not shown.
Loading…
Reference in new issue