feat(WmsMaterialCoil): 添加钢卷列表排序功能

- 新增 orderBy 字段用于接收前端排序参数
- 实现按实际库位绑定状态排序逻辑
- 支持已绑定库位的钢卷优先展示
- 保持原有创建时间倒序作为默认排序方式
- 添加实际库位ID升序排列支持
This commit is contained in:
2026-01-28 14:48:13 +08:00
parent 2b20327c93
commit 7874e546c4
2 changed files with 16 additions and 2 deletions

View File

@@ -237,5 +237,9 @@ public class WmsMaterialCoilBo extends BaseEntity {
* 独占状态0=未独占1=特殊分卷中)
*/
private Integer exclusiveStatus;
// 接收前端传来是否排序的字段 OrderBy
@TableField(exist = false)
private String orderBy;
}

View File

@@ -611,8 +611,18 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
if (bo.getMinAbnormalCount() != null) {
qw.apply("COALESCE(ca.abnormal_count, 0) >= {0}", bo.getMinAbnormalCount());
}
//根据创建时间倒叙
qw.orderByDesc("mc.create_time");
// 排序:
// - 当前端需要绑定信息includeBindInfo=true优先展示“已绑定实际库位”的钢卷actual_warehouse_id 非空在前)
// 再按实际库位ID升序库位ID为自增升序即可满足“先生成的库位在前”
// - 否则:保持原有创建时间倒序
if (Boolean.TRUE.equals(bo.getOrderBy())) {
// MySQL: false(0) < true(1),因此 "IS NULL" 升序可实现非空在前、空值在后
qw.orderByAsc("mc.actual_warehouse_id IS NULL");
qw.orderByAsc("mc.actual_warehouse_id");
} else {
//根据创建时间倒叙
qw.orderByDesc("mc.create_time");
}
return qw;
}