From bb0b80bd7ca7c1f979ab0125ae01f3faa1d14f4b Mon Sep 17 00:00:00 2001
From: hsy <1029150275@qq.com>
Date: 星期一, 17 八月 2026 09:37:57 +0800
Subject: [PATCH] Merge branch 'refs/heads/dev_business' into fix/hsy/20260811

---
 yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemMapper.java |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemMapper.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemMapper.java
index 0ab2d68..1309623 100644
--- a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemMapper.java
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemMapper.java
@@ -6,14 +6,16 @@
 import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemPageReqVO;
 import cn.iocoder.yudao.module.mdm.dal.dataobject.item.MdmItemDO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
 /**
  * MDM 鐗╂枡涓绘暟鎹� Mapper
  *
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
  */
 @Mapper
 public interface MdmItemMapper extends BaseMapperX<MdmItemDO> {
@@ -45,6 +47,22 @@
         return selectOne(MdmItemDO::getCode, code);
     }
 
+    /**
+     * 鏍规嵁缂栫爜鍜屽垹闄ょ姸鎬佹煡璇㈢墿鏂欙紙鐢ㄤ簬瑙e喅杞垹闄ゅ敮涓�閿啿绐侊級
+     */
+    default MdmItemDO selectByCodeAndDeleted(String code, Boolean deleted) {
+        return selectOne(new LambdaQueryWrapperX<MdmItemDO>()
+                .eq(MdmItemDO::getCode, code)
+                .eq(MdmItemDO::getDeleted, deleted));
+    }
+
+    /**
+     * 鐗╃悊鍒犻櫎锛堢敤浜庢竻鐞嗗凡杞垹闄ょ殑閲嶅璁板綍锛�
+     * 娉ㄦ剰锛氱敱浜� BaseDO 鏈� @TableLogic锛宒eleteById 鏄蒋鍒犻櫎锛岄渶瑕佷娇鐢ㄥ師鐢� SQL
+     */
+    @org.apache.ibatis.annotations.Delete("DELETE FROM mdm_item WHERE id = #{id}")
+    void physicalDeleteById(Long id);
+
     default MdmItemDO selectByBarCode(String barCode) {
         return selectOne(MdmItemDO::getBarCode, barCode);
     }
@@ -65,4 +83,12 @@
         return selectList(MdmItemDO::getId, ids);
     }
 
+    /**
+     * 鏌ヨ鐗╂枡琚摢浜涗笟鍔¤〃寮曠敤锛堟湭鍒犻櫎鐨勮褰曪級
+     *
+     * @param itemId 鐗╂枡缂栧彿
+     * @return 寮曠敤鏉ユ簮鍒楄〃锛屾瘡椤瑰寘鍚� source(鏉ユ簮鍚�) 鍜� cnt(寮曠敤鏁伴噺)锛屼粎杩斿洖 cnt > 0 鐨�
+     */
+    List<Map<String, Object>> selectItemReferenceCount(@Param("itemId") Long itemId);
+
 }
\ No newline at end of file

--
Gitblit v1.9.3