Ver Fonte

ljx:修改公用方法starpageL并对benefit和match接口进行使用

ljx há 1 mês atrás
pai
commit
2b81a2f6c6

+ 4 - 2
enteprise-admin/src/main/java/com/enteprise/benefit_monitor_assess/controller/BenefitMonitorAssessController.java

@@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
+import static com.enteprise.util.CommonUtil.startPageL;
+
 @RestController
 @RequestMapping("/benefit/benefit")
 public class BenefitMonitorAssessController extends BaseController {
@@ -22,8 +24,8 @@ public class BenefitMonitorAssessController extends BaseController {
     @PreAuthorize("@ss.hasPermi('benefit:benefit:list')")
     @PostMapping("/list")
     public TableDataInfo list(@RequestBody BenefitMonitorAssess benefitMonitorAssess) {
-        startPage();
+        //startPage();
         List<BenefitMonitorAssess> list = businessMonitorAssessService.getListByBusinessMonitorAssess(benefitMonitorAssess);
-        return getDataTable(list);
+        return startPageL(list, benefitMonitorAssess.getPageNum(), benefitMonitorAssess.getPageSize());
     }
 }

+ 20 - 0
enteprise-admin/src/main/java/com/enteprise/benefit_monitor_assess/domain/BenefitMonitorAssess.java

@@ -33,6 +33,26 @@ public class BenefitMonitorAssess extends BaseEntity {
     /** 评估方式*/
     private String mode;
 
+    private Integer pageSize;
+
+    private Integer pageNum;
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public Integer getPageNum() {
+        return pageNum;
+    }
+
+    public void setPageNum(Integer pageNum) {
+        this.pageNum = pageNum;
+    }
+
     public String getEnterpriseName() {
         return enterpriseName;
     }

+ 1 - 10
enteprise-admin/src/main/java/com/enteprise/matchAnalysis/controller/MatchController.java

@@ -1,14 +1,10 @@
 package com.enteprise.matchAnalysis.controller;
 
-import com.enteprise.common.constant.HttpStatus;
 import com.enteprise.common.core.controller.BaseController;
-import com.enteprise.common.core.page.PageDomain;
 import com.enteprise.common.core.page.TableDataInfo;
-import com.enteprise.common.core.page.TableSupport;
 import com.enteprise.matchAnalysis.domain.MatchAna;
 import com.enteprise.matchAnalysis.domain.dto.MatchDto;
 import com.enteprise.matchAnalysis.service.IMatchService;
-import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -34,11 +30,6 @@ public class MatchController extends BaseController {
         Integer pageNum = matchAna.getPageNum();
         Integer pageSize = matchAna.getPageSize();
         List<MatchDto> list = matchService.matchAnalysisList(matchAna);
-        TableDataInfo rspData = new TableDataInfo();
-        rspData.setCode(HttpStatus.SUCCESS);
-        rspData.setMsg("查询成功");
-        rspData.setRows(startPageL(list, pageNum, pageSize));
-        rspData.setTotal(new PageInfo(list).getTotal());
-        return rspData;
+        return startPageL(list, pageNum, pageSize);
     }
 }

+ 1 - 0
enteprise-admin/src/main/java/com/enteprise/priceindex/service/impl/PriceIndexServiceImpl.java

@@ -60,6 +60,7 @@ public class PriceIndexServiceImpl implements IPriceIndexService
         }
         Long id =Long.valueOf( name.replace("企业", "") + priceIndex.getMonth() +priceIndex.getYear());
         priceIndex.setId(id);
+        System.out.println();
         return priceIndexMapper.insertPriceIndex(priceIndex);
     }
 

+ 10 - 2
enteprise-admin/src/main/java/com/enteprise/util/CommonUtil.java

@@ -1,6 +1,9 @@
 package com.enteprise.util;
 
+import com.enteprise.common.constant.HttpStatus;
+import com.enteprise.common.core.page.TableDataInfo;
 import com.enteprise.enterprise.dto.EnterpriseDto;
+import com.github.pagehelper.PageInfo;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -50,7 +53,7 @@ public class CommonUtil {
         return Integer.parseInt(numberPart.isEmpty() ? "0" : numberPart); // 转换为整数,默认返回 0
     }
 
-        public static List startPageL(List list, Integer pageNum, Integer pageSize) {
+        public static TableDataInfo startPageL(List list, Integer pageNum, Integer pageSize) {
             if (list == null) {
                 return null;
             }
@@ -74,7 +77,12 @@ public class CommonUtil {
                 toIndex = count;
             }
             List pageList = list.subList(fromIndex, toIndex);
-            return pageList;
+            TableDataInfo rspData = new TableDataInfo();
+            rspData.setCode(HttpStatus.SUCCESS);
+            rspData.setMsg("查询成功");
+            rspData.setRows(pageList);
+            rspData.setTotal(new PageInfo(list).getTotal());
+            return rspData;
         }
 
     }