Commit 24015c64 by 杨树贤

查询语句

parent d48779b2
...@@ -259,16 +259,12 @@ class SupplierFilter ...@@ -259,16 +259,12 @@ class SupplierFilter
break; break;
//附件里面缺少品质协议的 //附件里面缺少品质协议的
case "no_quality_assurance_agreement": case "no_quality_assurance_agreement":
// $query->whereHas('attachment', function ($q) {
// $q->where('field_name', '!=', 'quality_assurance_agreement');
// });
$query->leftjoin('supplier_attachments', 'supplier_channel.supplier_id', '=', $query->leftjoin('supplier_attachments', 'supplier_channel.supplier_id', '=',
'supplier_attachments.supplier_id') 'supplier_attachments.supplier_id')
->selectRaw('lie_supplier_channel.*, ->selectRaw('lie_supplier_channel.*,
lie_supplier_attachments.field_name,lie_supplier_attachments.supplier_id as supplier_attachments_supplier_id') lie_supplier_attachments.field_name,lie_supplier_attachments.supplier_id as supplier_attachments_supplier_id')
->where(function ($q) { ->where(function ($q) {
$q->where('supplier_attachments.field_name', '!=','quality_assurance_agreement') $q->whereRaw("(SELECT count(1) FROM lie_supplier_attachments WHERE `lie_supplier_attachments`.`supplier_id` = `lie_supplier_channel`.`supplier_id` AND `lie_supplier_attachments`.field_name = 'quality_assurance_agreement') = 0");
->orWhereNull('supplier_attachments.supplier_id');
}); });
// $query->whereNotIn('status', // $query->whereNotIn('status',
// [SupplierChannelModel::STATUS_DISABLE, SupplierChannelModel::STATUS_BLOCK]); // [SupplierChannelModel::STATUS_DISABLE, SupplierChannelModel::STATUS_BLOCK]);
......
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