Commit a2b52f73 authored by zhouxi's avatar zhouxi

Merge remote-tracking branch 'origin/master'

parents 5f79ae9e 43508462
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/activation-1.1.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/antlr-2.7.6.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/antlr-runtime.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/aopalliance-1.0.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/asm-3.2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/aspectjweaver-1.6.8.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/backport-util-concurrent-3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/bcprov-jdk15-1.45.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/bsf-2.3.0.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cglib-nodep-2.2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/ckeditor-java-core-3.5.3.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-beanutils-1.8.3.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-beanutils-core-1.8.0.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-codec-1.4.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-configuration-1.6.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-dbcp-1.3.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-digester-2.0.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-fileupload-1.2.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-httpclient-3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-io-1.4.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-lang-2.5.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/commons-pool-1.5.4.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-api-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-common-schemas-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-common-utilities-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-rt-bindings-soap-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-rt-bindings-xml-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-rt-core-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-rt-databinding-jaxb-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-rt-frontend-jaxws-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-rt-frontend-simple-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-rt-transports-http-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-rt-ws-addr-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-rt-ws-security-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/cxf-tools-common-2.3.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/dbunit-2.4.8.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/drools-api.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/drools-compiler.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/drools-core.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/dwr-1.1.3.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/ehcache-1.6.2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/ejb3-persistence-1.0.2.GA.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/ezmorph-1.0.6.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/freemarker-2.3.16.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/geronimo-javamail_1.4_spec-1.7.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/hibernate-annotations-3.4.0.GA.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/hibernate-commons-annotations-3.1.0.GA.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/hibernate-core-3.3.2.GA.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/hibernate-ehcache-3.3.2.GA.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/hibernate-jmx-3.3.2.GA.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/hibernate-validator-4.1.0.Final.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/hsqldb-1.8.0.10.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/icu4j-2.6.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jackson-core-asl-1.6.4.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jackson-jaxrs-1.6.4.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jackson-mapper-asl-1.6.4.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jakarta-oro-2.0.8.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/janino.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/javassist-3.11.0.GA.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jaxb-api-2.2.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jaxb-impl-2.2.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jaxen-1.1.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jbpm.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jdom-1.0.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jmock-junit4-2.5.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/json-lib-2.4-jdk15.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jstl-1.1.2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jta-1.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/juel-api.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/juel-engine.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/juel-impl.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/junit-4.8.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/junit-4.8.2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jxl.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/jxl-2.6.3.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/livetribe-jsr223.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/log4j-1.2.16.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/log4jdbc3-1.2.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/mail-1.4.3.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/mvel2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/mybatis-3.0.3.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/mybatis-spring-1.0.0-RC3.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/mysql-connector-java-5.1.13.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/neethi-2.0.4.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/ognl-2.7.3.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/ojdbc-10.2.0.4.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/org.mortbay.jetty-5.1.10.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/oro-2.0.8.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/poi-3.6.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/rapid-core-4.0.5.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/rapid-generator-4.0.5.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/rapid-generator-ext-4.0.5.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/rapid-generator-template-4.0.5.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/serializer-2.7.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/servlet-api-2.5.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/shiro-core-1.1.0.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/shiro-spring-1.1.0.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/shiro-web-1.1.0.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/slf4j-api-1.6.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/slf4j-log4j12-1.6.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-aop-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-asm-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-aspects-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-beans-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-context-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-context-support-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-core-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-expression-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-instrument-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-jdbc-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-jms-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-orm-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-oxm-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-test-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-tx-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-web-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/spring-webmvc-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/sqljdbc.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/standard-1.1.2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/stax2-api-3.0.2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/stax-api-1.0-2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/struts2-convention-plugin-2.1.8.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/struts2-core-2.1.8.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/urlrewritefilter-3.1.0.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/validation-api-1.0.0.GA.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/velocity-1.6.3.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/woodstox-core-asl-4.0.8.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/wsdl4j-1.6.2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/wss4j-1.5.10.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/xalan-2.7.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/xercesImpl-2.9.1.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/xml-apis-1.0.b2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/xmlParserAPIs-2.6.2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/xml-resolver-1.2.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/XmlSchema-1.4.7.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/xmlsec-1.4.4.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/xom-1.0.jar"/>
<classpathentry kind="lib" path="C:/development/MyEclipseWorkspace/xxh3/web/WEB-INF/lib/xwork-core-2.1.6.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Heguanting-JSONTypeHandler</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
#Wed Dec 11 16:34:06 CST 2019
#Wed Dec 11 16:34:06 CST 2019
eclipse.preferences.version=1
encoding//src/main/java/com/ces/mybatis/handler/JSONTypeHandler.java=UTF-8
encoding//src/main/java/org/ces/mapper/UserMapper.java=UTF-8
encoding//src/main/java/org/ces/test/TestDao.java=UTF-8
eclipse.preferences.version=1
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
activeProfiles=
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<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">
<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>Heguanting-JSONTypeHandler</groupId>
<artifactId>Heguanting-JSONTypeHandler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.34</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.ces.mybatis.handler;
package com.ces.mybatis.handler;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.json.JSONObject;
/**
* MyBatis类型转换
*/
public class JSONTypeHandler extends BaseTypeHandler<JSONObject>{
@Override
public JSONObject getNullableResult(ResultSet rs, String cloumName) throws SQLException {
// TODO Auto-generated method stub
String value = rs.getString(columnName);
if (value != null) {
try {
return new JSONObject(value);
}catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
@Override
public void setNonNullParameter(PreparedStatement statement, int i, JSONObject infoObject, JdbcType jdbcType) throws SQLException {
// TODO Auto-generated method stub
if(infoObject != null){
statement.setString(i, infoObject.toString());
}
}
@Override
public JSONObject getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
// TODO Auto-generated method stub
return null;
}
@Override
public JSONObject getNullableResult(ResultSet arg0, int arg1) throws SQLException {
// TODO Auto-generated method stub
return null;
}
}
package org.ces.entity;
package org.ces.entity;
import java.io.Serializable;
import org.json.JSONObject;
public class User implements Serializable{
private String id;
private JSONObject json;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public JSONObject getJson() {
return json;
}
public void setJson(JSONObject json) {
this.json = json;
}
}
package org.ces.mapper;
package org.ces.mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.json.JSONObject;
import org.ces.entity.User;
public interface UserMapper {
@Select("SELECT * FROM USER WHERE id = #{id}")
User selectUser(long id);
@Insert("INSERT INTO USER VALUES(#{id}, #{json})")
int insertUser(@Param("id")long id, @Param("json")JSONObject json);
}
package org.ces.test;
package org.ces.test;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.ces.entity.User;
import org.ces.mapper.UserMapper;
import org.junit.Before;
import org.junit.Test;
import org.json.JSONObject;
/**
*/
public class TestDao {
@Test
public void test2() {
SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
InputStream input = TestDao.class.getClassLoader().getResourceAsStream("SqlMapConfig.xml");
SqlSessionFactory factory = builder.build(input);
SqlSession session1 = factory.openSession();
UserMapper dao1 = session1.getMapper(UserMapper.class);
for(int i=0; i<500;i++) {
JSONObject json = new JSONObject();
json.put("id",i);
json.put("name", "testUser_"+i);
dao1.insertUser(i, json);
}
session1.commit();
}
public static void main(String[] args) {
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<?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>
<settings>
<setting name="cacheEnabled" value="true" />
<!-- <setting name="lazyLoadingEnabled" value="false" /> -->
<!-- <setting name="aggressiveLazyLoading" value="false" /> -->
<!-- <setting name="multipleResultSetsEnabled" value="true" /> -->
<!-- <setting name="useColumnLabel" value="true" /> -->
<!-- <setting name="useGeneratedKeys" value="false" /> -->
<!-- <setting name="autoMappingBehavior" value="PARTIAL" /> -->
<!-- <setting name="defaultExecutorType" value="SIMPLE" /> -->
<!-- <setting name="defaultStatementTimeout" value="25" /> -->
<!-- <setting name="safeRowBoundsEnabled" value="false" /> -->
<!-- <setting name="mapUnderscoreToCamelCase" value="false" /> -->
<!-- <setting name="localCacheScope" value="SESSION" /> -->
<!-- <setting name="jdbcTypeForNull" value="OTHER" /> -->
<!-- <setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString" /> -->
</settings>
<!-- 注册类型转换器 -->
<typeHandlers>
<typeHandler javaType="org.json.JSONObject" jdbcType="VARCHAR" handler="com.ces.mybatis.handler.JSONTypeHandler"/>
</typeHandlers>
<!-- 对事务的管理和连接池的配置 -->
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql:///test?useUnicode=true&amp;characterEncoding=utf-8" />
<property name="username" value="root" />
<property name="password" value="1234" />
</dataSource>
</environment>
</environments>
<!-- mapping 文件路径配置 -->
<mappers>
<!-- <package name="com.ces.mapper"></package> -->
<mapper resource="org.ces.mapper.UserMapper" />
</mappers>
</configuration>
\ No newline at end of file
log4j.rootLogger=DEBUG, stdout
log4j.rootLogger=DEBUG, stdout
# SqlMap logging configuration...
log4j.logger.com.ibatis=DEBUG
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.cache.CacheModel=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientImpl=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.builder.xml.SqlMapParser=DEBUG
log4j.logger.com.ibatis.common.util.StopWatch=DEBUG
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
\ No newline at end of file
#IP
#IP
redis.ip=127.0.0.1
#Port
redis.port=6379
#timeout
redis.timeout=60000
redis.pool.testOnBorrow=false
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?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>com.cesgroup.mybatis</groupId>
<artifactId>homework.mybatis</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- 集中定义依赖版本号 -->
<properties>
<junit.version>4.12</junit.version>
<spring.version>5.0.10.RELEASE</spring.version>
<mybatis.version>3.4.6</mybatis.version>
<mybatis.spring.version>1.3.2</mybatis.spring.version>
<mysql.version>5.1.32</mysql.version>
<slf4j.version>1.6.4</slf4j.version>
<druid.version>1.0.9</druid.version>
<jstl.version>1.2</jstl.version>
<servlet-api.version>2.5</servlet-api.version>
<jsp-api.version>2.0</jsp-api.version>
</properties>
<dependencies>
<!-- 单元测试 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!--spring集成测试-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
<version>${spring.version}</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis.spring.version}</version>
</dependency>
<!-- MySql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!--日志-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- 连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- JSP相关 -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>${jsp-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.60</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- 资源文件拷贝插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- java编译插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- 配置Tomcat插件 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.cesgroup.practice.entity;
package com.cesgroup.practice.entity;
import com.alibaba.fastjson.JSONObject;
import java.io.Serializable;
public class User implements Serializable{
private int id;
private String name;
private JSONObject info;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public JSONObject getInfo() {
return info;
}
public void setInfo(JSONObject info) {
this.info = info;
}
}
package com.cesgroup.practice.handler;
package com.cesgroup.practice.handler;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.alibaba.fastjson.JSONObject;
public class JSONHandler extends BaseTypeHandler<JSONObject> {
@Override
public void setNonNullParameter(PreparedStatement preparedStatement, int i, JSONObject jsonObject, JdbcType jdbcType) throws SQLException {
try {
String userInfoString= JSONObject.toJSONString(jsonObject);
preparedStatement.setString(i, userInfoString);
} catch (Exception e) {
System.out.println("----将对象转化为字符串失败----");
}
}
@Override
public JSONObject getNullableResult(ResultSet resultSet, String s) throws SQLException {
String infoJsonString= resultSet.getString(s);
JSONObject infObject=null;
try {
infObject = JSONObject.parseObject(infoJsonString);
//System.out.println("----将json串转成json对象成功!----");
} catch (Exception e) {
System.err.println("将json串转成json对象失败!");;
}
return infObject;
}
@Override
public JSONObject getNullableResult(ResultSet resultSet, int i) throws SQLException {
return null;
}
@Override
public JSONObject getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
return null;
}
}
++ "b/\346\235\250\350\213\217\345\246\271_mybatis1/src/main/resources/spring/applicationContext.xml"
<?xml version="1.0" encoding="UTF-8" ?>
<?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>
<typeHandlers>
<typeHandler handler="com.cesgroup.mybatiswork.handle.MyTypeHandle"></typeHandler>
</typeHandlers>
<!-- 环境,可以配置多个,default:指定采用哪个环境 -->
<environments default="dev">
<!-- id:唯一标识 -->
<environment id="dev">
<!-- 事务管理器,JDBC类型的事务管理器 -->
<transactionManager type="JDBC" />
<!-- 数据源,池类型的数据源 -->
<dataSource type="POOLED">
<property name="driver" value="${driver}" /> <!-- 配置了properties,所以可以直接引用 -->
<property name="url" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="MyMapper.xml" />
</mappers>
</configuration>
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for mybatis
-- ----------------------------
DROP TABLE IF EXISTS `mybatis`;
CREATE TABLE `mybatis` (
`id` int(32) NOT NULL,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`info` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
<?xml version="1.0" encoding="UTF-8" ?>
<?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:命名空间,随便写,一般保证命名空间唯一 -->
<mapper namespace="useMapper">
<!-- statement,内容:sql语句。id:唯一标识,随便写,在同一个命名空间下保持唯一
resultType:sql语句查询结果集的封装类型,tb_user即为数据库中的表
-->
<select id="selectUser" resultType="com.cesgroup.mybatiswork.entity.User">
select * from mybatis where id = #{id}
</select>
<insert id="insert" parameterType="com.cesgroup.mybatiswork.entity.User">
INSERT INTO mybatis (id, name, info)
VALUES(#{id}, #{name}, #{info})
</insert>
<insert id="insertBatch">
INSERT INTO mybatis
(id, name, info)
VALUES
<foreach collection ="list" item="user" separator =",">
(#{user.id}, #{user.name}, #{user.info})
</foreach >
</insert>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.cesgroup.homwork</groupId>
<artifactId>mybatis</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mybatis</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.6.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency><dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
执行测试类:`com.cesgroup.homwork.mybatis.MybatisApplicationTests`
执行测试类:`com.cesgroup.homwork.mybatis.MybatisApplicationTests`
\ No newline at end of file
/*
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 80013
Source Host : localhost:3306
Source Database : test
Target Server Type : MYSQL
Target Server Version : 80013
File Encoding : 65001
Date: 2019-12-09 13:34:49
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for city
-- ----------------------------
DROP TABLE IF EXISTS `city`;
CREATE TABLE `city` (
`id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`name` varchar(255) DEFAULT NULL,
`context` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
package com.cesgroup.homwork.mybatis;
package com.cesgroup.homwork.mybatis;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MybatisApplication {
public static void main(String[] args) {
SpringApplication.run(MybatisApplication.class, args);
}
}
package com.cesgroup.homwork.mybatis.sample.config;
package com.cesgroup.homwork.mybatis.sample.config;
import com.cesgroup.homwork.mybatis.sample.type.MapTypeHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MyBatisConfig {
@Bean
MapTypeHandler mapTypeHandler() {
return new MapTypeHandler();
}
}
\ No newline at end of file
package com.cesgroup.homwork.mybatis.sample.entity;
package com.cesgroup.homwork.mybatis.sample.entity;
import java.util.Map;
/**
*
*/
public class City {
private String id;
private String name;
private Map<String,Object> context;
public String getId() {
return id;
}
public City setId(String id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public City setName(String name) {
this.name = name;
return this;
}
public Map<String, Object> getContext() {
return context;
}
public City setContext(Map<String, Object> context) {
this.context = context;
return this;
}
@Override
public String toString() {
return "City{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", context=" + context +
'}';
}
}
\ No newline at end of file
package com.cesgroup.homwork.mybatis.sample.mapper;
package com.cesgroup.homwork.mybatis.sample.mapper;
import com.cesgroup.homwork.mybatis.sample.entity.City;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface CityMapper {
@Insert("INSERT INTO city (id, name, context) VALUES(#{id}, #{name}, #{context})")
void insert(City city);
@Select("SELECT id, name, context FROM city WHERE id = #{id}")
City findById(String id);
}
\ No newline at end of file
package com.cesgroup.homwork.mybatis.sample.service;
package com.cesgroup.homwork.mybatis.sample.service;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.IdUtil;
import com.cesgroup.homwork.mybatis.sample.entity.City;
import com.cesgroup.homwork.mybatis.sample.mapper.CityMapper;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 批量sql处理类
* @author ding.haiyang
* @date 2019/12/9
*/
@Service
public class BatchService {
private SqlSession sqlSession;
public BatchService(SqlSessionFactory sqlSessionFactory) {
sqlSession = new SqlSessionTemplate(sqlSessionFactory,ExecutorType.BATCH) ;
}
public int batchInsertCity(List<City> cities){
CityMapper cityMapper = sqlSession.getMapper(CityMapper.class);
//批量保存执行前时间
long start=System.currentTimeMillis();
for (City city : cities) {
city.setId(IdUtil.simpleUUID());
cityMapper.insert(city);
}
long end= System.currentTimeMillis();
long time2= end-start;
//批量保存执行后的时间
Console.log("批量执行时长"+time2);
return cities.size();
}
}
package com.cesgroup.homwork.mybatis.sample.type;
package com.cesgroup.homwork.mybatis.sample.type;
import cn.hutool.json.JSONUtil;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
/**
* map类型转换器
* @author ding.haiyang
* @date 2019/12/9
*/
public class MapTypeHandler extends BaseTypeHandler<Map> {
public MapTypeHandler() {
}
@Override
public void setNonNullParameter(PreparedStatement ps, int i, Map map, JdbcType jdbcType) throws SQLException {
ps.setString(i,JSONUtil.toJsonStr(map));
}
@Override
public Map getNullableResult(ResultSet rs, String columnName) throws SQLException {
String result = rs.getString(columnName);
return rs.wasNull() ? null : JSONUtil.parseObj(result);
}
@Override
public Map getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String result = rs.getString(columnIndex);
return rs.wasNull() ? null : JSONUtil.parseObj(result);
}
@Override
public Map getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
String result = cs.getString(columnIndex);
return cs.wasNull() ? null : JSONUtil.parseObj(result);
}
}
\ No newline at end of file
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test?serverTimezone=GMT-8
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=1234
mybatis.type-aliases-package=com.cesgroup.homwork.mybatis
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.configuration.default-fetch-size=100
mybatis.configuration.default-statement-timeout=30
package com.cesgroup.homwork.mybatis;
package com.cesgroup.homwork.mybatis;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil;
import com.cesgroup.homwork.mybatis.sample.entity.City;
import com.cesgroup.homwork.mybatis.sample.mapper.CityMapper;
import com.cesgroup.homwork.mybatis.sample.service.BatchService;
import org.junit.jupiter.api.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 javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RunWith(SpringRunner.class)
@SpringBootTest
class MybatisApplicationTests {
@Resource
private CityMapper cityMapper;
@Autowired
private BatchService batchService;
///////////////////////////////////////////////////
////
//// 测试类型转换
////
///////////////////////////////////////////////////
@Test
void contextLoads() {
City city = new City();
Map<String, Object> context = new HashMap<>();
context.put("a","aaa");
context.put("b","bb");
context.put("c","c");
context.put("d","dddddddddd");
city.setId(IdUtil.simpleUUID())
// .setId("857b193a846a4246a2087358daa9c9b6")
.setName(RandomUtil.randomString(4))
.setContext(context);
cityMapper.insert(city);
}
@Test
void select() {
City byId = cityMapper.findById("857b193a846a4246a2087358daa9c9b6");
Console.log(byId);
Console.log(JSONUtil.toJsonStr(byId));
}
///////////////////////////////////////////////////
////
//// 测试批量处
////
///////////////////////////////////////////////////
@Test
void batch() {
List<City> cities = new ArrayList<City>();
for (int i = 0; i < 10000; i++) {
City city = new City();
city.setName(RandomUtil.randomString("是否是法发热人刚明年吧",4));
cities.add(city);
}
batchService.batchInsertCity(cities);
this.noBath(cities);
}
void noBath(List<City> cities){
//批量保存执行前时间
long start=System.currentTimeMillis();
for (City city : cities) {
city.setId(IdUtil.simpleUUID());
cityMapper.insert(city);
}
long end= System.currentTimeMillis();
long time2= end-start;
//批量保存执行后的时间
Console.log("非批量执行时长"+time2);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/main/resource"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
++ "b/\350\203\241\351\223\255\346\265\251_Mybatis1/.gitkeep"
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>mybatis</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8
eclipse.preferences.version=1
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
activeProfiles=
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?>
<?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>com.ces</groupId>
<artifactId>mybatis</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mybatis</name>
<!--spring boot 版本 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.8</java.version>
<poi.version>4.1.0</poi.version>
<mybatis-spring-boot-starter.version>1.1.1</mybatis-spring-boot-starter.version>
<druid.version>1.0.29</druid.version>
<fastjson.version>1.2.32</fastjson.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- json处理工具 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- druid数据库连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- 数据库连接驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.22</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>xdocreport</artifactId>
<version>2.0.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.12.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-all -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.6.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.spring4all/swagger-spring-boot-starter -->
<dependency>
<groupId>com.spring4all</groupId>
<artifactId>swagger-spring-boot-starter</artifactId>
<version>1.9.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
1.项目resource下的application.yml为配置文件,请修改datasource下的url、username、password,保证存在对应的数据库。
1.项目resource下的application.yml为配置文件,请修改datasource下的url、username、password,保证存在对应的数据库。
生成项目对应的数据表:
/*Table structure for table `t_sys_user` */
DROP TABLE IF EXISTS `t_sys_user`;
CREATE TABLE `t_sys_user` (
`user_id` varchar(20) NOT NULL COMMENT '用户id',
`user_name` varchar(50) COLLATE utf8_bin DEFAULT NULL COMMENT '用户名',
`password` varchar(50) COLLATE utf8_bin DEFAULT NULL COMMENT '密码',
`context` varchar(1000) COLLATE utf8_bin DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='用户信息表';
2.打开项目执行 test目录下的AppTest测试用例
\ No newline at end of file
package com.ces.mybatis;
package com.ces.mybatis;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import com.spring4all.swagger.EnableSwagger2Doc;
@EnableSwagger2Doc
@SpringBootApplication
@ComponentScan({"com.ces"})
@MapperScan("com.ces.*.dao")
public class Application
{
public static void main( String[] args )
{
SpringApplication.run(Application.class, args);
}
}
package com.ces.mybatis.dao;
package com.ces.mybatis.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ces.mybatis.model.User;
public interface IUserDao {
int insert(User user);
boolean insertOrUpdateByBatch(@Param("list")List<User> list);
int update(User user);
int delete(@Param("userId")String userId);
List<User> getAll();
User find(String userId);
}
package com.ces.mybatis.model;
package com.ces.mybatis.model;
public class Context {
private String province;
private String city;
private String district;
public Context() {
}
public Context(String username, String password, Boolean enabled, String context) {
this.province = username;
this.city = password;
this.district = password;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
}
\ No newline at end of file
package com.ces.mybatis.model;
package com.ces.mybatis.model;
public class User {
private String userId;
private String userName;
private String password;
private Context context;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Context getContext() {
return context;
}
public void setContext(Context context) {
this.context = context;
}
}
package com.ces.mybatis.service;
package com.ces.mybatis.service;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ces.mybatis.model.User;
public interface IUserService {
List<User> getAll();
int insert(User user);
int delete(String userId);
int update(User user);
User find(String userId);
boolean insertOrUpdateByBatch(List<User> list);
}
package com.ces.mybatis.service.impl;
package com.ces.mybatis.service.impl;
import java.util.List;
import com.ces.mybatis.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.ces.mybatis.dao.IUserDao;
import com.ces.mybatis.service.IUserService;
@Service
public class UserService implements IUserService {
private static final Logger LOGGER = LoggerFactory.getLogger(UserService.class);
@Autowired
private IUserDao userDao;
@Override
public List<User> getAll() {
return userDao.getAll();
}
@Override
public int insert(User user) {
return userDao.insert(user);
}
@Override
public int delete(String userId) {
return userDao.delete(userId);
}
@Override
public int update(User user) {
User userOutVo=null;
if(user!=null && !StringUtils.isEmpty(user.getUserId())) {
userOutVo=userDao.find(user.getUserId());
if(userOutVo!=null) {
LOGGER.info("用户名:"+user.getUserName());
userOutVo.setUserName(user.getUserName());
userOutVo.setPassword(user.getPassword());
userOutVo.setContext(user.getContext());
}
}
return userDao.update(userOutVo);
}
@Override
public User find(String userId) {
return userDao.find(userId);
}
@Override
public boolean insertOrUpdateByBatch(List<User> list) {
return userDao.insertOrUpdateByBatch(list);
}
}
package com.ces.mybatis.typeHandler;
package com.ces.mybatis.typeHandler;
import com.ces.mybatis.model.*;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import org.apache.ibatis.type.TypeHandler;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@MappedTypes({Context.class})
@MappedJdbcTypes({JdbcType.VARCHAR})
public class ContentTypeHandler implements TypeHandler<Context> {
@Override
public void setParameter(PreparedStatement preparedStatement, int i, Context context, JdbcType jdbcType) throws SQLException {
String s = JSONObject.toJSONString(context);
preparedStatement.setString(i, s);
}
@Override
public Context getResult(ResultSet rs, String columnName) throws SQLException {
String string = rs.getString(columnName);
return JSONObject.parseObject(string, Context.class);
}
@Override
public Context getResult(ResultSet rs, int columnIndex) throws SQLException {
String string = rs.getString(columnIndex);
return JSONObject.parseObject(string, Context.class);
}
@Override
public Context getResult(CallableStatement cs, int columnIndex) throws SQLException {
String string = cs.getString(columnIndex);
return JSONObject.parseObject(string, Context.class);
}
}
spring:
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/ces?useUnicode=true&characterEncoding=utf8&autoReconnect=true&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
validationQuery: SELECT 1
initialSize: 10
minIdle: 10
maxActive: 200
minEvictableIdleTimeMillis: 180000
testOnBorrow: false
testWhileIdle: true
removeAbandoned: true
removeAbandonedTimeout: 1800
logAbandoned: true
poolPreparedStatements: true
maxOpenPreparedStatements: 100
server:
port: 80
servlet-path: /
mybatis:
mapper-locations:
- classpath*:/mapper/*.xml
- classpath*:/com/ces/*/dao/*.xml
typeAliasesPackage: com.ces.*.model
type-handlers-package: com.ces.mybatis.typeHandler
configuration:
map-underscore-to-camel-case: true
lazy-loading-enabled: false
auto-mapping-behavior: full
useGeneratedKeys: true
useColumnLabel: true
mapUnderscoreToCamelCase: true
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?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.ces.mybatis.dao.IUserDao">
<resultMap id="BaseResultMap" type="com.ces.mybatis.model.User">
<id column="user_id" property="userId" />
<result column="user_name" property="userName" />
<result column="password" property="password" />
<result column="context" property="context" typeHandler="com.ces.mybatis.typeHandler.ContentTypeHandler"/>
</resultMap>
    <insert id="insert" useGeneratedKeys="true" keyProperty="userId" keyColumn="user_id" parameterType="com.ces.mybatis.model.User">
        insert into t_sys_user(user_id,user_name,password,context) values(#{userId},#{userName},#{password},#{context})
    </insert>
<insert id="insertOrUpdateByBatch" keyProperty="userId" useGeneratedKeys="true" keyColumn="user_id" >
insert into t_sys_user (user_id,user_name,password,context)
VALUES
<foreach item="user" index= "index" collection ="list" separator ="),(" open="(" close=")">
user.userId,user.userName,user.password,user.context
</foreach>
ON DUPLICATE KEY UPDATE
user_name = VALUES(user_name)
password = VALUES(password)
context = VALUES(context)
</insert>
    <update id="update" parameterType="com.ces.mybatis.model.User">
       update t_sys_user
       <set>
           <if test="userName != null">user_name=#{userName},</if>
           <if test="password != null">password=#{password},</if>
           <if test="context != null">context=#{context},</if>
       </set>
        where user_id=#{userId}
    </update>
    <delete id="delete">
        delete from t_sys_user where user_id=#{userId}
    </delete>
    <select id="getAll" resultType="com.ces.mybatis.model.User" >
       select user_id,user_name,password,context from t_sys_user order by user_id desc
    </select>
    <select id="find" resultType="com.ces.mybatis.model.User" >
        select user_id,user_name,password,context  from t_sys_user where user_id = #{userId}
    </select>
</mapper>
\ No newline at end of file
package com.ces.mybatis;
package com.ces.mybatis;
import java.util.ArrayList;
import java.util.List;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.TransactionIsolationLevel;
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.annotation.AnnotationConfigApplicationContext;
import org.springframework.test.context.junit4.SpringRunner;
import com.ces.mybatis.dao.IUserDao;
import com.ces.mybatis.model.Context;
import com.ces.mybatis.model.User;
import com.ces.mybatis.service.IUserService;
/**
* Unit test for simple App.
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
public class AppTest
{
private static final AnnotationConfigApplicationContext context =
new AnnotationConfigApplicationContext("application.yml");
// 注入“Converter”bean
@Autowired
private IUserService userService;
/**
* 1. 自定义TypeHandler类
*/
@Test
public void testa(){
List<User> user = userService.getAll();
System.out.println(user);
}
/**
* 2. Mybatis 批量插入数据库代码
*/
@Test
public void testb(){
SqlSessionFactory sqlSessionFactory = context
.getBean("sqlSessionFactory", SqlSessionFactory.class);
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
IUserDao mapper = sqlSession.getMapper(IUserDao.class);
List<User> users = new ArrayList<User>();
for(int i=0;i<3;i++){
User user = new User();
user.setUserId(String.valueOf(i));
user.setUserName("admin"+i);
user.setPassword("123");
Context context = new Context();
context.setCity("city");
context.setProvince("province");
context.setDistrict("district");
user.setContext(context);
users.add(user);
}
boolean isSuccess = mapper.insertOrUpdateByBatch(users);
System.out.println(isSuccess);
// 刷新
sqlSession.flushStatements();
}
}
spring:
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/ces?useUnicode=true&characterEncoding=utf8&autoReconnect=true&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
validationQuery: SELECT 1
initialSize: 10
minIdle: 10
maxActive: 200
minEvictableIdleTimeMillis: 180000
testOnBorrow: false
testWhileIdle: true
removeAbandoned: true
removeAbandonedTimeout: 1800
logAbandoned: true
poolPreparedStatements: true
maxOpenPreparedStatements: 100
server:
port: 80
servlet-path: /
mybatis:
mapper-locations:
- classpath*:/mapper/*.xml
- classpath*:/com/ces/*/dao/*.xml
typeAliasesPackage: com.ces.*.model
type-handlers-package: com.ces.mybatis.typeHandler
configuration:
map-underscore-to-camel-case: true
lazy-loading-enabled: false
auto-mapping-behavior: full
useGeneratedKeys: true
useColumnLabel: true
mapUnderscoreToCamelCase: true
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?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.ces.mybatis.dao.IUserDao">
<resultMap id="BaseResultMap" type="com.ces.mybatis.model.User">
<id column="user_id" property="userId" />
<result column="user_name" property="userName" />
<result column="password" property="password" />
<result column="context" property="context" typeHandler="com.ces.mybatis.typeHandler.ContentTypeHandler"/>
</resultMap>
    <insert id="insert" useGeneratedKeys="true" keyProperty="userId" keyColumn="user_id" parameterType="com.ces.mybatis.model.User">
        insert into t_sys_user(user_id,user_name,password,context) values(#{userId},#{userName},#{password},#{context})
    </insert>
<insert id="insertOrUpdateByBatch" keyProperty="userId" useGeneratedKeys="true" keyColumn="user_id" >
insert into t_sys_user (user_id,user_name,password,context)
VALUES
<foreach item="user" index= "index" collection ="list" separator ="),(" open="(" close=")">
user.userId,user.userName,user.password,user.context
</foreach>
ON DUPLICATE KEY UPDATE
user_name = VALUES(user_name)
password = VALUES(password)
context = VALUES(context)
</insert>
    <update id="update" parameterType="com.ces.mybatis.model.User">
       update t_sys_user
       <set>
           <if test="userName != null">user_name=#{userName},</if>
           <if test="password != null">password=#{password},</if>
           <if test="context != null">context=#{context},</if>
       </set>
        where user_id=#{userId}
    </update>
    <delete id="delete">
        delete from t_sys_user where user_id=#{userId}
    </delete>
    <select id="getAll" resultType="com.ces.mybatis.model.User" >
       select user_id,user_name,password,context from t_sys_user order by user_id desc
    </select>
    <select id="find" resultType="com.ces.mybatis.model.User" >
        select user_id,user_name,password,context  from t_sys_user where user_id = #{userId}
    </select>
</mapper>
\ No newline at end of file
++ "b/\350\242\201\345\225\237\347\253\240_Mybatis1/.gitkeep"
11.28作业
11.28作业
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment