From 6b8585fc452ecdcaa82d86fab79a9f27bb442851 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 05 十一月 2026 09:13:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_南通_苏珩' into dev_南通_苏珩

---
 yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemTechnicalFileMapper.java |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemTechnicalFileMapper.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemTechnicalFileMapper.java
index 0cd95bc..4340613 100644
--- a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemTechnicalFileMapper.java
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemTechnicalFileMapper.java
@@ -4,6 +4,8 @@
 import cn.iocoder.yudao.module.mdm.dal.dataobject.item.MdmItemTechnicalFileDO;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 
@@ -16,11 +18,7 @@
                 .orderByDesc(MdmItemTechnicalFileDO::getVersionNo));
     }
 
-    default Integer selectMaxVersionNo(Long itemId) {
-        MdmItemTechnicalFileDO row = selectOne(new LambdaQueryWrapper<MdmItemTechnicalFileDO>()
-                .eq(MdmItemTechnicalFileDO::getItemId, itemId)
-                .orderByDesc(MdmItemTechnicalFileDO::getVersionNo)
-                .last("LIMIT 1"));
-        return row == null || row.getVersionNo() == null ? 0 : row.getVersionNo();
-    }
+    // 鍖呭惈宸茬Щ闄よ褰曪紝閬垮厤鍚庣画涓婁紶澶嶇敤宸叉湁宸ュ崟鏄剧ず杩囩殑搴忓彿銆�
+    @Select("SELECT COALESCE(MAX(version_no), 0) FROM mdm_item_technical_file WHERE item_id = #{itemId}")
+    Integer selectMaxVersionNo(@Param("itemId") Long itemId);
 }

--
Gitblit v1.9.3