feat(oms):库存查询/导出按商品到期日分组排序

This commit is contained in:
rcx
2026-08-20 17:54:23 +08:00
parent 33d085f9b9
commit 8fedb6d6ed
2 changed files with 8 additions and 10 deletions
@@ -292,7 +292,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectMaterialInventoryPo1"/>
<include refid="JoinMaterialBaseInfoPoWhere"/>
</where>
group by a.MATERIAL_INVENTORY_ID order by a.update_time desc
group by a.MATERIAL_INVENTORY_ID
<!-- 按到期日分组归类:到期日倒序(日期近的在前)、空值放最后;同到期日按更新时间倒序(空值放最后)。
查询列表与导出共用本查询,相同到期日的数据相邻显示;排序放 SQL 层保证跨页/全量导出分组不被打散 -->
order by CASE WHEN a.expiry_date IS NULL THEN 1 ELSE 0 END ASC, a.expiry_date DESC,
CASE WHEN a.update_time IS NULL THEN 1 ELSE 0 END ASC, a.update_time DESC
</select>
<select id="queryListByWlKw" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">