Commit d48779b2 by 杨树贤

查询语句

parent 27e2d142
Showing with 18 additions and 9 deletions
......@@ -107,8 +107,14 @@ class SupplierFilter
}
//默认过滤带有-1字符串的供应商名称的数据
$query->whereRaw('supplier_name NOT LIKE "%-1"');
if (config('website.domain') == 'liexin.net' && !in_array(request()->user->userId, [1611, 1499, 1354, 1613])) {
$query->where('supplier_id', '>', 12211);
if (config('website.domain') == 'liexin.net' && !in_array(request()->user->userId, [
1611,
1499,
1354,
1613,
1000
])) {
$query->where('supplier_channel.supplier_id', '>', 12211);
}
return $query;
}
......@@ -253,16 +259,19 @@ class SupplierFilter
break;
//附件里面缺少品质协议的
case "no_quality_assurance_agreement":
$query->leftjoin('supplier_attachment', 'supplier_channel.supplier_id', '=',
'supplier_attachment.supplier_id')
// $query->whereHas('attachment', function ($q) {
// $q->where('field_name', '!=', 'quality_assurance_agreement');
// });
$query->leftjoin('supplier_attachments', 'supplier_channel.supplier_id', '=',
'supplier_attachments.supplier_id')
->selectRaw('lie_supplier_channel.*,
lie_supplier_attachment.quality_assurance_agreement,lie_supplier_attachment.supplier_id as supplier_attachment_supplier_id')
lie_supplier_attachments.field_name,lie_supplier_attachments.supplier_id as supplier_attachments_supplier_id')
->where(function ($q) {
$q->where('supplier_attachment.quality_assurance_agreement', '')
->orWhereNull('supplier_attachment.supplier_id');
$q->where('supplier_attachments.field_name', '!=','quality_assurance_agreement')
->orWhereNull('supplier_attachments.supplier_id');
});
$query->whereNotIn('status',
[SupplierChannelModel::STATUS_DISABLE, SupplierChannelModel::STATUS_BLOCK]);
// $query->whereNotIn('status',
// [SupplierChannelModel::STATUS_DISABLE, SupplierChannelModel::STATUS_BLOCK]);
//而且还是现货商类型的供应商
$query->where('supplier_group', 2);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment