parent
1921e6a122
commit
7e7f66af9c
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<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="sxdx01" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,356 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ArtifactsWorkspaceSettings">
|
||||
<artifacts-to-build>
|
||||
<artifact name="sxdx01:war" />
|
||||
</artifacts-to-build>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="ab47049f-1bea-497c-b8a4-88d59b848271" name="Default Changelist" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="DatabaseView">
|
||||
<option name="SHOW_INTERMEDIATE" value="true" />
|
||||
<option name="GROUP_DATA_SOURCES" value="true" />
|
||||
<option name="GROUP_SCHEMA" value="true" />
|
||||
<option name="GROUP_CONTENTS" value="false" />
|
||||
<option name="SORT_POSITIONED" value="false" />
|
||||
<option name="SHOW_EMPTY_GROUPS" value="false" />
|
||||
<option name="AUTO_SCROLL_FROM_SOURCE" value="false" />
|
||||
<option name="HIDDEN_KINDS">
|
||||
<set />
|
||||
</option>
|
||||
<expand />
|
||||
<select />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
<option value="Interface" />
|
||||
<option value="FxmlFile" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="LogFilters">
|
||||
<option name="FILTER_ERRORS" value="false" />
|
||||
<option name="FILTER_WARNINGS" value="false" />
|
||||
<option name="FILTER_INFO" value="true" />
|
||||
<option name="FILTER_DEBUG" value="true" />
|
||||
<option name="CUSTOM_FILTER" />
|
||||
</component>
|
||||
<component name="MavenImportPreferences">
|
||||
<option name="generalSettings">
|
||||
<MavenGeneralSettings>
|
||||
<option name="localRepository" value="C:\JavaWeb_tool\repository" />
|
||||
<option name="mavenHome" value="C:/JavaWeb_tool/apache-maven-3.6.3" />
|
||||
<option name="userSettingsFile" value="C:\JavaWeb_tool\apache-maven-3.6.3\conf\settings.xml" />
|
||||
</MavenGeneralSettings>
|
||||
</option>
|
||||
<option name="importingSettings">
|
||||
<MavenImportingSettings>
|
||||
<option name="importAutomatically" value="true" />
|
||||
</MavenImportingSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectId" id="1exDxzig3glkHsWQuv56qGf3OUc" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showExcludedFiles" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="DatabaseDriversLRU" value="mysql" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/webapp/java/com/hw/controller" />
|
||||
<property name="settings.editor.selected.configurable" value="MavenSettings" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="D:\暑期实训\sxdx01\src\main\webapp\java\com\hw\controller" />
|
||||
<recent name="D:\暑期实训\sxdx01\src\main\webapp\java\com\hw\po" />
|
||||
<recent name="D:\暑期实训\sxdx01\src\main\webapp\java\com\hw\dao" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Application.TestUser">
|
||||
<configuration name="TestUser" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.hw.controller.TestUser" />
|
||||
<module name="sxdx01" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.hw.controller.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Tomcat 8.5.511" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 8.5.511" ALTERNATIVE_JRE_ENABLED="false" nameIsGenerated="true">
|
||||
<option name="OPEN_IN_BROWSER_URL" value="http://localhost:8081/sxdx01_war/" />
|
||||
<option name="UPDATING_POLICY" value="restart-server" />
|
||||
<deployment>
|
||||
<artifact name="sxdx01:war">
|
||||
<settings>
|
||||
<option name="CONTEXT_PATH" value="/sxdx01_war" />
|
||||
</settings>
|
||||
</artifact>
|
||||
</deployment>
|
||||
<server-settings>
|
||||
<option name="BASE_DIRECTORY_NAME" value="Tomcat_8_5_511_sxdx01" />
|
||||
<option name="HTTP_PORT" value="8081" />
|
||||
</server-settings>
|
||||
<predefined_log_file enabled="true" id="Tomcat" />
|
||||
<predefined_log_file enabled="true" id="Tomcat Catalina" />
|
||||
<predefined_log_file id="Tomcat Manager" />
|
||||
<predefined_log_file id="Tomcat Host Manager" />
|
||||
<predefined_log_file id="Tomcat Localhost Access" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="52621" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
<option name="BuildArtifacts" enabled="true">
|
||||
<artifact name="sxdx01:war" />
|
||||
</option>
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 8.5.511" ALTERNATIVE_JRE_ENABLED="false">
|
||||
<option name="UPDATING_POLICY" value="restart-server" />
|
||||
<deployment />
|
||||
<server-settings>
|
||||
<option name="BASE_DIRECTORY_NAME" value="_sxdx01" />
|
||||
</server-settings>
|
||||
<predefined_log_file enabled="true" id="Tomcat" />
|
||||
<predefined_log_file enabled="true" id="Tomcat Catalina" />
|
||||
<predefined_log_file id="Tomcat Manager" />
|
||||
<predefined_log_file id="Tomcat Host Manager" />
|
||||
<predefined_log_file id="Tomcat Localhost Access" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="52621" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.TestUser" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="ServiceViewManager">
|
||||
<option name="viewStates">
|
||||
<list>
|
||||
<serviceView>
|
||||
<treeState>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
|
||||
<item name="Tomcat Server" type="7427dc5b:ServiceModel$ServiceGroupNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
|
||||
<item name="Tomcat Server" type="7427dc5b:ServiceModel$ServiceGroupNode" />
|
||||
<item name="运行" type="7427dc5b:ServiceModel$ServiceGroupNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</treeState>
|
||||
</serviceView>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="ab47049f-1bea-497c-b8a4-88d59b848271" name="Default Changelist" comment="" />
|
||||
<created>1595254600407</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1595254600407</updated>
|
||||
<workItem from="1595254601829" duration="126000" />
|
||||
<workItem from="1595254742729" duration="253000" />
|
||||
<workItem from="1595291718603" duration="3321000" />
|
||||
<workItem from="1595301009596" duration="9661000" />
|
||||
<workItem from="1595381164282" duration="8270000" />
|
||||
<workItem from="1595413424989" duration="5184000" />
|
||||
<workItem from="1595419062095" duration="4282000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state x="232" y="2" key="#Tomcat_Server" timestamp="1595254925617">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state x="232" y="2" key="#Tomcat_Server/0.0.1280.680@0.0.1280.680" timestamp="1595254925617" />
|
||||
<state x="95" y="0" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1595295521149">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state x="95" y="0" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1280.680@0.0.1280.680" timestamp="1595295521149" />
|
||||
<state x="141" y="67" key="#com.intellij.ide.util.MemberChooser" timestamp="1595386719942">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state x="141" y="67" key="#com.intellij.ide.util.MemberChooser/0.0.1280.680@0.0.1280.680" timestamp="1595386719942" />
|
||||
<state x="371" y="90" key="#com.intellij.refactoring.typeMigration.ui.FailedConversionsDialog" timestamp="1595420515063">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state x="371" y="90" key="#com.intellij.refactoring.typeMigration.ui.FailedConversionsDialog/0.0.1280.680@0.0.1280.680" timestamp="1595420515063" />
|
||||
<state x="421" y="84" key="FileChooserDialogImpl" timestamp="1595294032843">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state x="421" y="84" key="FileChooserDialogImpl/0.0.1280.680@0.0.1280.680" timestamp="1595294032843" />
|
||||
<state width="1202" height="309" key="GridCell.Tab.0.bottom" timestamp="1595423523965">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="1202" height="309" key="GridCell.Tab.0.bottom/0.0.1280.680@0.0.1280.680" timestamp="1595423523965" />
|
||||
<state width="1202" height="309" key="GridCell.Tab.0.center" timestamp="1595423523965">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="1202" height="309" key="GridCell.Tab.0.center/0.0.1280.680@0.0.1280.680" timestamp="1595423523965" />
|
||||
<state width="1202" height="309" key="GridCell.Tab.0.left" timestamp="1595423523965">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="1202" height="309" key="GridCell.Tab.0.left/0.0.1280.680@0.0.1280.680" timestamp="1595423523965" />
|
||||
<state width="1202" height="309" key="GridCell.Tab.0.right" timestamp="1595423523965">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="1202" height="309" key="GridCell.Tab.0.right/0.0.1280.680@0.0.1280.680" timestamp="1595423523965" />
|
||||
<state width="1202" height="185" key="GridCell.Tab.1.bottom" timestamp="1595343183409">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="1202" height="185" key="GridCell.Tab.1.bottom/0.0.1280.680@0.0.1280.680" timestamp="1595343183409" />
|
||||
<state width="1202" height="185" key="GridCell.Tab.1.center" timestamp="1595343183409">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="1202" height="185" key="GridCell.Tab.1.center/0.0.1280.680@0.0.1280.680" timestamp="1595343183409" />
|
||||
<state width="1202" height="185" key="GridCell.Tab.1.left" timestamp="1595343183409">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="1202" height="185" key="GridCell.Tab.1.left/0.0.1280.680@0.0.1280.680" timestamp="1595343183409" />
|
||||
<state width="1202" height="185" key="GridCell.Tab.1.right" timestamp="1595343183409">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="1202" height="185" key="GridCell.Tab.1.right/0.0.1280.680@0.0.1280.680" timestamp="1595343183409" />
|
||||
<state width="820" height="163" key="GridCell.Tab.2.bottom" timestamp="1595343183393">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="820" height="163" key="GridCell.Tab.2.bottom/0.0.1280.680@0.0.1280.680" timestamp="1595343183393" />
|
||||
<state width="820" height="163" key="GridCell.Tab.2.center" timestamp="1595343183392">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="820" height="163" key="GridCell.Tab.2.center/0.0.1280.680@0.0.1280.680" timestamp="1595343183392" />
|
||||
<state width="820" height="163" key="GridCell.Tab.2.left" timestamp="1595343183392">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="820" height="163" key="GridCell.Tab.2.left/0.0.1280.680@0.0.1280.680" timestamp="1595343183392" />
|
||||
<state width="820" height="163" key="GridCell.Tab.2.right" timestamp="1595343183393">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state width="820" height="163" key="GridCell.Tab.2.right/0.0.1280.680@0.0.1280.680" timestamp="1595343183393" />
|
||||
<state x="303" y="1" width="672" height="678" key="search.everywhere.popup" timestamp="1595414676665">
|
||||
<screen x="0" y="0" width="1280" height="680" />
|
||||
</state>
|
||||
<state x="303" y="1" width="672" height="678" key="search.everywhere.popup/0.0.1280.680@0.0.1280.680" timestamp="1595414676665" />
|
||||
</component>
|
||||
</project>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,112 @@
|
||||
<?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>sxdx01</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<name>sxdx01 Maven Webapp</name>
|
||||
<!-- FIXME change it to the project's website -->
|
||||
<url>http://www.example.com</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
<!--mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.29</version>
|
||||
</dependency>
|
||||
<!-- 日志文件管理包 -->
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.12</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<finalName>sxdx01</finalName>
|
||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<profilesXml xmlns="http://maven.apache.org/PROFILES/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/PROFILES/1.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
|
||||
<profiles>
|
||||
<profile>
|
||||
<id></id>
|
||||
|
||||
</profile>
|
||||
</profiles>
|
||||
</profilesXml>
|
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE web-app PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
|
||||
<web-app>
|
||||
<display-name>Archetype Created Web Application</display-name>
|
||||
</web-app>
|
@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<h2>Hello World!</h2>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,150 @@
|
||||
package com.hw.controller;
|
||||
|
||||
import com.hw.dao.CartDao;
|
||||
import com.hw.dao.UserDao;
|
||||
import com.hw.po.Cart;
|
||||
import com.hw.po.User;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class TestUser {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// // 插入user对象
|
||||
// User user = new User(1, "admin", "admin", "admin", "980816303@qq.com", "110");
|
||||
// insertUser(user);
|
||||
// 查询所有user对象
|
||||
selectUsers();
|
||||
// //条件查询
|
||||
// selectOneUserById(10);
|
||||
// //修改user
|
||||
User user2 = new User(6, "wo", "123456", "admin", "123@qq.com", "120");
|
||||
updateUserById(user2);
|
||||
// //删除user
|
||||
// deleteUserById(20);
|
||||
deleteUsersByIds();
|
||||
|
||||
// selectCartAndUser();
|
||||
}
|
||||
|
||||
private static void deleteUsersByIds() {
|
||||
//1.加载mybatis核心配置文件
|
||||
InputStream inputStream = TestUser.class.getClassLoader().getResourceAsStream("mybatis-config.xml");
|
||||
//2.创建session工厂
|
||||
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
//3.创建session
|
||||
SqlSession sqlSession = sessionFactory.openSession();
|
||||
//4.创建dao层对象
|
||||
UserDao userDao = sqlSession.getMapper(UserDao.class);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
ArrayList<Integer> ids = new ArrayList<>();
|
||||
ids.add(1);ids.add(8);ids.add(9);
|
||||
map.put("ids",ids);
|
||||
map.put("phone","18827002265");
|
||||
int row = userDao.deleteUsersByIds(map);
|
||||
sqlSession.commit();
|
||||
System.out.println(row);
|
||||
|
||||
}
|
||||
|
||||
private static void selectCartAndUser() {
|
||||
//1.加载mybatis核心配置文件
|
||||
InputStream inputStream = TestUser.class.getClassLoader().getResourceAsStream("mybatis-config.xml");
|
||||
//2.创建session工厂
|
||||
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
//3.创建session
|
||||
SqlSession sqlSession = sessionFactory.openSession();
|
||||
//4.创建dao层对象
|
||||
CartDao cartDao = sqlSession.getMapper(CartDao.class);
|
||||
|
||||
List<Cart> cartList = cartDao.selectCartAndUser();
|
||||
for (Cart carts:cartList) {
|
||||
System.out.println(carts);
|
||||
}
|
||||
}
|
||||
|
||||
private static void deleteUserById(int id) {
|
||||
//1.加载mybatis核心配置文件
|
||||
InputStream inputStream = TestUser.class.getClassLoader().getResourceAsStream("mybatis-config.xml");
|
||||
//2.创建session工厂
|
||||
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
//3.创建session
|
||||
SqlSession sqlSession = sessionFactory.openSession();
|
||||
//4.创建dao层对象
|
||||
UserDao userDao = sqlSession.getMapper(UserDao.class);
|
||||
userDao.deleteUserById(id);
|
||||
sqlSession.commit();
|
||||
System.out.println("我是删除user");
|
||||
}
|
||||
|
||||
private static void updateUserById(User user) {
|
||||
//1.加载mybatis核心配置文件
|
||||
InputStream inputStream = TestUser.class.getClassLoader().getResourceAsStream("mybatis-config.xml");
|
||||
//2.创建session工厂
|
||||
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
//3.创建session
|
||||
SqlSession sqlSession = sessionFactory.openSession();
|
||||
//4.创建dao层对象
|
||||
UserDao userDao = sqlSession.getMapper(UserDao.class);
|
||||
userDao.updateUserById(user);
|
||||
sqlSession.commit();
|
||||
System.out.println("我是修改user");
|
||||
}
|
||||
|
||||
private static void selectOneUserById(int id) {
|
||||
//1.加载mybatis核心配置文件
|
||||
InputStream inputStream = TestUser.class.getClassLoader().getResourceAsStream("mybatis-config.xml");
|
||||
//2.创建session工厂
|
||||
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
//3.创建session
|
||||
SqlSession sqlSession = sessionFactory.openSession();
|
||||
//4.创建dao层对象
|
||||
UserDao userDao = sqlSession.getMapper(UserDao.class);
|
||||
sqlSession.commit();
|
||||
System.out.println("我是条件查询");
|
||||
System.out.println(userDao.selectOneUserById(id));
|
||||
}
|
||||
|
||||
private static void selectUsers() {
|
||||
//1.加载mybatis核心配置文件
|
||||
InputStream inputStream = TestUser.class.getClassLoader().getResourceAsStream("mybatis-config.xml");
|
||||
//2.创建session工厂
|
||||
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
//3.创建session
|
||||
SqlSession sqlSession = sessionFactory.openSession();
|
||||
//4.创建dao层对象
|
||||
UserDao userDao = sqlSession.getMapper(UserDao.class);
|
||||
|
||||
List<User> userList = userDao.selectUsers();
|
||||
// sqlSession.commit();
|
||||
System.out.println("我是查询");
|
||||
for (User users:userList) {
|
||||
System.out.println(users);
|
||||
}
|
||||
}
|
||||
|
||||
private static void insertUser(User user) {
|
||||
//1.加载mybatis核心配置文件
|
||||
InputStream inputStream = TestUser.class.getClassLoader().getResourceAsStream("mybatis-config.xml");
|
||||
//2.创建session工厂
|
||||
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
//3.创建session
|
||||
SqlSession sqlSession = sessionFactory.openSession();
|
||||
//4.创建dao层对象
|
||||
UserDao userDao = sqlSession.getMapper(UserDao.class);
|
||||
//5.操作数据库
|
||||
int rows = userDao.insertUser(user);
|
||||
sqlSession.commit();
|
||||
System.out.println("我是插入user");
|
||||
System.out.println(rows);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.hw.dao;
|
||||
|
||||
import com.hw.po.Cart;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CartDao {
|
||||
//查询全部用户
|
||||
List<Cart> selectCarts();
|
||||
|
||||
List<Cart> selectOneCartByUserId(int userId);
|
||||
|
||||
int updateCartById(Cart cart);
|
||||
|
||||
int deleteCartById(int carId);
|
||||
|
||||
int insertCart(Cart cart);
|
||||
|
||||
List<Cart> selectCartAndUser();
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hw.dao.CartDao">
|
||||
<resultMap id="cartMap" type="Cart">
|
||||
<id property="carid" column="carid"></id>
|
||||
<result property="pid" column="pid"></result>
|
||||
<result property="pname" column="pname"></result>
|
||||
<result property="count" column="count"></result>
|
||||
<result property="imgurl" column="imgurl"></result>
|
||||
<result property="uid" column="uid"></result>
|
||||
<result property="price" column="price"></result>
|
||||
<association property="user" javaType="User">
|
||||
<id property="uid" column="uid"></id>
|
||||
<result property="name" column="name"></result>
|
||||
<result property="password" column="password"></result>
|
||||
<result property="username" column="username"></result>
|
||||
<result property="email" column="email"></result>
|
||||
<result property="phone" column="phone"></result>
|
||||
</association>
|
||||
</resultMap>
|
||||
<select id="selectOneCartByUserId" resultMap="cartMap" parameterType="int">
|
||||
select * from cart
|
||||
<where>
|
||||
<if test="userId != null">uid = #{userId}</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectCarts" resultMap="cartMap">
|
||||
select * from cart
|
||||
</select>
|
||||
<select id="selectCartAndUser" resultMap="cartMap">
|
||||
select * from cart inner join user on cart.uid=user.uid
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,23 @@
|
||||
package com.hw.dao;
|
||||
|
||||
import com.hw.po.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface UserDao {
|
||||
|
||||
//查询全部用户
|
||||
List<User> selectUsers();
|
||||
|
||||
User selectOneUserById(int userId);
|
||||
|
||||
int updateUserById(User user);
|
||||
|
||||
int deleteUserById(int userId);
|
||||
|
||||
int insertUser(User user);
|
||||
|
||||
int deleteUsersByIds(Map<String, Object> map);
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hw.dao.UserDao">
|
||||
<cache/>
|
||||
<resultMap id="userMap" type="User">
|
||||
<id property="uid" column="uid"></id>
|
||||
<result property="name" column="name"></result>
|
||||
<result property="password" column="password"></result>
|
||||
<result property="username" column="username"></result>
|
||||
<result property="email" column="email"></result>
|
||||
<result property="phone" column="phone"></result>
|
||||
<collection property="cartList" ofType="Cart">
|
||||
<id property="carid" column="carid"></id>
|
||||
<result property="pid" column="pid"></result>
|
||||
<result property="pname" column="pname"></result>
|
||||
<result property="count" column="count"></result>
|
||||
<result property="imgurl" column="imgurl"></result>
|
||||
<result property="uid" column="uid"></result>
|
||||
<result property="price" column="price"></result>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<insert id="insertUser" parameterType="User">
|
||||
insert into user values(null,#{name},#{password},#{username},#{email},#{phone})
|
||||
</insert>
|
||||
<select id="selectUsers" resultMap="userMap">
|
||||
select * from user inner join cart on user.uid = cart.uid
|
||||
</select>
|
||||
<select id="selectOneUserById" resultMap="userMap" parameterType="int">
|
||||
select * from user where uid = #{userId}
|
||||
</select>
|
||||
<delete id="deleteUserById" parameterType="int">
|
||||
delete from user where uid = #{userId}
|
||||
</delete>
|
||||
<update id="updateUserById" parameterType="User">
|
||||
update user
|
||||
<set>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="username != null">username = #{username},</if>
|
||||
<if test="email != null">email = #{email},</if>
|
||||
<if test="phone != null">phone = #{phone},</if>
|
||||
</set>
|
||||
where uid = #{uid}
|
||||
</update>
|
||||
<delete id="deleteUsersByIds">
|
||||
delete from user where uid in
|
||||
<foreach collection="ids" open="(" close=")" separator="," item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
and phone = #{phone}
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,117 @@
|
||||
package com.hw.po;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Cart implements Serializable {
|
||||
|
||||
private int carid;
|
||||
private int pid;
|
||||
private String pname;
|
||||
private int count;
|
||||
private String imgurl;
|
||||
private int uid;
|
||||
private double price;
|
||||
private User user;
|
||||
|
||||
public Cart(int carid, int pid, String pname, int count, String imgurl, int uid, double price, User user) {
|
||||
this.carid = carid;
|
||||
this.pid = pid;
|
||||
this.pname = pname;
|
||||
this.count = count;
|
||||
this.imgurl = imgurl;
|
||||
this.uid = uid;
|
||||
this.price = price;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public Cart() {
|
||||
}
|
||||
|
||||
public Cart(int carid, int pid, String pname, int count, String imgurl, int uid,double price) {
|
||||
this.carid = carid;
|
||||
this.pid = pid;
|
||||
this.count = count;
|
||||
this.imgurl = imgurl;
|
||||
this.pname = pname;
|
||||
this.price = price;
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getCarid() {
|
||||
return carid;
|
||||
}
|
||||
|
||||
public void setCarid(int carid) {
|
||||
this.carid = carid;
|
||||
}
|
||||
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getImgurl() {
|
||||
return imgurl;
|
||||
}
|
||||
|
||||
public void setImgurl(String imgurl) {
|
||||
this.imgurl = imgurl;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public String getPname() {
|
||||
return pname;
|
||||
}
|
||||
|
||||
public void setPname(String pname) {
|
||||
this.pname = pname;
|
||||
}
|
||||
|
||||
public int getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(int pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Cart{" +
|
||||
"carid=" + carid +
|
||||
", pid=" + pid +
|
||||
", pname='" + pname + '\'' +
|
||||
", count=" + count +
|
||||
", imgurl='" + imgurl + '\'' +
|
||||
", uid=" + uid +
|
||||
", price=" + price +
|
||||
", user=" + user +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package com.hw.po;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class User implements Serializable {
|
||||
|
||||
private int uid;
|
||||
private String name;
|
||||
private String password;
|
||||
private String username;
|
||||
private String email;
|
||||
private String phone;
|
||||
private List<Cart> cartList;
|
||||
|
||||
public List<Cart> getCartList() {
|
||||
return cartList;
|
||||
}
|
||||
|
||||
public void setCartList(List<Cart> cartList) {
|
||||
this.cartList = cartList;
|
||||
}
|
||||
|
||||
public User(int uid, String name, String password, String username, String email, String phone, List<Cart> cartList) {
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.password = password;
|
||||
this.username = username;
|
||||
this.email = email;
|
||||
this.phone = phone;
|
||||
this.cartList = cartList;
|
||||
}
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
public User(int uid, String name, String password, String username, String email, String phone) {
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.password = password;
|
||||
this.username = username;
|
||||
this.email = email;
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"uid=" + uid +
|
||||
", name='" + name + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", username='" + username + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", phone='" + phone + '\'' +
|
||||
", cartList=" + cartList +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
jdbc_driver=com.mysql.jdbc.Driver
|
||||
jdbc_url=jdbc:mysql://localhost:3306/summer
|
||||
jdbc_username=root
|
||||
jdbc_password=HW0612hw
|
@ -0,0 +1,11 @@
|
||||
### jibie mudidi ###
|
||||
log4j.rootLogger=debug, stdout,logfile
|
||||
### kongzhitai ###
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.err
|
||||
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
|
||||
### wenjian ###
|
||||
log4j.appender.logfile=org.apache.log4j.FileAppender
|
||||
log4j.appender.logfile.File=jbit.log
|
||||
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %l %F %p %m%n
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<properties resource="db.properties"></properties>
|
||||
<typeAliases>
|
||||
<package name="com.hw.po"/>
|
||||
</typeAliases>
|
||||
<environments default="development">
|
||||
<environment id="development">
|
||||
<transactionManager type="JDBC" />
|
||||
<!-- 配置数据库连接信息 -->
|
||||
<dataSource type="POOLED">
|
||||
<property name="driver" value="${jdbc_driver}" />
|
||||
<property name="url" value="${jdbc_url}" />
|
||||
<property name="username" value="${jdbc_username}" />
|
||||
<property name="password" value="${jdbc_password}" />
|
||||
</dataSource>
|
||||
</environment>
|
||||
</environments>
|
||||
<mappers>
|
||||
<mapper class="com.hw.dao.UserDao"></mapper>
|
||||
<mapper class="com.hw.dao.CartDao"></mapper>
|
||||
</mappers>
|
||||
</configuration>
|
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4" />
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hw.dao.CartDao">
|
||||
<resultMap id="cartMap" type="Cart">
|
||||
<id property="carid" column="carid"></id>
|
||||
<result property="pid" column="pid"></result>
|
||||
<result property="pname" column="pname"></result>
|
||||
<result property="count" column="count"></result>
|
||||
<result property="imgurl" column="imgurl"></result>
|
||||
<result property="uid" column="uid"></result>
|
||||
<result property="price" column="price"></result>
|
||||
<association property="user" javaType="User">
|
||||
<id property="uid" column="uid"></id>
|
||||
<result property="name" column="name"></result>
|
||||
<result property="password" column="password"></result>
|
||||
<result property="username" column="username"></result>
|
||||
<result property="email" column="email"></result>
|
||||
<result property="phone" column="phone"></result>
|
||||
</association>
|
||||
</resultMap>
|
||||
<select id="selectOneCartByUserId" resultMap="cartMap" parameterType="int">
|
||||
select * from cart
|
||||
<where>
|
||||
<if test="userId != null">uid = #{userId}</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectCarts" resultMap="cartMap">
|
||||
select * from cart
|
||||
</select>
|
||||
<select id="selectCartAndUser" resultMap="cartMap">
|
||||
select * from cart inner join user on cart.uid=user.uid
|
||||
</select>
|
||||
</mapper>
|
Binary file not shown.
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hw.dao.UserDao">
|
||||
<cache/>
|
||||
<resultMap id="userMap" type="User">
|
||||
<id property="uid" column="uid"></id>
|
||||
<result property="name" column="name"></result>
|
||||
<result property="password" column="password"></result>
|
||||
<result property="username" column="username"></result>
|
||||
<result property="email" column="email"></result>
|
||||
<result property="phone" column="phone"></result>
|
||||
<collection property="cartList" ofType="Cart">
|
||||
<id property="carid" column="carid"></id>
|
||||
<result property="pid" column="pid"></result>
|
||||
<result property="pname" column="pname"></result>
|
||||
<result property="count" column="count"></result>
|
||||
<result property="imgurl" column="imgurl"></result>
|
||||
<result property="uid" column="uid"></result>
|
||||
<result property="price" column="price"></result>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<insert id="insertUser" parameterType="User">
|
||||
insert into user values(null,#{name},#{password},#{username},#{email},#{phone})
|
||||
</insert>
|
||||
<select id="selectUsers" resultMap="userMap">
|
||||
select * from user inner join cart on user.uid = cart.uid
|
||||
</select>
|
||||
<select id="selectOneUserById" resultMap="userMap" parameterType="int">
|
||||
select * from user where uid = #{userId}
|
||||
</select>
|
||||
<delete id="deleteUserById" parameterType="int">
|
||||
delete from user where uid = #{userId}
|
||||
</delete>
|
||||
<update id="updateUserById" parameterType="User">
|
||||
update user
|
||||
<set>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="username != null">username = #{username},</if>
|
||||
<if test="email != null">email = #{email},</if>
|
||||
<if test="phone != null">phone = #{phone},</if>
|
||||
</set>
|
||||
where uid = #{uid}
|
||||
</update>
|
||||
<delete id="deleteUsersByIds">
|
||||
delete from user where uid in
|
||||
<foreach collection="ids" open="(" close=")" separator="," item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
and phone = #{phone}
|
||||
</delete>
|
||||
</mapper>
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
jdbc_driver=com.mysql.jdbc.Driver
|
||||
jdbc_url=jdbc:mysql://localhost:3306/summer
|
||||
jdbc_username=root
|
||||
jdbc_password=HW0612hw
|
@ -0,0 +1,11 @@
|
||||
### jibie mudidi ###
|
||||
log4j.rootLogger=debug, stdout,logfile
|
||||
### kongzhitai ###
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.err
|
||||
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
|
||||
### wenjian ###
|
||||
log4j.appender.logfile=org.apache.log4j.FileAppender
|
||||
log4j.appender.logfile.File=jbit.log
|
||||
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %l %F %p %m%n
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<properties resource="db.properties"></properties>
|
||||
<typeAliases>
|
||||
<package name="com.hw.po"/>
|
||||
</typeAliases>
|
||||
<environments default="development">
|
||||
<environment id="development">
|
||||
<transactionManager type="JDBC" />
|
||||
<!-- 配置数据库连接信息 -->
|
||||
<dataSource type="POOLED">
|
||||
<property name="driver" value="${jdbc_driver}" />
|
||||
<property name="url" value="${jdbc_url}" />
|
||||
<property name="username" value="${jdbc_username}" />
|
||||
<property name="password" value="${jdbc_password}" />
|
||||
</dataSource>
|
||||
</environment>
|
||||
</environments>
|
||||
<mappers>
|
||||
<mapper class="com.hw.dao.UserDao"></mapper>
|
||||
<mapper class="com.hw.dao.CartDao"></mapper>
|
||||
</mappers>
|
||||
</configuration>
|
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
Manifest-Version: 1.0
|
||||
Created-By: IntelliJ IDEA
|
||||
Built-By: PH
|
||||
Build-Jdk: 1.8.0_112
|
||||
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hw.dao.UserDao">
|
||||
<insert id="insertUser" parameterType="com.hw.po.User">
|
||||
insert into user values(null,#{name},#{password},#{username},#{email},#{phone})
|
||||
</insert>
|
||||
</mapper>
|
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
jdbc_driver=com.mysql.jdbc.Driver
|
||||
jdbc_url=jdbc:mysql://localhost:3306/summer
|
||||
jdbc_username=root
|
||||
jdbc_password=HW0612hw
|
@ -0,0 +1,11 @@
|
||||
### jibie mudidi ###
|
||||
log4j.rootLogger=debug, stdout,logfile
|
||||
### kongzhitai ###
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.err
|
||||
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
|
||||
### wenjian ###
|
||||
log4j.appender.logfile=org.apache.log4j.FileAppender
|
||||
log4j.appender.logfile.File=jbit.log
|
||||
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %l %F %p %m%n
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<properties resource="db.properties"></properties>
|
||||
<environments default="development">
|
||||
<environment id="development">
|
||||
<transactionManager type="JDBC" />
|
||||
<!-- 配置数据库连接信息 -->
|
||||
<dataSource type="POOLED">
|
||||
<property name="driver" value="${jdbc_driver}" />
|
||||
<property name="url" value="${jdbc_url}" />
|
||||
<property name="username" value="${jdbc_username}" />
|
||||
<property name="password" value="${jdbc_password}" />
|
||||
</dataSource>
|
||||
</environment>
|
||||
</environments>
|
||||
</configuration>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE web-app PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
|
||||
<web-app>
|
||||
<display-name>Archetype Created Web Application</display-name>
|
||||
</web-app>
|
@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<h2>Hello World!</h2>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,36 @@
|
||||
package com.hw.controller;
|
||||
|
||||
import com.hw.dao.UserDao;
|
||||
import com.hw.po.User;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public class TestUser {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
//1.加载mybatis核心配置文件
|
||||
InputStream inputStream = TestUser.class.getClassLoader().getResourceAsStream("mybatis-config.xml");
|
||||
//2.创建session工厂
|
||||
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
//3.创建session
|
||||
SqlSession sqlSession = sessionFactory.openSession();
|
||||
//4.创建dao层对象
|
||||
UserDao userDao = sqlSession.getMapper(UserDao.class);
|
||||
//5.操作数据库
|
||||
User user = new User(1, "admin", "admin", "admin", "980816303@qq.com", "110");
|
||||
int rows = userDao.insertUser(user);
|
||||
//注意,提交事务
|
||||
sqlSession.commit();
|
||||
System.out.println(rows);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.hw.dao;
|
||||
|
||||
import com.hw.po.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserDao {
|
||||
|
||||
//查询全部用户
|
||||
List<User> selectUsers();
|
||||
|
||||
User selectOneUserById(int userId);
|
||||
|
||||
int updateUserById(int userId);
|
||||
|
||||
int deleteUserById(int userId);
|
||||
|
||||
int insertUser(User user);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hw.dao.UserDao">
|
||||
<insert id="insertUser" parameterType="com.hw.po.User">
|
||||
insert into user values(null,#{name},#{password},#{username},#{email},#{phone})
|
||||
</insert>
|
||||
</mapper>
|
@ -0,0 +1,84 @@
|
||||
package com.hw.po;
|
||||
|
||||
public class User {
|
||||
|
||||
private int uid;
|
||||
private String name;
|
||||
private String password;
|
||||
private String username;
|
||||
private String email;
|
||||
private String phone;
|
||||
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
public User(int uid, String name, String password, String username, String email, String phone) {
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.password = password;
|
||||
this.username = username;
|
||||
this.email = email;
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"uid=" + uid +
|
||||
", name='" + name + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", username='" + username + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", phone='" + phone + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
jdbc_driver=com.mysql.jdbc.Driver
|
||||
jdbc_url=jdbc:mysql://localhost:3306/summer
|
||||
jdbc_username=root
|
||||
jdbc_password=HW0612hw
|
@ -0,0 +1,11 @@
|
||||
### jibie mudidi ###
|
||||
log4j.rootLogger=debug, stdout,logfile
|
||||
### kongzhitai ###
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.err
|
||||
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
|
||||
### wenjian ###
|
||||
log4j.appender.logfile=org.apache.log4j.FileAppender
|
||||
log4j.appender.logfile.File=jbit.log
|
||||
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %l %F %p %m%n
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<properties resource="db.properties"></properties>
|
||||
<environments default="development">
|
||||
<environment id="development">
|
||||
<transactionManager type="JDBC" />
|
||||
<!-- 配置数据库连接信息 -->
|
||||
<dataSource type="POOLED">
|
||||
<property name="driver" value="${jdbc_driver}" />
|
||||
<property name="url" value="${jdbc_url}" />
|
||||
<property name="username" value="${jdbc_username}" />
|
||||
<property name="password" value="${jdbc_password}" />
|
||||
</dataSource>
|
||||
</environment>
|
||||
</environments>
|
||||
</configuration>
|
Loading…
Reference in new issue