8000 更新通用Mapper3.1.3-SNAPSHOT · coderhxt/Mybatis-Spring@d54ed9c · GitHub
[go: up one dir, main page]

Skip to content

Commit d54ed9c

Browse files
committed
更新通用Mapper3.1.3-SNAPSHOT
1 parent c970885 commit d54ed9c

File tree

3 files changed

+83
-78
lines changed

3 files changed

+83
-78
lines changed

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.isea533</groupId>
@@ -22,8 +22,8 @@
2222
<!-- 编译jdk版本 -->
2323
<jdk.version>1.6</jdk.version>
2424
<!-- 依赖版本 -->
25-
<mapper.version>3.1.0</mapper.version>
26-
<pagehelper.version>3.7.4</pagehelper.version>
25+
<mapper.version>3.1.3-SNAPSHOT</mapper.version>
26+
<pagehelper.version>4.0.0</pagehelper.version>
2727
<mysql.version>5.1.29</mysql.version>
2828
<spring.version>4.1.2.RELEASE</spring.version>
2929
</properties>
@@ -171,7 +171,7 @@
171171
<dependency>
172172
<groupId>org.mybatis</groupId>
173173
<artifactId>mybatis-spring</artifactId>
174-
<version>1.2.2</version>
174+
<version>1.2.3</version>
175175
</dependency>
176176
<!-- Mybatis Generator -->
177177
<dependency>

src/main/resources/applicationContext.xml

Lines changed: 74 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
~ THE SOFTWARE.
2424
-->
2525

26-
<beans xmlns="http://www.springframework.org/schema/beans"
27-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
26+
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2827
xmlns:tx="http://www.springframework.org/schema/tx"
2928
xmlns:aop="http://www.springframework.org/schema/aop"
3029
xmlns:context="http://www.springframework.org/schema/context"
30+
xmlns="http://www.springframework.org/schema/beans"
3131
xsi:schemaLocation="http://www.springframework.org/schema/beans
3232
http://www.springframework.org/schema/beans/spring-beans.xsd
3333
http://www.springframework.org/schema/tx
@@ -37,88 +37,89 @@
3737
http://www.springframework.org/schema/context
3838
http://www.springframework.org/schema/context/spring-context.xsd">
3939

40-
<context:component-scan base-package="com.isea533.mybatis.service"/>
40+
<context:component-scan base-package="com.isea533.mybatis.service"/>
4141

42-
<context:property-placeholder location="classpath:config.properties"/>
42+
<context:property-placeholder location="classpath:config.properties"/>
4343

44-
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
45-
<property name="driverClassName" value="${jdbc.driverClass}"/>
46-
<property name="url" value="${jdbc.url}" />
47-
<property name="username" value="${jdbc.user}"/>
48-
<property name="password" value="${jdbc.password}" />
44+
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
45+
<property name="driverClassName" value="${jdbc.driverClass}"/>
46+
<property name="url" value="${jdbc.url}"/>
47+
<property name="username" value="${jdbc.user}"/>
48+
<property name="password" value="${jdbc.password}"/>
4949

50-
<property name="filters" value="stat" />
50+
<property name="filters" value="stat"/>
5151

52-
<property name="maxActive" value="20"/>
53-
<property name="initialSize" value="1"/>
54-
<property name="maxWait" value="60000"/>
55-
<property name="minIdle" value="1"/>
52+
<property name="maxActive" value="20"/>
53+
<property name="initialSize" value="1"/>
54+
<property name="maxWait" value="60000"/>
55+
<property name="minIdle" value="1"/>
5656

57-
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
58-
<property name="minEvictableIdleTimeMillis" value="300000"/>
57+
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
58+
<property name="minEvictableIdleTimeMillis" value="300000"/>
5959

60-
<property name="validationQuery" value="SELECT 'x'"/>
61-
<property name="testWhileIdle" value="true"/>
62-
<property name="testOnBorrow" value="false"/>
63-
<property name="testOnReturn" value="false"/>
64-
</bean>
60+
<property name="validationQuery" value="SELECT 'x'"/>
61+
<property name="testWhileIdle" value="true"/>
62+
<property name="testOnBorrow" value="false"/>
63+
<property name="testOnReturn" value="false"/>
64+
</bean>
6565

