Przeglądaj źródła

新增2个接口的分页处理

王苗苗 6 miesięcy temu
rodzic
commit
83d29db2fc

+ 19 - 1
src/main/java/com/xlht/xlhtproject/controller/FrontController.java

@@ -1,12 +1,14 @@
 package com.xlht.xlhtproject.controller;
 
 
+import com.github.pagehelper.PageHelper;
 import com.xlht.xlhtproject.domain.HomeCountInfo;
 import com.xlht.xlhtproject.domain.TShuju1;
 import com.xlht.xlhtproject.domain.TTbDu;
 import com.xlht.xlhtproject.mapper.TTbDuMapper;
 import com.xlht.xlhtproject.respParse.bean.AjaxResult;
 import com.xlht.xlhtproject.respParse.bean.R;
+import com.xlht.xlhtproject.respParse.page.TableDataInfo;
 import com.xlht.xlhtproject.service.IFrontService;
 import com.xlht.xlhtproject.service.ITShuju1Service;
 import lombok.extern.slf4j.Slf4j;
@@ -24,7 +26,7 @@ import static com.xlht.xlhtproject.enums.MyConstants.LONG_1;
 @RestController
 @RequestMapping("/front")
 @Slf4j
-public class FrontController {
+public class FrontController extends BaseController{
 
     @Autowired
     private IFrontService frontService;
@@ -119,6 +121,22 @@ public class FrontController {
     }
 
 
+    /**
+     *首页-报表信息-分页
+     * @return
+     */
+    @GetMapping("/bigModel/smartAdd/homePageList")
+    public TableDataInfo homePageList(@RequestParam(required = false, name = "timeBegin") String timeBegin, @RequestParam(required = false, name = "timeEnd") String timeEnd, Integer pageNum, Integer pageSize)
+    {
+        log.info("进入了 修改碳源投加 首页-报表信息-分页 接口");
+        if(Objects.isNull(pageNum) || Objects.isNull(pageSize))
+            throw new RuntimeException("请输入分页参数");
+        TShuju1 req = TShuju1.builder().timeBegin(timeBegin).timeEnd(timeEnd).build();
+        PageHelper.startPage(pageNum, pageSize);
+        return getDataTable(this.tShuju1Service.selectTShuju1List(req));
+    }
+
+
     /**
      *首页-化验统计信息
      * @return

+ 25 - 1
src/main/java/com/xlht/xlhtproject/controller/TXlhtMedicineParamController.java

@@ -1,12 +1,18 @@
 package com.xlht.xlhtproject.controller;
 
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.xlht.xlhtproject.domain.TXlhtMedicineParam;
 import com.xlht.xlhtproject.respParse.bean.AjaxResult;
+import com.xlht.xlhtproject.respParse.page.TableDataInfo;
 import com.xlht.xlhtproject.service.ITXlhtMedicineParamService;
+import com.xlht.xlhtproject.utils.HttpStatus;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * 智能投药参数设置Controller
  * 
@@ -23,9 +29,10 @@ public class TXlhtMedicineParamController extends BaseController
 //    前端需要的接口
 
     /**
-     * 修改智能投药参数设置
+     * 修改智能投药参数设置(此方法不使用)
      *
      */
+    @Deprecated
     @PutMapping
     public AjaxResult edit(@RequestBody TXlhtMedicineParam tXlhtMedicineParam)
     {
@@ -56,6 +63,23 @@ public class TXlhtMedicineParamController extends BaseController
     }
 
 
+    /**
+     * 获取智能投药参数设置详细信息的历史记录-分页获取
+     */
+    @GetMapping(value = "/pageList")
+    public TableDataInfo pageList(TXlhtMedicineParam tXlhtMedicineParam)
+    {
+        PageHelper.startPage(tXlhtMedicineParam.getPageNum(), tXlhtMedicineParam.getPageSize());
+        List<TXlhtMedicineParam> list = xlhtMedicineParamService.selectTXlhtMedicineParamList(tXlhtMedicineParam);
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(HttpStatus.SUCCESS);
+        rspData.setMsg("查询成功");
+        rspData.setRows(list);
+        rspData.setTotal(new PageInfo(list).getTotal());
+        return rspData;
+    }
+
+
     /**
      * 获取智能投药参数设置详细信息最新的一条数据
      */

+ 6 - 0
src/main/java/com/xlht/xlhtproject/domain/TXlhtMedicineParam.java

@@ -218,4 +218,10 @@ public class TXlhtMedicineParam
 
     /** 截止时间 */
     private String timeEnd;
+
+    /** 当前记录起始索引 */
+    private Integer pageNum = 1;
+
+    /** 每页显示记录数 */
+    private Integer pageSize = 10;
 }