feat: 优化 SystemStoreStorageLists 类中的查询逻辑
This commit is contained in:
parent
c8b5607300
commit
2df0bf5c1f
@ -29,7 +29,7 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['admin_id', 'staff_id', 'status','type'],
|
'=' => ['admin_id', 'staff_id', 'status', 'type'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,12 +45,12 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
$this->searchWhere[] = ['store_id','=',$this->adminInfo['store_id']];//只显示当前门店的入库记录
|
$this->searchWhere[] = ['store_id', '=', $this->adminInfo['store_id']]; //只显示当前门店的入库记录
|
||||||
if($this->request->__get('status')==-1){
|
if ($this->request->__get('status') == -1) {
|
||||||
$this->searchWhere[] = ['status','>=',0];
|
$this->searchWhere[] = ['status', '>=', 0];
|
||||||
}
|
}
|
||||||
return SystemStoreStorage::where($this->searchWhere)
|
return SystemStoreStorage::where($this->searchWhere)
|
||||||
->field(['id', 'store_id', 'admin_id', 'staff_id', 'product_id', 'nums','mark', 'status'])
|
->field(['id', 'store_id', 'admin_id', 'staff_id', 'product_id', 'nums', 'mark', 'status'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['status' => 'aes'])
|
->order(['status' => 'aes'])
|
||||||
->select()->each(function ($item) {
|
->select()->each(function ($item) {
|
||||||
@ -62,9 +62,15 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
} else {
|
} else {
|
||||||
$item['staff_name'] = '无';
|
$item['staff_name'] = '无';
|
||||||
}
|
}
|
||||||
$find=StoreProduct::where('id',$item['product_id'])->field('store_name,image')->find();
|
$find = StoreProduct::where('id', $item['product_id'])->field('store_name,image')->find();
|
||||||
$item['store_name']=$find['store_name'];
|
if ($find) {
|
||||||
$item['image']=$find['image'];
|
$item['store_name'] = $find['store_name'];
|
||||||
|
$item['image'] = $find['image'];
|
||||||
|
} else {
|
||||||
|
$item['store_name'] = '';
|
||||||
|
$item['image'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
@ -81,5 +87,4 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
{
|
{
|
||||||
return SystemStoreStorage::where($this->searchWhere)->count();
|
return SystemStoreStorage::where($this->searchWhere)->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user