feat(WmsMaterialCoil): 添加钢卷列表排序功能
- 新增 orderBy 字段用于接收前端排序参数 - 实现按实际库位绑定状态排序逻辑 - 支持已绑定库位的钢卷优先展示 - 保持原有创建时间倒序作为默认排序方式 - 添加实际库位ID升序排列支持
This commit is contained in:
@@ -237,5 +237,9 @@ public class WmsMaterialCoilBo extends BaseEntity {
|
||||
* 独占状态(0=未独占,1=特殊分卷中)
|
||||
*/
|
||||
private Integer exclusiveStatus;
|
||||
|
||||
// 接收前端传来是否排序的字段 OrderBy
|
||||
@TableField(exist = false)
|
||||
private String orderBy;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user