fix(wms): 修复物料卷材查询中的条件判断逻辑

- 修复了当 hasSelectType 为 true 但 hasAnyItemFilter 为 false 时的条件判断问题
- 调整了筛选逻辑的位置,确保只在满足双重条件时执行相关筛选
- 移除了多余的右大括号,优化了代码结构
This commit is contained in:
2026-01-16 11:30:41 +08:00
parent 12a6f4609e
commit a643b25f9f

View File

@@ -432,9 +432,9 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
} }
// 使用 EXISTS 针对 selectType 的细粒度筛选(使用参数占位符防注入) // 使用 EXISTS 针对 selectType 的细粒度筛选(使用参数占位符防注入)
if (hasSelectType) { if (hasSelectType && hasAnyItemFilter) {
qw.eq("mc.item_type", bo.getSelectType()); // 执行筛选逻辑(和上面完全一样)
if (hasAnyItemFilter) { qw.eq("mc.item_type", bo.getSelectType());
StringBuilder existsSql = new StringBuilder(); StringBuilder existsSql = new StringBuilder();
List<Object> existsArgs = new ArrayList<>(); List<Object> existsArgs = new ArrayList<>();
if ("product".equals(bo.getSelectType())) { if ("product".equals(bo.getSelectType())) {
@@ -474,7 +474,6 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
qw.apply(existsSql.toString(), existsArgs.toArray()); qw.apply(existsSql.toString(), existsArgs.toArray());
} }
} }
}
// 显式 itemId 条件:与 EXISTS 共存时,语义为交集 // 显式 itemId 条件:与 EXISTS 共存时,语义为交集
if (CollectionUtils.isNotEmpty(explicitItemIds)) { if (CollectionUtils.isNotEmpty(explicitItemIds)) {