From 1ab2b329a40decba8ff7eefbeb158ff259aceb6d Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期二, 14 七月 2026 15:23:34 +0800
Subject: [PATCH] 追溯+分类接口

---
 yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemMapper.java |   84 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 84 insertions(+), 0 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
new file mode 100644
index 0000000..04edd6b
--- /dev/null
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/dal/mysql/item/MdmItemMapper.java
@@ -0,0 +1,84 @@
+package cn.iocoder.yudao.module.mdm.dal.mysql.item;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+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 java.util.Collection;
+import java.util.List;
+
+/**
+ * MDM 鐗╂枡涓绘暟鎹� Mapper
+ *
+ * @author 鑺嬮亾婧愮爜
+ */
+@Mapper
+public interface MdmItemMapper extends BaseMapperX<MdmItemDO> {
+
+    default PageResult<MdmItemDO> selectPage(MdmItemPageReqVO reqVO, Collection<Long> categoryIds) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<MdmItemDO>()
+                .likeIfPresent(MdmItemDO::getCode, reqVO.getCode())
+                .likeIfPresent(MdmItemDO::getName, reqVO.getName())
+                .likeIfPresent(MdmItemDO::getBarCode, reqVO.getBarCode())
+                .inIfPresent(MdmItemDO::getCategoryId, categoryIds)
+                .eqIfPresent(MdmItemDO::getItemType, reqVO.getItemType())
+                .eqIfPresent(MdmItemDO::getBrandId, reqVO.getBrandId())
+                .eqIfPresent(MdmItemDO::getStatus, reqVO.getStatus())
+                .betweenIfPresent(MdmItemDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(MdmItemDO::getId));
+    }
+
+    default List<MdmItemDO> selectList(MdmItemPageReqVO reqVO, Collection<Long> categoryIds) {
+        return selectList(new LambdaQueryWrapperX<MdmItemDO>()
+                .likeIfPresent(MdmItemDO::getCode, reqVO.getCode())
+                .likeIfPresent(MdmItemDO::getName, reqVO.getName())
+                .inIfPresent(MdmItemDO::getCategoryId, categoryIds)
+                .eqIfPresent(MdmItemDO::getItemType, reqVO.getItemType())
+                .eqIfPresent(MdmItemDO::getStatus, reqVO.getStatus())
+                .orderByDesc(MdmItemDO::getId));
+    }
+
+    default MdmItemDO selectByCode(String code) {
+        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);
+    }
+
+    default Long selectCountByCategoryId(Long categoryId) {
+        return selectCount(MdmItemDO::getCategoryId, categoryId);
+    }
+
+    default Long selectCountByUnitMeasureId(Long unitMeasureId) {
+        return selectCount(MdmItemDO::getUnitMeasureId, unitMeasureId);
+    }
+
+    default Long selectCountByBrandId(Long brandId) {
+        return selectCount(MdmItemDO::getBrandId, brandId);
+    }
+
+    default List<MdmItemDO> selectListByIds(Collection<Long> ids) {
+        return selectList(MdmItemDO::getId, ids);
+    }
+
+}
\ No newline at end of file

--
Gitblit v1.9.3