refactor(wms): 优化钢卷不匹配数据查询逻辑
- 在WmsMaterialCoilMapper中新增selectMismatchedItemCoils方法用于查询itemId和itemType不匹配的钢卷 - 在WmsMaterialCoilMapper.xml中添加对应的SQL查询语句,使用子查询直接筛选不匹配的数据 - 重构WmsMaterialCoilServiceImpl中的queryMismatchedItemCoils方法,改用SQL子查询替代原来的多次数据库查询 - 移除原有的批量验证逻辑,直接通过数据库层面进行数据校验 - 优化性能,减少不必要的数据库访问次数 - 使用批量填充方式处理关联对象信息
This commit is contained in:
@@ -881,5 +881,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ORDER BY category, isTrimmed, width
|
||||
</select>
|
||||
|
||||
<!-- 查询itemId和itemType不匹配的钢卷 -->
|
||||
<select id="selectMismatchedItemCoils" resultMap="WmsMaterialCoilResult">
|
||||
SELECT mc.*
|
||||
FROM wms_material_coil mc
|
||||
WHERE mc.del_flag = 0
|
||||
AND mc.item_id IS NOT NULL
|
||||
AND mc.item_type IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM wms_raw_material rm WHERE rm.raw_material_id = mc.item_id AND rm.del_flag = 0
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM wms_product wp WHERE wp.product_id = mc.item_id AND wp.del_flag = 0
|
||||
)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user