|
@@ -1,6 +1,5 @@
|
|
|
package com.railway.common.core.controller;
|
|
package com.railway.common.core.controller;
|
|
|
|
|
|
|
|
-import com.github.pagehelper.Page;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.railway.common.constant.HttpStatus;
|
|
import com.railway.common.constant.HttpStatus;
|
|
@@ -16,6 +15,7 @@ import com.railway.common.utils.sql.SqlUtil;
|
|
|
import java.beans.PropertyEditorSupport;
|
|
import java.beans.PropertyEditorSupport;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.WebDataBinder;
|
|
import org.springframework.web.bind.WebDataBinder;
|
|
|
import org.springframework.web.bind.annotation.InitBinder;
|
|
import org.springframework.web.bind.annotation.InitBinder;
|
|
|
|
|
|
|
@@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.InitBinder;
|
|
|
*/
|
|
*/
|
|
|
public class BaseController {
|
|
public class BaseController {
|
|
|
|
|
|
|
|
|
|
+ @Value("${pagehelper.reasonable:false}")
|
|
|
|
|
+ private Boolean reasonable;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
|
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
|
|
*/
|
|
*/
|
|
@@ -45,13 +48,13 @@ public class BaseController {
|
|
|
*/
|
|
*/
|
|
|
protected void startPage() {
|
|
protected void startPage() {
|
|
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
|
|
+ pageDomain.setReasonable(reasonable);
|
|
|
Integer pageNum = pageDomain.getPageNum();
|
|
Integer pageNum = pageDomain.getPageNum();
|
|
|
Integer pageSize = pageDomain.getPageSize();
|
|
Integer pageSize = pageDomain.getPageSize();
|
|
|
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
|
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
|
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
|
|
Boolean reasonable = pageDomain.getReasonable();
|
|
Boolean reasonable = pageDomain.getReasonable();
|
|
|
- Page page = PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
|
|
|
|
|
- System.out.println(page.getPageNum());
|
|
|
|
|
|
|
+ PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|