8000 增加测试,修改拦截器配置顺序错误。 · coderhxt/Mybatis-Spring@9179ddc · GitHub
[go: up one dir, main page]

Skip to content

Commit 9179ddc

Browse files
committed
增加测试,修改拦截器配置顺序错误。
1 parent b0cd1c6 commit 9179ddc

File tree

3 files changed

+63
-8
lines changed

3 files changed

+63
-8
lines changed

src/main/resources/applicationContext.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,20 @@
7373
<property name="typeAliasesPackage" value="com.isea533.mybatis.model"/>
7474
<property name="plugins">
7575
<array>
76-
<bean class="com.github.abel533.mapperhelper.MapperInterceptor">
76+
<bean class="com.github.pagehelper.PageHelper">
7777
<property name="properties">
7878
<value>
79-
mappers=com.github.abel533.mapper.Mapper
80-
IDENTITY=MYSQL
81-
notEmpty=true
79+
dialect=hsqldb
80+
reasonable=true
8281
</value>
8382
</property>
8483
</bean>
85-
<bean class="com.github.pagehelper.PageHelper">
84+
<bean class="com.github.abel533.mapperhelper.MapperInterceptor">
8685
<property name="properties">
8786
<value>
88-
dialect=hsqldb
89-
reasonable=true
87+
mappers=com.github.abel533.mapper.Mapper
88+
IDENTITY=MYSQL
89+
notEmpty=true
9090
</value>
9191
</property>
9292
</bean>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2014 abel533@gmail.com
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
25+
package com.isea533.mybatis.test;
26+
27+
import com.github.abel533.entity.EntityMapper;
28+
import com.github.abel533.entity.Example;
29+
import com.github.pagehelper.PageHelper;
30+
import com.github.pagehelper.PageInfo;
31+
import com.isea533.mybatis.mapper.CountryMapper;
32+
import com.isea533.mybatis.model.Country;
33+
import org.junit.Test;
34+
import org.springframework.beans.factory.annotation.Autowired;
35+
36+
import java.util.List;
37+
38+
/**
39+
* Created by liuzh on 2015/3/7.
40+
*/
41+
public class PageMapperTest extends BasicTest {
42+
43+
@Autowired
44+
private CountryMapper countryMapper;
45+
46+
@Test
47+
public void test(){
48+
Example example = new Example(Country.class);
49+
example.createCriteria().andGreaterThan("id",100);
50+
PageHelper.startPage(2,10);
51+
List<Country> countries = countryMapper.selectByExample(example);
52+
PageInfo<Country> pageInfo = new PageInfo<Country>(countries);
53+
System.out.println(pageInfo.getTotal());
54+
}
55+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class PageSqlMapperTest extends BasicTest {
2020
@Test
2121
public void test(){
2222
PageHelper.startPage(2,10);
23-
List<Country> countries = sqlMapper.select("select * from country",Country.class);
23+
List<Country> countries = sqlMapper.selectList("select * from country",Country.class);
2424
PageInfo<Country> pageInfo = new PageInfo<Country>(countries);
2525
System.out.println(pageInfo.getTotal());
2626
}

0 commit comments

Comments
 (0)
0