Commit 9705ce1195159792950492105b1237eaef01fd63
1 parent
a25dd36b
fix(wms): 移除库存加锁查询排序
去掉库存 FOR UPDATE 查询中的 ORDER BY 和本地 ID 排序, 避免租户拦截器重写 SQL 后生成 MySQL 语法错误。 对应 https://t.zsxq.com/gHhfb、https://t.zsxq.com/cpUEC
Showing
1 changed file
with
1 additions
and
5 deletions
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/inventory/WmsInventoryMapper.java
| @@ -14,7 +14,6 @@ import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | @@ -14,7 +14,6 @@ import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | ||
| 14 | import org.apache.ibatis.annotations.Mapper; | 14 | import org.apache.ibatis.annotations.Mapper; |
| 15 | 15 | ||
| 16 | import java.math.BigDecimal; | 16 | import java.math.BigDecimal; |
| 17 | -import java.util.ArrayList; | ||
| 18 | import java.util.Collection; | 17 | import java.util.Collection; |
| 19 | import java.util.Collections; | 18 | import java.util.Collections; |
| 20 | import java.util.List; | 19 | import java.util.List; |
| @@ -100,11 +99,8 @@ public interface WmsInventoryMapper extends BaseMapperX<WmsInventoryDO> { | @@ -100,11 +99,8 @@ public interface WmsInventoryMapper extends BaseMapperX<WmsInventoryDO> { | ||
| 100 | if (CollUtil.isEmpty(ids)) { | 99 | if (CollUtil.isEmpty(ids)) { |
| 101 | return Collections.emptyList(); | 100 | return Collections.emptyList(); |
| 102 | } | 101 | } |
| 103 | - List<Long> sortedIds = new ArrayList<>(ids); | ||
| 104 | - Collections.sort(sortedIds); | ||
| 105 | return selectList(new LambdaQueryWrapperX<WmsInventoryDO>() | 102 | return selectList(new LambdaQueryWrapperX<WmsInventoryDO>() |
| 106 | - .in(WmsInventoryDO::getId, sortedIds) | ||
| 107 | - .orderByAsc(WmsInventoryDO::getId) | 103 | + .in(WmsInventoryDO::getId, ids) |
| 108 | .last("FOR UPDATE")); | 104 | .last("FOR UPDATE")); |
| 109 | } | 105 | } |
| 110 | 106 |