value('category_super_path'); $categoryPath .= '#5#'; $categoryIds = SysCategory::where('category_super_path', 'like', $categoryPath . '%')->pluck('category_id')->toArray(); $categoryIds[] = 5; if (!empty($categoryIds)) { $categoryId = $categoryIds; } else { $categoryId = [5]; } $data['storageWarning'] = GoodsRunning::leftJoin('goods','goods.goods_id','=','goods_running.join_running_goods_id') ->where("goods_running_storage",'<=',2) ->whereIn('goods.join_goods_category_id',$categoryId) ->count(); return $data; } }