66-
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
67-
<property name="dataSource" ref="dataSource"/>
68-
<property name="mapperLocations">
69-
<array>
70-
<value>classpath:mapper/*.xml</value>
71-
</array>
72-
</property>
73-
<property name="typeAliasesPackage" value="com.isea533.mybatis.model"/>
74-
<property name="plugins">
75-
<array>
76-
<bean class="com.github.pagehelper.PageHelper">
77-
<property name="properties">
78-
<value>
79-
dialect=mysql
80-
reasonable=true
81-
</value>
82-
</property>
83-
</bean>
84-
<bean class="tk.mybatis.mapper.mapperhelper.MapperInterceptor">
85-
<property name="properties">
86-
<value>
87-
mappers=tk.mybatis.mapper.common.Mapper
88-
IDENTITY=MYSQL
89-
notEmpty=true
90-
</value>
91-
</property>
92-
</bean>
93-
</array>
94-
</property>
95-
</bean>
66+
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
67+
<property name="dataSource" ref="dataSource"/>
68+
<property name="mapperLocations">
69+
<array>
70+
<value>classpath:mapper/*.xml</value>
71+
</array>
72+
</property>
73+
<property name="typeAliasesPackage" value="com.isea533.mybatis.model"/>
74+
<property name="plugins">
75+
<array>
76+
<bean class="com.github.pagehelper.PageHelper">
77+
<property name="properties">
78+
<value>
79+
dialect=mysql
80+
reasonable=true
81+
</value>
82+
</property>
83+
</bean>
84+
<bean class="tk.mybatis.mapper.mapperhelper.MapperOnceInterceptor">
85+
<property name="properties">
86+
<value>
87+
mappers=tk.mybatis.mapper.common.Mapper
88+
IDENTITY=MYSQL
89+
notEmpty=true
90+
</value>
91+
</property>
92+
</bean>
93+
</array>
94+
</property>
95+
</bean>
9696

97-
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
98-
<property name="basePackage" value="com.isea533.mybatis.mapper"/>
99-
</bean>
97+
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
98+
<property name="addToConfig" value="true"/>
99+
<property name="basePackage" value="com.isea533.mybatis.mapper"/>
100+
</bean>
100101

101-
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
102-
<constructor-arg index="0" ref="sqlSessionFactory"/>
103-
</bean>
102+
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
103+
<constructor-arg index="0" ref="sqlSessionFactory"/>
104+
</bean>
104105

105-
<aop:aspectj-autoproxy/>
106+
<aop:aspectj-autoproxy/>
106107

107-
<aop:config>
108-
<aop:pointcut id="appService" expression="execution(* com.isea533.mybatis.service..*Service*.*(..))"/>
109-
<aop:advisor advice-ref="txAdvice" pointcut-ref="appService"/>
110-
</aop:config>
108+
<aop:config>
109+
<aop:pointcut id="appService" expression="execution(* com.isea533.mybatis.service..*Service*.*(..))"/>
110+
<aop:advisor advice-ref="txAdvice" pointcut-ref="appService"/>
111+
</aop:config>
111112

112-
<tx:advice id="txAdvice" transaction-manager="transactionManager">
113-
<tx:attributes>
114-
<tx:method name="select*" read-only="true"/>
115-
<tx:method name="find*" read-only="true"/>
116-
<tx:method name="get*" read-only="true"/>
117-
<tx:method name="*"/>
118-
</tx:attributes>
119-
</tx:advice>
113+
<tx:advice id="txAdvice" transaction-manager="transactionManager">
114+
<tx:attributes>
115+
<tx:method name="select*" read-only="true"/>
116+
<tx:method name="find*" read-only="true"/>
117+
<tx:method name="get*" read-only="true"/>
118+
<tx:method name="*"/>
119+
</tx:attributes>
120+
</tx:advice>
120121

121-
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
122-
<property name="dataSource" ref="dataSource"/>
123-
</bean>
122+
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
123+
<property name="dataSource" ref="dataSource"/>
124+
</bean>
124125
</beans>

src/test/java/com/isea533/mybatis/test/PageMapperTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424

2525
package com.isea533.mybatis.test;
2626

27-
import tk.mybatis.mapper.entity.Example;
2827
import com.github.pagehelper.PageHelper;
2928
import com.github.pagehelper.PageInfo;
3029
import com.isea533.mybatis.mapper.CountryMapper;
3130
import com.isea533.mybatis.model.Country;
3231
import org.junit.Test;
3332
import org.springframework.beans.factory.annotation.Autowired;
33+
import tk.mybatis.mapper.entity.Example;
3434

3535
import java.util.List;
3636

@@ -50,5 +50,9 @@ public void test(){
5050
List<Country> countries = countryMapper.selectByExample(example);
5151
PageInfo<Country> pageInfo = new PageInfo<Country>(countries);
5252
System.out.println(pageInfo.getTotal());
53+
54+
countries = countryMapper.selectByExample(example);
55+
pageInfo = new PageInfo<Country>(countries);
56+
System.out.println(pageInfo.getTotal());
5357
}
5458
}

0 commit comments

Comments
 (0)
0