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

mcj:修改page类名

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