|
|
@@ -252,6 +252,15 @@ class OwnerService
|
|
|
});
|
|
|
continue;
|
|
|
}
|
|
|
+ if ($column == 'customers'){
|
|
|
+ if (is_array($param))$builder->whereIn('customer_id',$param);
|
|
|
+ else $builder->where('customer_id',$param);
|
|
|
+ }
|
|
|
+ if ($column == 'ids'){
|
|
|
+ if (is_array($param))$builder->whereIn('id',$param);
|
|
|
+ else $builder->where('id',$param);
|
|
|
+ }
|
|
|
+
|
|
|
if (is_array($param))$builder->whereIn($column,$param);
|
|
|
else $builder->where($column,$param);
|
|
|
}
|
|
|
@@ -385,37 +394,37 @@ sql
|
|
|
{
|
|
|
$relevance = [];
|
|
|
$sql = <<<sql
|
|
|
-SELECT 1 FROM owner_storage_price_models a
|
|
|
-LEFT JOIN owner_storage_price_model_owner b ON a.id = b.owner_storage_price_model_id
|
|
|
-LEFT JOIN owners c ON b.owner_id = c.id
|
|
|
+SELECT 1 FROM owner_storage_price_models a
|
|
|
+LEFT JOIN owner_storage_price_model_owner b ON a.id = b.owner_storage_price_model_id
|
|
|
+LEFT JOIN owners c ON b.owner_id = c.id
|
|
|
WHERE (a.operation IS NULL OR a.operation = '') AND c.id = ? LIMIT 1
|
|
|
sql;
|
|
|
if (DB::selectOne(DB::raw($sql),[$ownerId]))$relevance[] = 0;
|
|
|
$sql = <<<sql
|
|
|
-SELECT 1 FROM owner_price_operations a
|
|
|
-LEFT JOIN owner_price_operation_owner b ON a.id = b.owner_price_operation_id
|
|
|
-LEFT JOIN owners c ON b.owner_id = c.id
|
|
|
+SELECT 1 FROM owner_price_operations a
|
|
|
+LEFT JOIN owner_price_operation_owner b ON a.id = b.owner_price_operation_id
|
|
|
+LEFT JOIN owners c ON b.owner_id = c.id
|
|
|
WHERE (a.operation IS NULL OR a.operation = '') AND c.id = ? LIMIT 1
|
|
|
sql;
|
|
|
if (DB::selectOne(DB::raw($sql),[$ownerId]))$relevance[] = 1;
|
|
|
$sql = <<<sql
|
|
|
-SELECT 1 FROM owner_price_expresses a
|
|
|
-LEFT JOIN owner_price_express_owner b ON a.id = b.owner_price_express_id
|
|
|
-LEFT JOIN owners c ON b.owner_id = c.id
|
|
|
+SELECT 1 FROM owner_price_expresses a
|
|
|
+LEFT JOIN owner_price_express_owner b ON a.id = b.owner_price_express_id
|
|
|
+LEFT JOIN owners c ON b.owner_id = c.id
|
|
|
WHERE (a.operation IS NULL OR a.operation = '') AND c.id = ? LIMIT 1
|
|
|
sql;
|
|
|
if (DB::selectOne(DB::raw($sql),[$ownerId]))$relevance[] = 2;
|
|
|
$sql = <<<sql
|
|
|
-SELECT 1 FROM owner_price_logistics a
|
|
|
-LEFT JOIN owner_price_logistic_owner b ON a.id = b.owner_price_logistic_id
|
|
|
-LEFT JOIN owners c ON b.owner_id = c.id
|
|
|
+SELECT 1 FROM owner_price_logistics a
|
|
|
+LEFT JOIN owner_price_logistic_owner b ON a.id = b.owner_price_logistic_id
|
|
|
+LEFT JOIN owners c ON b.owner_id = c.id
|
|
|
WHERE (a.operation IS NULL OR a.operation = '') AND c.id = ? LIMIT 1
|
|
|
sql;
|
|
|
if (DB::selectOne(DB::raw($sql),[$ownerId]))$relevance[] = 3;
|
|
|
$sql = <<<sql
|
|
|
-SELECT 1 FROM owner_price_direct_logistics a
|
|
|
-LEFT JOIN owner_price_direct_logistic_owner b ON a.id = b.owner_price_direct_logistic_id
|
|
|
-LEFT JOIN owners c ON b.owner_id = c.id
|
|
|
+SELECT 1 FROM owner_price_direct_logistics a
|
|
|
+LEFT JOIN owner_price_direct_logistic_owner b ON a.id = b.owner_price_direct_logistic_id
|
|
|
+LEFT JOIN owners c ON b.owner_id = c.id
|
|
|
WHERE (a.operation IS NULL OR a.operation = '') AND c.id = ? LIMIT 1
|
|
|
sql;
|
|
|
if (DB::selectOne(DB::raw($sql),[$ownerId]))$relevance[] = 4;
|