From 26e295956b81d6bfe5f181f040bf8ecd0079ba54 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期六, 14 三月 2026 16:21:03 +0800
Subject: [PATCH] feat: 判断是否为BOM的选择产品查询

---
 src/main/resources/mapper/production/ProductMaterialSkuMapper.xml |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/production/ProductMaterialSkuMapper.xml b/src/main/resources/mapper/production/ProductMaterialSkuMapper.xml
index ccd26ed..31720c9 100644
--- a/src/main/resources/mapper/production/ProductMaterialSkuMapper.xml
+++ b/src/main/resources/mapper/production/ProductMaterialSkuMapper.xml
@@ -19,4 +19,33 @@
         <result property="updateTime" column="update_time"/>
     </resultMap>
 
+    <select id="selectSkuWithMaterialPage" resultType="com.ruoyi.production.dto.ProductMaterialSkuDto">
+        SELECT
+        sku.id AS skuId,
+        sku.material_id AS materialId,
+        sku.material_code AS materialCode,
+        sku.specification AS specification,
+        sku.supply_type AS supplyType,
+        m.material_name AS materialName,
+        m.base_unit AS baseUnit
+        FROM product_material_sku sku
+        LEFT JOIN product_material m ON sku.material_id = m.id
+        <where>
+            <if test="dto.materialId != null">
+                AND sku.material_id = #{dto.materialId}
+            </if>
+            <if test="dto.specification != null and dto.specification != ''">
+                AND sku.specification LIKE CONCAT('%', #{dto.specification}, '%')
+            </if>
+            <if test="dto.materialCode != null and dto.materialCode != ''">
+                AND sku.material_code LIKE CONCAT('%', #{dto.materialCode}, '%')
+            </if>
+
+            <if test="type != null and type == 1 and dto.materialName != null and dto.materialName != ''">
+                AND m.material_name LIKE CONCAT('%', #{dto.materialName}, '%')
+            </if>
+        </where>
+        ORDER BY sku.id ASC
+    </select>
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3