zhangxin 1 ماه پیش
والد
کامیت
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
      * @return
      */
      */
     @GetMapping("/list")
     @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()));
         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;
 package com.huaxia.imes.pojo;
 
 
-import com.huaxia.comm.domain.imes.BasePageQuery;
-import lombok.Getter;
-import lombok.Setter;
+import lombok.*;
 
 
 import java.util.Date;
 import java.util.Date;
 
 
@@ -10,13 +8,23 @@ import java.util.Date;
  * @author zx
  * @author zx
  * @since 2024年10月29日
  * @since 2024年10月29日
  */
  */
-@Getter
-@Setter
-public class MesLineBO extends BasePageQuery {
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class MesLineBO {
 
 
 
 
     private String lineName;// 产线名称
     private String lineName;// 产线名称
 
 
 
 
     private Date startTime,endTime;// 开始时间,结束时间
     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
      * @param bo
      * @return
      * @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<>();
         Map<String, Object> params = new HashMap<>();
         params.put("boy", bo);
         params.put("boy", bo);
         params.put("offset", offset);
         params.put("offset", offset);
-        params.put("pageSize", size);
+        params.put("pageSize", pageSize);
         // 获取总记录数
         // 获取总记录数
         int total = mesLineMapper.countByParams(params);
         int total = mesLineMapper.countByParams(params);
         //开始分页查询
         //开始分页查询
         List<MesLineVO> records = mesLineMapper.queryListPage(params);
         List<MesLineVO> records = mesLineMapper.queryListPage(params);
         // 创建并返回 Page 对象
         // 创建并返回 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>
         </where>
         ORDER BY id
         ORDER BY id
         OFFSET #{params.offset} ROWS
         OFFSET #{params.offset} ROWS
-        FETCH NEXT #{params.size} ROWS ONLY
+        FETCH NEXT #{params.pageSize} ROWS ONLY
     </select>
     </select>
 </mapper>
 </mapper>