feat(oms):库存查询/导出按商品到期日分组排序
This commit is contained in:
+3
-9
@@ -84,16 +84,10 @@ public class ReservationMaterialInventoryApi extends BaseController {
|
||||
materialInventoryDO.setExpiryDateEnd(expiryDateEnd);
|
||||
startPage();
|
||||
// 使用带批次属性的查询方法,批次属性值从库存表中获取
|
||||
// 排序由 SQL 统一处理:到期日倒序(日期近的在前、空值最后)、同到期日按更新时间倒序(空值最后),
|
||||
// 查询列表与导出(同一接口)均按到期日分组,相同到期日的数据相邻显示;
|
||||
// 不在内存重排,避免覆盖 SQL 排序导致跨页分组被打散
|
||||
List<ReservationMaterialInventoryPO> list = materialInventoryApplicationService.queryListWithBatchAttributes(materialInventoryDO);
|
||||
// 按更新时间倒序排序;update_time 为空的数据放最后
|
||||
list.sort((o1, o2) -> {
|
||||
Date t1 = o1.getUpdateTime();
|
||||
Date t2 = o2.getUpdateTime();
|
||||
if (t1 == null && t2 == null) return 0;
|
||||
if (t1 == null) return 1;
|
||||
if (t2 == null) return -1;
|
||||
return t2.compareTo(t1); // desc
|
||||
});
|
||||
TableDataInfo tableDataInfo = getDataTable(list);
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user