zhangxin 1 месяц назад
Родитель
Сommit
d49321fcfb

+ 0 - 21
prod-line-comm/src/main/java/com/huaxia/comm/domain/imes/BasePageQuery.java

@@ -1,21 +0,0 @@
-package com.huaxia.comm.domain.imes;
-
-import lombok.Data;
-
-/**
- * @author zx
- * @since 2024年10月29日
- */
-@Data
-public class BasePageQuery {
-
-
-    /**
-     * 当前页码, 默认第一页
-     */
-    private Long current = 1L;
-    /**
-     * 每页展示的数据数量,默认每页展示 10 条数据
-     */
-    private Long size = 10L;
-}

+ 2 - 2
prod-line-imes/src/main/java/com/huaxia/imes/controller/MesLineController.java

@@ -38,8 +38,8 @@ public class MesLineController extends BaseController {
      * @return
      */
     @GetMapping("/list")
-    public AjaxResult queryList(MesLineBO bo) {
-        IPage<MesLineVO> list = mesLineService.queryList(bo);
+    public AjaxResult queryList(MesLineBO bo,@RequestParam(defaultValue = "1") int pageNum,@RequestParam(defaultValue = "10") int pageSize ) {
+        IPage<MesLineVO> list = mesLineService.queryList(bo, pageNum, pageSize);
         return AjaxResult.success(new TableDataInfo(list.getRecords(), (int) list.getTotal()));
 
     }

+ 14 - 6
prod-line-imes/src/main/java/com/huaxia/imes/pojo/MesLineBO.java

@@ -1,8 +1,6 @@
 package com.huaxia.imes.pojo;
 
-import com.huaxia.comm.domain.imes.BasePageQuery;
-import lombok.Getter;
-import lombok.Setter;
+import lombok.*;
 
 import java.util.Date;
 
@@ -10,13 +8,23 @@ import java.util.Date;
  * @author zx
  * @since 2024年10月29日
  */
-@Getter
-@Setter
-public class MesLineBO extends BasePageQuery {
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class MesLineBO {
 
 
     private String lineName;// 产线名称
 
 
     private Date startTime,endTime;// 开始时间,结束时间
+
+    /**
+     * 当前页码, 默认第一页
+     */
+    private Long pageNum = 1L;
+    /**
+     * 每页展示的数据数量,默认每页展示 10 条数据
+     */
+    private Long pageSize = 10L;
 }

+ 4 - 6
prod-line-imes/src/main/java/com/huaxia/imes/service/MesLineService.java

@@ -49,20 +49,18 @@ public class MesLineService extends ServiceImpl<MesLineMapper, MesLine> implemen
      * @param bo
      * @return
      */
-    public IPage<MesLineVO> queryList(MesLineBO bo) {
-        Long current = bo.getCurrent();// 当前页码
-        Long size = bo.getSize();// 每页显示条数
-        Long offset = (current - 1) * size;
+    public IPage<MesLineVO> queryList(MesLineBO bo,int pageNum,int pageSize) {
+        int offset = (pageNum - 1) * pageSize;
         Map<String, Object> params = new HashMap<>();
         params.put("boy", bo);
         params.put("offset", offset);
-        params.put("pageSize", size);
+        params.put("pageSize", pageSize);
         // 获取总记录数
         int total = mesLineMapper.countByParams(params);
         //开始分页查询
         List<MesLineVO> records = mesLineMapper.queryListPage(params);
         // 创建并返回 Page 对象
-        return new Page<MesLineVO>(current, size, total).setRecords(records);
+        return new Page<MesLineVO>(pageNum, pageSize, total).setRecords(records);
     }
 
     /**

+ 1 - 1
prod-line-imes/src/main/resources/mapper/MesLineMapper.xml

@@ -47,6 +47,6 @@
         </where>
         ORDER BY id
         OFFSET #{params.offset} ROWS
-        FETCH NEXT #{params.size} ROWS ONLY
+        FETCH NEXT #{params.pageSize} ROWS ONLY
     </select>
 </mapper>