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 +