Browse Source

餐品加供应商

gorden 8 months ago
parent
commit
9f82992e96
1 changed files with 6 additions and 0 deletions
  1. 6 0
      app/admin/service/goods/GoodsService.php

+ 6 - 0
app/admin/service/goods/GoodsService.php

@@ -154,6 +154,8 @@ class GoodsService
         $goodsName = $request->get('goods_name', '');
         $categoryId = $request->get('join_goods_category_id', null);
         $goodsCategory = $request->get('goods_category', null);
+        $goodsSupplierId = $request->get('join_goods_supplier_id', null);
+        $goodsStatus = $request->get('goods_status', null);
         $type = $request->get('type','');
         if ($categoryId != null) {
             $categoryPath = SysCategory::where('category_id', $categoryId)->value('category_super_path');
@@ -202,6 +204,10 @@ class GoodsService
                 if ($type == 'storageWarning'){
                     $query->where('goods_running.goods_running_storage','<=',2);
                 }
+            })->when(!empty($goodsSupplierId),function($query) use ($goodsSupplierId){
+                $query->where('join_goods_supplier_id', $goodsSupplierId);
+            })->when(!empty($goodsStatus),function($query) use ($goodsStatus){
+                $query->where('goods_status', $goodsStatus);
             })
             ->orderBy('goods_sort', 'DESC')
             ->orderBy('goods_addtimes', 'DESC')