From b5a92bb9480c346e82165d6f0e4da0c9a6ae767d Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Mon, 9 Feb 2026 15:41:28 +0800 Subject: [PATCH] =?UTF-8?q?2026-02-09=20=E5=AF=BC=E5=87=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/InboundNotificationReportServiceImpl.java | 9 ++++++++- .../impl/OutboundNotificationReportServiceImpl.java | 9 ++++++++- .../service/impl/PartTemplateStatusServiceImpl.java | 12 ++++++++++-- .../report/InboundNotificationReportMapper.xml | 4 +++- .../report/OutboundNotificationReportMapper.xml | 4 +++- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gaotao/modules/report/service/impl/InboundNotificationReportServiceImpl.java b/src/main/java/com/gaotao/modules/report/service/impl/InboundNotificationReportServiceImpl.java index 6245648..1c67c4d 100644 --- a/src/main/java/com/gaotao/modules/report/service/impl/InboundNotificationReportServiceImpl.java +++ b/src/main/java/com/gaotao/modules/report/service/impl/InboundNotificationReportServiceImpl.java @@ -27,6 +27,12 @@ public class InboundNotificationReportServiceImpl implements InboundNotification int limit = query.getLimit() != null ? query.getLimit() : 50; int offset = (page - 1) * limit; + // 当limit < 0时(如-1),表示导出全部数据,不分页 + if (limit < 0) { + offset = 0; + limit = -1; + } + // 查询数据 List list = inboundNotificationReportMapper.searchInboundNotificationReport( query, userName, offset, limit); @@ -35,7 +41,8 @@ public class InboundNotificationReportServiceImpl implements InboundNotification int total = inboundNotificationReportMapper.countInboundNotificationReport(query, userName); // 构建分页结果 - return new PageUtils(list, total, limit, page); + int pageLimit = limit > 0 ? limit : total; + return new PageUtils(list, total, pageLimit, page); } @Override diff --git a/src/main/java/com/gaotao/modules/report/service/impl/OutboundNotificationReportServiceImpl.java b/src/main/java/com/gaotao/modules/report/service/impl/OutboundNotificationReportServiceImpl.java index 5272439..f4f707f 100644 --- a/src/main/java/com/gaotao/modules/report/service/impl/OutboundNotificationReportServiceImpl.java +++ b/src/main/java/com/gaotao/modules/report/service/impl/OutboundNotificationReportServiceImpl.java @@ -27,6 +27,12 @@ public class OutboundNotificationReportServiceImpl implements OutboundNotificati int limit = query.getLimit() != null ? query.getLimit() : 50; int offset = (page - 1) * limit; + // 当limit < 0时(如-1),表示导出全部数据,不分页 + if (limit < 0) { + offset = 0; + limit = -1; + } + // 查询数据 List list = outboundNotificationReportMapper.searchOutboundNotificationReport( query, userName, offset, limit); @@ -35,7 +41,8 @@ public class OutboundNotificationReportServiceImpl implements OutboundNotificati int total = outboundNotificationReportMapper.countOutboundNotificationReport(query, userName); // 构建分页结果 - return new PageUtils(list, total, limit, page); + int pageLimit = limit > 0 ? limit : total; + return new PageUtils(list, total, pageLimit, page); } @Override diff --git a/src/main/java/com/gaotao/modules/report/service/impl/PartTemplateStatusServiceImpl.java b/src/main/java/com/gaotao/modules/report/service/impl/PartTemplateStatusServiceImpl.java index 2dc01bb..adce3d7 100644 --- a/src/main/java/com/gaotao/modules/report/service/impl/PartTemplateStatusServiceImpl.java +++ b/src/main/java/com/gaotao/modules/report/service/impl/PartTemplateStatusServiceImpl.java @@ -52,8 +52,16 @@ public class PartTemplateStatusServiceImpl implements PartTemplateStatusService params.add(query.getDepartment() != null ? query.getDepartment() : ""); // 分页参数 int page = query.getPage() > 0 ? query.getPage() : 1; - int limit = query.getLimit() > 0 ? query.getLimit() : 20; - int offset = (page - 1) * limit; + int offset; + int limit; + // 当limit < 0时(如-1),表示导出全部数据,不分页 + if (query.getLimit() < 0) { + offset = 0; + limit = 999999; + } else { + limit = query.getLimit(); + offset = (page - 1) * limit; + } params.add(offset); params.add(limit); diff --git a/src/main/resources/mapper/report/InboundNotificationReportMapper.xml b/src/main/resources/mapper/report/InboundNotificationReportMapper.xml index cd9316d..5060c44 100644 --- a/src/main/resources/mapper/report/InboundNotificationReportMapper.xml +++ b/src/main/resources/mapper/report/InboundNotificationReportMapper.xml @@ -107,7 +107,9 @@ ORDER BY h.created_date DESC, h.order_no, d.part_no - OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY + + OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY + diff --git a/src/main/resources/mapper/report/OutboundNotificationReportMapper.xml b/src/main/resources/mapper/report/OutboundNotificationReportMapper.xml index b68a43f..d14c265 100644 --- a/src/main/resources/mapper/report/OutboundNotificationReportMapper.xml +++ b/src/main/resources/mapper/report/OutboundNotificationReportMapper.xml @@ -114,7 +114,9 @@ ORDER BY h.created_date DESC, h.order_no, d.part_no - OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY + + OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY +