Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybatis_self
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘凯
mybatis_self
Commits
b670cd8e
Commit
b670cd8e
authored
Feb 25, 2020
by
刘凯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
b8ac6908
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
592 additions
and
365 deletions
+592
-365
pom.xml
pom.xml
+383
-365
Main.java
src/main/java/com/liukai/demo/Main.java
+44
-0
MyStringHandler.java
src/main/java/com/liukai/demo/MyStringHandler.java
+50
-0
Role.java
src/main/java/com/liukai/demo/Role.java
+36
-0
RoleMapper.java
src/main/java/com/liukai/demo/RoleMapper.java
+11
-0
RoleMapper.xml
src/main/java/com/liukai/demo/RoleMapper.xml
+31
-0
log4j.properties
src/main/resources/log4j.properties
+5
-0
mybatis-config.xml
src/main/resources/mybatis-config.xml
+32
-0
No files found.
pom.xml
View file @
b670cd8e
...
...
@@ -15,387 +15,405 @@
limitations under the License.
-->
<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>
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>
<parent>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis-parent
</artifactId>
<version>
32-SNAPSHOT
</version>
</parent>
<parent>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis-parent
</artifactId>
<version>
32-SNAPSHOT
</version>
</parent>
<artifactId>
mybatis
</artifactId>
<version>
3.3.0-SNAPSHOT
</version>
<packaging>
jar
</packaging>
<artifactId>
mybatis
</artifactId>
<version>
3.3.0-SNAPSHOT
</version>
<packaging>
jar
</packaging>
<name>
mybatis
</name>
<description>
The MyBatis data mapper framework makes it easier to use a relational database with object-oriented
applications. MyBatis couples objects with stored procedures or SQL statements using a XML descriptor or
annotations. Simplicity is the biggest advantage of the MyBatis data mapper over object relational mapping
tools.
</description>
<url>
http://www.mybatis.org/core/
</url>
<name>
mybatis
</name>
<description>
The MyBatis data mapper framework makes it easier to use a relational database with object-oriented
applications. MyBatis couples objects with stored procedures or SQL statements using a XML descriptor or
annotations. Simplicity is the biggest advantage of the MyBatis data mapper over object relational mapping
tools.
</description>
<url>
http://www.mybatis.org/core/
</url>
<contributors>
<contributor>
<name>
Adam Gent
</name>
<email>
adam.gent@evocatus.com
</email>
</contributor>
<contributor>
<name>
Andrea Selva
</name>
<email>
selva.andre@gmail.com
</email>
</contributor>
<contributor>
<name>
Antonio Sánchez
</name>
<email>
juntandolineas@gmail.com
</email>
</contributor>
<contributor>
<name>
Arkadi Shishlov
</name>
<email>
arkadi.shishlov@gmail.com
</email>
</contributor>
<contributor>
<name>
Axel Doerfler
</name>
<email>
axel.doerfler@gmail.com
</email>
</contributor>
<contributor>
<name>
Chris Dadej
</name>
<email>
chris.dadej@gmail.com
</email>
</contributor>
<contributor>
<name>
Denis Vygovskiy
</name>
<email>
qizant@gmail.com
</email>
</contributor>
<contributor>
<name>
Franta Mejta
</name>
<email>
mejta@rewor.cz
</email>
</contributor>
<contributor>
<name>
Jurriaan Pruys
</name>
<email>
jurriaan@pruys.com
</email>
</contributor>
<contributor>
<name>
Keith Wong
</name>
<email>
wongkwl@gmail.com
</email>
</contributor>
<contributor>
<name>
Lasse Voss
</name>
<email>
lasse.voss@motor-talk-gmbh.de
</email>
</contributor>
<contributor>
<name>
Luke Stevens
</name>
<email>
nosuchluke@gmail.com
</email>
</contributor>
<contributor>
<name>
Paul Krause
</name>
<email>
paulkrause88@alum.mit.edu
</email>
</contributor>
<contributor>
<name>
Peter Leibiger
</name>
<email>
kuhnroyal@gmail.com
</email>
</contributor>
<contributor>
<name>
Riccardo Cossu
</name>
<email>
riccardo.cossu@gmail.com
</email>
</contributor>
<contributor>
<name>
Tomáš Neuberg
</name>
<email>
neuberg@m-atelier.cz
</email>
</contributor>
</contributors>
<contributors>
<contributor>
<name>
Adam Gent
</name>
<email>
adam.gent@evocatus.com
</email>
</contributor>
<contributor>
<name>
Andrea Selva
</name>
<email>
selva.andre@gmail.com
</email>
</contributor>
<contributor>
<name>
Antonio Sánchez
</name>
<email>
juntandolineas@gmail.com
</email>
</contributor>
<contributor>
<name>
Arkadi Shishlov
</name>
<email>
arkadi.shishlov@gmail.com
</email>
</contributor>
<contributor>
<name>
Axel Doerfler
</name>
<email>
axel.doerfler@gmail.com
</email>
</contributor>
<contributor>
<name>
Chris Dadej
</name>
<email>
chris.dadej@gmail.com
</email>
</contributor>
<contributor>
<name>
Denis Vygovskiy
</name>
<email>
qizant@gmail.com
</email>
</contributor>
<contributor>
<name>
Franta Mejta
</name>
<email>
mejta@rewor.cz
</email>
</contributor>
<contributor>
<name>
Jurriaan Pruys
</name>
<email>
jurriaan@pruys.com
</email>
</contributor>
<contributor>
<name>
Keith Wong
</name>
<email>
wongkwl@gmail.com
</email>
</contributor>
<contributor>
<name>
Lasse Voss
</name>
<email>
lasse.voss@motor-talk-gmbh.de
</email>
</contributor>
<contributor>
<name>
Luke Stevens
</name>
<email>
nosuchluke@gmail.com
</email>
</contributor>
<contributor>
<name>
Paul Krause
</name>
<email>
paulkrause88@alum.mit.edu
</email>
</contributor>
<contributor>
<name>
Peter Leibiger
</name>
<email>
kuhnroyal@gmail.com
</email>
</contributor>
<contributor>
<name>
Riccardo Cossu
</name>
<email>
riccardo.cossu@gmail.com
</email>
</contributor>
<contributor>
<name>
Tomáš Neuberg
</name>
<email>
neuberg@m-atelier.cz
</email>
</contributor>
</contributors>
<scm>
<url>
http://github.com/mybatis/mybatis-3
</url>
<connection>
scm:git:ssh://github.com/mybatis/mybatis-3.git
</connection>
<developerConnection>
scm:git:git+ssh://git@github.com/mybatis/mybatis-3.git
</developerConnection>
<tag>
HEAD
</tag>
</scm>
<issueManagement>
<system>
GitHub Issue Management
</system>
<url>
https://github.com/mybatis/mybatis-3/issues
</url>
</issueManagement>
<ciManagement>
<system>
Travis CI
</system>
<url>
https://travis-ci.org/mybatis/mybatis-3/
</url>
</ciManagement>
<distributionManagement>
<site>
<id>
github
</id>
<url>
gitsite:git@github.com/mybatis/mybatis-3.git
</url>
</site>
</distributionManagement>
<scm>
<url>
http://github.com/mybatis/mybatis-3
</url>
<connection>
scm:git:ssh://github.com/mybatis/mybatis-3.git
</connection>
<developerConnection>
scm:git:git+ssh://git@github.com/mybatis/mybatis-3.git
</developerConnection>
<tag>
HEAD
</tag>
</scm>
<issueManagement>
<system>
GitHub Issue Management
</system>
<url>
https://github.com/mybatis/mybatis-3/issues
</url>
</issueManagement>
<ciManagement>
<system>
Travis CI
</system>
<url>
https://travis-ci.org/mybatis/mybatis-3/
</url>
</ciManagement>
<distributionManagement>
<site>
<id>
github
</id>
<url>
gitsite:git@github.com/mybatis/mybatis-3.git
</url>
</site>
</distributionManagement>
<properties>
<clirr.comparisonVersion>
3.2.7
</clirr.comparisonVersion>
<findbugs.onlyAnalyze>
org.apache.ibatis.*
</findbugs.onlyAnalyze>
<osgi.export>
org.apache.ibatis.*;version=${project.version};-noimport:=true
</osgi.export>
<osgi.import>
*;resolution:=optional
</osgi.import>
<osgi.dynamicImport>
*
</osgi.dynamicImport>
</properties>
<properties>
<clirr.comparisonVersion>
3.2.7
</clirr.comparisonVersion>
<findbugs.onlyAnalyze>
org.apache.ibatis.*
</findbugs.onlyAnalyze>
<osgi.export>
org.apache.ibatis.*;version=${project.version};-noimport:=true
</osgi.export>
<osgi.import>
*;resolution:=optional
</osgi.import>
<osgi.dynamicImport>
*
</osgi.dynamicImport>
</properties>
<dependencies>
<dependency>
<groupId>
ognl
</groupId>
<artifactId>
ognl
</artifactId>
<version>
3.0.8
</version>
<scope>
provided
</scope>
<optional>
true
</optional>
<exclusions>
<exclusion>
<groupId>
javassist
</groupId>
<dependencies>
<dependency>
<groupId>
ognl
</groupId>
<artifactId>
ognl
</artifactId>
<version>
3.0.8
</version>
<scope>
provided
</scope>
<optional>
true
</optional>
<exclusions>
<exclusion>
<groupId>
javassist
</groupId>
<artifactId>
javassist
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.javassist
</groupId>
<artifactId>
javassist
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.javassist
</groupId>
<artifactId>
javassist
</artifactId>
<version>
3.18.2-GA
</version>
<scope>
provided
</scope>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-api
</artifactId>
<version>
1.7.7
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
<version>
1.7.7
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
1.2.17
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-core
</artifactId>
<version>
2.1
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
commons-logging
</groupId>
<artifactId>
commons-logging
</artifactId>
<version>
1.2
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
cglib
</groupId>
<artifactId>
cglib
</artifactId>
<version>
3.1
</version>
<optional>
true
</optional>
</dependency>
<version>
3.18.2-GA
</version>
<scope>
provided
</scope>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-api
</artifactId>
<version>
1.7.7
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
<version>
1.7.7
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
1.2.17
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-core
</artifactId>
<version>
2.1
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
commons-logging
</groupId>
<artifactId>
commons-logging
</artifactId>
<version>
1.2
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
cglib
</groupId>
<artifactId>
cglib
</artifactId>
<version>
3.1
</version>
<optional>
true
</optional>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.hsqldb
</groupId>
<artifactId>
hsqldb
</artifactId>
<version>
2.3.2
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.derby
</groupId>
<artifactId>
derby
</artifactId>
<version>
10.11.1.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.mockito
</groupId>
<artifactId>
mockito-core
</artifactId>
<version>
1.10.8
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
commons-dbcp
</groupId>
<artifactId>
commons-dbcp
</artifactId>
<version>
1.4
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
javax.transaction
</groupId>
<artifactId>
transaction-api
</artifactId>
<version>
1.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.velocity
</groupId>
<artifactId>
velocity
</artifactId>
<version>
1.7
</version>
<scope>
test
</scope>
</dependency>
<!-- postgresql driver is required to run the refcursor tests -->
<dependency>
<groupId>
postgresql
</groupId>
<artifactId>
postgresql
</artifactId>
<version>
9.1-901-1.jdbc4
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<configuration>
<systemProperties>
<property>
<name>
derby.stream.error.file
</name>
<value>
target/derby.log
</value>
</property>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-pdf-plugin
</artifactId>
</plugin>
<plugin>
<groupId>
org.sonatype.plugins
</groupId>
<artifactId>
jarjar-maven-plugin
</artifactId>
<version>
1.9
</version>
<configuration>
<input>
{classes}
</input>
<input>
{test-classes}
</input>
<includes>
<include>
ognl:ognl
</include>
<include>
org.javassist:javassist
</include>
</includes>
<rules>
<rule>
<pattern>
ognl.**
</pattern>
<result>
org.apache.ibatis.ognl.@1
</result>
</rule>
<rule>
<pattern>
javassist.**
</pattern>
<result>
org.apache.ibatis.javassist.@1
</result>
</rule>
<keep>
<pattern>
org.apache.ibatis.**
</pattern>
</keep>
</rules>
<overwrite>
true
</overwrite>
</configuration>
<executions>
<execution>
<id>
jarjar-classes
</id>
<phase>
process-test-classes
</phase>
<goals>
<goal>
jarjar
</goal>
</goals>
<configuration>
<input>
{classes}
</input>
</configuration>
</execution>
<execution>
<id>
jarjar-test-classes
</id>
<phase>
process-test-classes
</phase>
<goals>
<goal>
jarjar
</goal>
</goals>
<configuration>
<input>
{test-classes}
</input>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-site-plugin
</artifactId>
<configuration>
<locales>
en,es,ja,fr,zh_CN,ko
</locales>
</configuration>
</plugin>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
cobertura-maven-plugin
</artifactId>
<version>
2.7
</version>
<configuration>
<instrumentation>
<ignores>
<ignore>
org.apache.ibatis.ognl.*
</ignore>
<ignore>
org.apache.ibatis.javassist.*
</ignore>
</ignores>
<excludes>
<exclude>
org/apache/ibatis/ognl/**/*.class
</exclude>
<exclude>
org/apache/ibatis/javassist/**/*.class
</exclude>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<goals>
<goal>
clean
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>
${project.basedir}
</directory>
<targetPath>
META-INF
</targetPath>
<includes>
<include>
LICENSE
</include>
<include>
NOTICE
</include>
</includes>
</resource>
<resource>
<directory>
${project.build.sourceDirectory}
</directory>
<excludes>
<exclude>
**/*.java
</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>
${project.build.testSourceDirectory}
</directory>
<excludes>
<exclude>
**/*.java
</exclude>
</excludes>
</testResource>
</testResources>
<pluginManagement>
<!-- Test dependencies -->
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.hsqldb
</groupId>
<artifactId>
hsqldb
</artifactId>
<version>
2.3.2
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
6.0.6
</version>
</dependency>
<dependency>
<groupId>
org.apache.derby
</groupId>
<artifactId>
derby
</artifactId>
<version>
10.11.1.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.mockito
</groupId>
<artifactId>
mockito-core
</artifactId>
<version>
1.10.8
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.javassist
</groupId>
<artifactId>
javassist
</artifactId>
<version>
3.21.0-GA
</version>
</dependency>
<dependency>
<groupId>
commons-dbcp
</groupId>
<artifactId>
commons-dbcp
</artifactId>
<version>
1.4
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
javax.transaction
</groupId>
<artifactId>
transaction-api
</artifactId>
<version>
1.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.velocity
</groupId>
<artifactId>
velocity
</artifactId>
<version>
1.7
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
ognl
</groupId>
<artifactId>
ognl
</artifactId>
<version>
3.2
</version>
</dependency>
<!-- postgresql driver is required to run the refcursor tests -->
<dependency>
<groupId>
postgresql
</groupId>
<artifactId>
postgresql
</artifactId>
<version>
9.1-901-1.jdbc4
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>
org.eclipse.m2e
</groupId>
<artifactId>
lifecycle-mapping
</artifactId>
<version>
1.0.0
</version>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<configuration>
<systemProperties>
<property>
<name>
derby.stream.error.file
</name>
<value>
target/derby.log
</value>
</property>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-pdf-plugin
</artifactId>
</plugin>
<plugin>
<groupId>
org.sonatype.plugins
</groupId>
<artifactId>
jarjar-maven-plugin
</artifactId>
<version>
1.9
</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.sonatype.plugins
</groupId>
<artifactId>
jarjar-maven-plugin
</artifactId>
<versionRange>
[1.9,)
</versionRange>
<goals>
<goal>
jarjar
</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
<input>
{classes}
</input>
<input>
{test-classes}
</input>
<includes>
<include>
ognl:ognl
</include>
<include>
org.javassist:javassist
</include>
</includes>
<rules>
<rule>
<pattern>
ognl.**
</pattern>
<result>
org.apache.ibatis.ognl.@1
</result>
</rule>
<rule>
<pattern>
javassist.**
</pattern>
<result>
org.apache.ibatis.javassist.@1
</result>
</rule>
<keep>
<pattern>
org.apache.ibatis.**
</pattern>
</keep>
</rules>
<overwrite>
true
</overwrite>
</configuration>
<executions>
<execution>
<id>
jarjar-classes
</id>
<phase>
process-test-classes
</phase>
<goals>
<goal>
jarjar
</goal>
</goals>
<configuration>
<input>
{classes}
</input>
</configuration>
</execution>
<execution>
<id>
jarjar-test-classes
</id>
<phase>
process-test-classes
</phase>
<goals>
<goal>
jarjar
</goal>
</goals>
<configuration>
<input>
{test-classes}
</input>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-site-plugin
</artifactId>
<configuration>
<locales>
en,es,ja,fr,zh_CN,ko
</locales>
</configuration>
</plugin>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
cobertura-maven-plugin
</artifactId>
<version>
2.7
</version>
<configuration>
<instrumentation>
<ignores>
<ignore>
org.apache.ibatis.ognl.*
</ignore>
<ignore>
org.apache.ibatis.javassist.*
</ignore>
</ignores>
<excludes>
<exclude>
org/apache/ibatis/ognl/**/*.class
</exclude>
<exclude>
org/apache/ibatis/javassist/**/*.class
</exclude>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<goals>
<goal>
clean
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<resources>
<resource>
<directory>
${project.basedir}
</directory>
<targetPath>
META-INF
</targetPath>
<includes>
<include>
LICENSE
</include>
<include>
NOTICE
</include>
</includes>
</resource>
<resource>
<directory>
${project.build.sourceDirectory}
</directory>
<excludes>
<exclude>
**/*.java
</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>
${project.build.testSourceDirectory}
</directory>
<excludes>
<exclude>
**/*.java
</exclude>
</excludes>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>
org.eclipse.m2e
</groupId>
<artifactId>
lifecycle-mapping
</artifactId>
<version>
1.0.0
</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.sonatype.plugins
</groupId>
<artifactId>
jarjar-maven-plugin
</artifactId>
<versionRange>
[1.9,)
</versionRange>
<goals>
<goal>
jarjar
</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
src/main/java/com/liukai/demo/Main.java
0 → 100644
View file @
b670cd8e
package
com
.
liukai
.
demo
;
import
org.apache.ibatis.io.Resources
;
import
org.apache.ibatis.session.SqlSession
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.apache.ibatis.session.SqlSessionFactoryBuilder
;
import
java.io.IOException
;
import
java.io.InputStream
;
/**
* @author liukai
* @Description: TODO
* @date 2020/2/254:41 下午
*/
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
String
resource
=
"mybatis-config.xml"
;
InputStream
inputStream
=
null
;
try
{
inputStream
=
Resources
.
getResourceAsStream
(
resource
);
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
SqlSessionFactory
sqlSessionFactory
=
null
;
sqlSessionFactory
=
new
SqlSessionFactoryBuilder
().
build
(
inputStream
);
SqlSession
sqlSession
=
null
;
try
{
sqlSession
=
sqlSessionFactory
.
openSession
();
RoleMapper
roleMapper
=
sqlSession
.
getMapper
(
RoleMapper
.
class
);
Role
role
=
roleMapper
.
getRole
(
1L
);
System
.
out
.
println
(
role
.
getId
()+
":"
+
role
.
getRoleName
()+
":"
+
role
.
getNote
());
sqlSession
.
commit
();
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
sqlSession
.
rollback
();
e
.
printStackTrace
();
}
finally
{
sqlSession
.
close
();
}
}
}
src/main/java/com/liukai/demo/MyStringHandler.java
0 → 100644
View file @
b670cd8e
package
com
.
liukai
.
demo
;
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
org.apache.log4j.Logger
;
import
java.sql.CallableStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
/**
* @author liukai
* @Description: TODO
* @date 2020/2/254:41 下午
*/
@MappedTypes
({
String
.
class
})
@MappedJdbcTypes
(
JdbcType
.
VARCHAR
)
public
class
MyStringHandler
implements
TypeHandler
<
String
>
{
private
Logger
log
=
Logger
.
getLogger
(
MyStringHandler
.
class
);
@Override
public
String
getResult
(
ResultSet
rs
,
String
colName
)
throws
SQLException
{
log
.
info
(
"使用我的TypeHandler,ResultSet列名获取字符串"
);
return
rs
.
getString
(
colName
);
}
@Override
public
String
getResult
(
ResultSet
rs
,
int
index
)
throws
SQLException
{
log
.
info
(
"使用我的TypeHandler,ResultSet下标获取字符串"
);
return
rs
.
getString
(
index
);
}
@Override
public
String
getResult
(
CallableStatement
cs
,
int
index
)
throws
SQLException
{
log
.
info
(
"使用我的TypeHandler,CallableStatement下标获取字符串"
);
return
cs
.
getString
(
index
);
}
@Override
public
void
setParameter
(
PreparedStatement
ps
,
int
index
,
String
value
,
JdbcType
arg3
)
throws
SQLException
{
log
.
info
(
"使用我的TypeHandler"
);
ps
.
setString
(
index
,
value
);
}
}
src/main/java/com/liukai/demo/Role.java
0 → 100644
View file @
b670cd8e
package
com
.
liukai
.
demo
;
/**
* @author liukai
* @Description: TODO
* @date 2020/2/254:44 下午
*/
public
class
Role
{
private
long
id
;
private
String
roleName
;
private
String
note
;
public
long
getId
()
{
return
id
;
}
public
void
setId
(
long
id
)
{
this
.
id
=
id
;
}
public
String
getRoleName
()
{
return
roleName
;
}
public
void
setRoleName
(
String
roleName
)
{
this
.
roleName
=
roleName
;
}
public
String
getNote
()
{
return
note
;
}
public
void
setNote
(
String
note
)
{
this
.
note
=
note
;
}
}
src/main/java/com/liukai/demo/RoleMapper.java
0 → 100644
View file @
b670cd8e
package
com
.
liukai
.
demo
;
/*
* @author gethin
*/
public
interface
RoleMapper
{
public
Role
getRole
(
Long
id
);
public
Role
findRole
(
String
roleName
);
public
int
deleteRole
(
Long
id
);
public
int
insertRole
(
Role
role
);
}
src/main/java/com/liukai/demo/RoleMapper.xml
0 → 100644
View file @
b670cd8e
<?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.liukai.demo.RoleMapper"
>
<resultMap
type=
"role"
id=
"roleMap"
>
<id
column=
"id"
property=
"id"
javaType=
"long"
jdbcType=
"BIGINT"
/>
<result
column=
"role_name"
property=
"roleName"
javaType=
"string"
jdbcType=
"VARCHAR"
/>
<result
column=
"note"
property=
"note"
typeHandler=
"com.liukai.demo.MyStringHandler"
/>
</resultMap>
<select
id=
"getRole"
parameterType=
"long"
resultMap=
"roleMap"
>
select
id,role_name as roleName,note from role where id=#{id}
</select>
<select
id=
"findRole"
parameterType=
"long"
resultMap=
"roleMap"
>
select
id,role_name,note from role where role_name like CONCAT('%',#{roleName
javaType=string,
jdbcType=VARCHAR,typeHandler=com.liukai.demo.MyStringHandler},'%')
</select>
<insert
id=
"insertRole"
parameterType=
"role"
>
insert into
role(role_name,note) value(#{roleName},#{note})
</insert>
<delete
id=
"deleteRole"
parameterType=
"long"
>
delete from role where
id=#{id}
</delete>
</mapper>
\ No newline at end of file
src/main/resources/log4j.properties
0 → 100644
View file @
b670cd8e
log4j.rootLogger
=
DEBUG,stdout
log4j.logger.org.mybatis
=
DUBUG
log4j.appender.stdout
=
org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout
=
org.apache.log4j.PatternLayout
log4j.appender.logDailyFile.layout.ConversionPattern
=
%5p %d %C:%m%n
src/main/resources/mybatis-config.xml
0 → 100644
View file @
b670cd8e
<?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="lazyLoadingEnabled" value="true"/>–>
<!– <setting name="aggressiveLazyLoading" value="false"/> –>
</settings>-->
<typeAliases>
<typeAlias
alias=
"role"
type=
"com.liukai.demo.Role"
/>
</typeAliases>
<typeHandlers>
<typeHandler
jdbcType=
"VARCHAR"
javaType=
"string"
handler=
"com.liukai.demo.MyStringHandler"
/>
</typeHandlers>
<!-- 定义数据库的信息,默认使用development数据库构建环境 -->
<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://dev.config.duibar.com:3306/test"
/>
<property
name=
"username"
value=
"dev"
/>
<property
name=
"password"
value=
"dev_fas015"
/>
</dataSource>
</environment>
</environments>
<!-- 定义映射器 -->
<mappers>
<package
name=
"com.liukai.demo"
/>
</mappers>
</configuration>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment