yzc 1 rok temu
rodzic
commit
cc44a6b8b0

+ 2 - 5
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java

@@ -185,12 +185,12 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         if (ObjectUtil.isNotEmpty(isRawMaterial)) {
             if (isRawMaterial.equals(1)) {
                 //过滤有配置原材料的产品
-                wrapper.isNotNull("pi.raw_material_id");
+                wrapper.eq("t1.isRawMaterial", 1);
                 //同时过滤未配置工艺的的产品
                 wrapper.isNotNull("pi.technology_id");
             } else {
                 //过滤没原材料的产品
-                wrapper.isNull("pi.raw_material_id");
+                wrapper.eq("t1.isRawMaterial", 0);
             }
         }
 
@@ -347,9 +347,6 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
 
         //保存产品定制信息
         saveOrEditCustomInfo(productInfoDto);
-        if (true) {
-            throw new ServiceException("1111111111111111111");
-        }
     }
 
 //    /**

+ 4 - 0
hx-item/src/main/resources/mapper/product/ProductInfoMapper.xml

@@ -45,6 +45,10 @@
                pi.attr_raw_material_id,
                pi.business_cost_price
         FROM product_info pi
+                 LEFT JOIN (SELECT IF(SUM(IF(type = 1, 1, 0)) > 0, 1, 0) AS isRawMaterial,
+                                   pbd.product_id
+                            FROM product_bom_detail pbd
+                            GROUP BY pbd.product_id) t1 ON t1.product_id = pi.id
     </sql>
 
     <select id="getPage" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">