|
@@ -21,7 +21,9 @@ import org.activiti.engine.ActivitiException;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.Sort;
|
|
import org.springframework.data.domain.Sort;
|
|
|
|
+import org.springframework.data.domain.Sort.Direction;
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.ui.Model;
|
|
@@ -309,12 +311,13 @@ public class DcsbCtl extends BaseWebCtl {
|
|
}
|
|
}
|
|
Utils.getSession().setAttribute("userpre", user2);
|
|
Utils.getSession().setAttribute("userpre", user2);
|
|
|
|
|
|
|
|
+
|
|
page.setSort("bgsj");
|
|
page.setSort("bgsj");
|
|
page.setOrder("desc");
|
|
page.setOrder("desc");
|
|
if (page.getPage() < 1) {
|
|
if (page.getPage() < 1) {
|
|
page.setPage(SearchCondition.dcsbpage);
|
|
page.setPage(SearchCondition.dcsbpage);
|
|
}
|
|
}
|
|
- Page<DcsbEntity> list = query.findAll(spec, toPageRequest(page), DcsbEntity.class);
|
|
|
|
|
|
+ Page<DcsbEntity> list = query.findAll(spec, getPageRequest(page), DcsbEntity.class);
|
|
List<DcsbVo> voList = new ArrayList<DcsbVo>();
|
|
List<DcsbVo> voList = new ArrayList<DcsbVo>();
|
|
for (DcsbEntity entity : list) {
|
|
for (DcsbEntity entity : list) {
|
|
DcsbVo vo = new DcsbVo();
|
|
DcsbVo vo = new DcsbVo();
|
|
@@ -371,7 +374,18 @@ public class DcsbCtl extends BaseWebCtl {
|
|
putPageInfo(model, page, list);
|
|
putPageInfo(model, page, list);
|
|
return "gkjygl/cghzyxxgl/dcsb/dcsbmain";
|
|
return "gkjygl/cghzyxxgl/dcsb/dcsbmain";
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ private PageRequest getPageRequest(SimplePageRequest page) {
|
|
|
|
+ if (page.getPage() < 1) {
|
|
|
|
+ page.setPage(1);
|
|
|
|
+ }
|
|
|
|
+ if (page.getRows() < 10) {
|
|
|
|
+ page.setRows(10);
|
|
|
|
+ }
|
|
|
|
+ Sort newsort = new Sort(Direction.fromString(page.getOrder()), page.getSort());
|
|
|
|
+ // 页码从0开始
|
|
|
|
+ PageRequest pageable = new PageRequest(page.getPage() - 1, page.getRows(), newsort);
|
|
|
|
+ return pageable;
|
|
|
|
+ }
|
|
// 导出
|
|
// 导出
|
|
@RequestMapping(value = "/exportExcelAll")
|
|
@RequestMapping(value = "/exportExcelAll")
|
|
@ResponseBody
|
|
@ResponseBody
|