提交 c59d8d13 authored 作者: 马晨俊's avatar 马晨俊

mcj:修改page类名

上级 d2433b88
......@@ -90,7 +90,7 @@ public class RuleController {
})
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public ResponseEntity findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
Page<RuleCollection> search = ruleService.findSearch(searchMap, page, size);
CustomPage<RuleCollection> search = ruleService.findSearch(searchMap, page, size);
return ResponseEntity.ok(search);
}
}
......@@ -8,7 +8,7 @@ import java.util.List;
* @date 2020-03-05 19:24
*/
public class Page<T> {
public class CustomPage<T> {
private int totalPage;
private int totalElement;
......
......@@ -146,6 +146,7 @@ public class Inspector {
initData();
//扫描文件
scanFiles();
//配置
inspectParameter.setCodeSize((int) codeSize);
report.setFileNum(fileNum);
report.setFileLine(fileLine);
......
package com.zjty.inspect.service;
import com.zjty.inspect.entity.Page;
import com.zjty.inspect.entity.CustomPage;
import com.zjty.inspect.entity.Report;
import com.zjty.inspect.entity.ReportManage;
public interface ReportService {
public Page findReportByPage(int page);
public CustomPage findReportByPage(int page);
public ReportManage findReportById(String id);
......
package com.zjty.inspect.service;
import com.zjty.inspect.entity.Page;
import com.zjty.inspect.entity.CustomPage;
import com.zjty.inspect.entity.Rule;
import com.zjty.inspect.entity.RuleCollection;
import com.zjty.inspect.entity.RuleQo;
......@@ -46,7 +46,7 @@ public interface RuleService {
List<RuleCollection> findByName(String name);
Page<RuleCollection> findSearch(Map searchMap, int page, int size);
CustomPage<RuleCollection> findSearch(Map searchMap, int page, int size);
List<Rule> findAllByTechnologyIdIn(List<String> technologyIds);
}
......@@ -58,14 +58,14 @@ public class ReportServiceImpl implements ReportService {
@Override
public Page findReportByPage(int page) {
public CustomPage findReportByPage(int page) {
PageRequest of = PageRequest.of(page - 1, 10);
org.springframework.data.domain.Page<Report> all = reportDao.findAll(of);
Page<Report> reportPage = new Page<>();
reportPage.setTotalElement((int) all.getTotalElements());
reportPage.setTotalPage(all.getTotalPages());
reportPage.addAll(all.getContent());
return reportPage;
CustomPage<Report> reportCustomPage = new CustomPage<>();
reportCustomPage.setTotalElement((int) all.getTotalElements());
reportCustomPage.setTotalPage(all.getTotalPages());
reportCustomPage.addAll(all.getContent());
return reportCustomPage;
}
@Override
......
......@@ -2,12 +2,8 @@ package com.zjty.inspect.service.impl;
import com.zjty.inspect.dao.RuleCollectionDao;
import com.zjty.inspect.dao.RuleDao;
import com.zjty.inspect.entity.ExcelDataVo;
import com.zjty.inspect.entity.Rule;
import com.zjty.inspect.entity.RuleCollection;
import com.zjty.inspect.entity.RuleQo;
import com.zjty.inspect.entity.*;
import com.zjty.inspect.service.RuleService;
import com.zjty.inspect.service.TechnologyService;
import com.zjty.inspect.utils.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
......@@ -18,10 +14,7 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.*;
/**
......@@ -86,17 +79,17 @@ public class RuleServiceImpl implements RuleService {
* @return
*/
@Override
public com.zjty.inspect.entity.Page<RuleCollection> findSearch(Map whereMap, int page, int size) {
public CustomPage<RuleCollection> findSearch(Map whereMap, int page, int size) {
Specification<RuleCollection> specification = createSpecification(whereMap);
Sort sort = new Sort(Sort.Direction.DESC, "updateDate");
PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
Page<RuleCollection> ruleCollections = ruleCollectionDao.findAll(specification, pageRequest);
com.zjty.inspect.entity.Page<RuleCollection> myPage = new com.zjty.inspect.entity.Page<>();
myPage.setTotalPage(ruleCollections.getTotalPages());
myPage.setTotalElement((int)ruleCollections.getTotalElements());
myPage.setObjects(ruleCollections.getContent());
return myPage;
CustomPage<RuleCollection> myCustomPage = new CustomPage<>();
myCustomPage.setTotalPage(ruleCollections.getTotalPages());
myCustomPage.setTotalElement((int)ruleCollections.getTotalElements());
myCustomPage.setObjects(ruleCollections.getContent());
return myCustomPage;
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论