供货商查询改为左连接
This commit is contained in:
parent
f665d799c6
commit
95f48e9e79
@ -58,7 +58,7 @@ class GoodsLogic extends Logic
|
||||
['g.del', '<>', GoodsEnum::DEL_TRUE],
|
||||
['g.shop_id', '=', $shop_id]
|
||||
];
|
||||
$goods_list = Goods::alias('g') ->join('supplier s', 'g.supplier_id = s.id')->where($where)
|
||||
$goods_list = Goods::alias('g') ->leftJoin('supplier s', 'g.supplier_id = s.id')->where($where)
|
||||
->field('g.id,g.status,g.stock,g.stock_warn,g.audit_status,g.del')
|
||||
->select();
|
||||
|
||||
@ -189,14 +189,14 @@ class GoodsLogic extends Logic
|
||||
];
|
||||
|
||||
$lists = Goods::alias('g')
|
||||
->join('supplier s', 'g.supplier_id = s.id')
|
||||
->leftJoin('supplier s', 'g.supplier_id = s.id')
|
||||
->field('g.*, s.id as sid')
|
||||
->where($where)
|
||||
->append(['is_distribution_desc'])
|
||||
->page($get['page'], $get['limit'])
|
||||
->order($order)
|
||||
->select();
|
||||
$count = Goods::alias('g')->join('supplier s', 'g.supplier_id = s.id')->where($where)->count();
|
||||
$count = Goods::alias('g')->leftJoin('supplier s', 'g.supplier_id = s.id')->where($where)->count();
|
||||
if($count) {
|
||||
$lists = $lists->toArray();
|
||||
}else{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user