Your message has been delivered
You aleady login OSC, would you like login with OSC
Watch Star Fork

abel533 / Mybatis_PageHelperJavaMIT

isea533 authored   master
commit 2b50dac36f595d61dd9a52457de6a7c2270996e8
1 parent 3d0091331d

2 changed files, commit stats: +5 -3

  • src/main/java/com/github/pagehelper/dialect/AbstractHelperDialect.java +4 -2
  • src/test/java/com/github/pagehelper/test/basic/TestLike.java +1 -1
@@ -70,7 +70,7 @@ public abstract class AbstractHelperDialect extends AbstractDialect implements C
@Override
public boolean beforeCount(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
Page page = getLocalPage();
- return page.isCount();
+ return !page.isOrderByOnly() && page.isCount();
}
 
@Override
@@ -159,7 +159,7 @@ public abstract class AbstractHelperDialect extends AbstractDialect implements C
@Override
public boolean beforePage(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
Page page = getLocalPage();
- if (page.getPageSize() > 0) {
+ if (page.isOrderByOnly() || page.getPageSize() > 0) {
return true;
}
return false;
@@ -202,6 +202,8 @@ public abstract class AbstractHelperDialect extends AbstractDialect implements C
page.setTotal(-1);
} else if ((page.getPageSizeZero() != null && page.getPageSizeZero()) && page.getPageSize() == 0) {
page.setTotal(pageList.size());
+ } else if(page.isOrderByOnly()){
+ page.setTotal(pageList.size());
}
return page;
}
@@ -79,7 +79,7 @@ public class TestLike {
Country country = new Country();
country.setCountryname("c");
List<Country> list = countryMapper.selectLike(country);
- assertEquals(30, list.get(0).getId());
+ assertEquals(174, list.get(0).getId());
assertEquals(39, list.size());
assertEquals(39, ((Page<?>) list).getTotal());
} finally {

Sign in and comment

Float_left Icon_close