perf(warehouse): 优化产品搜索功能
- 移除了在搜索产品时对已删除产品的查询,提高搜索效率 - 注释掉了在获取列表时对已删除数据的查询,准备后续彻底移除
This commit is contained in:
parent
ae40c1940f
commit
304e0d3199
@ -54,7 +54,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
{
|
{
|
||||||
if ($this->request->get('product_id')) {
|
if ($this->request->get('product_id')) {
|
||||||
$product_id = $this->request->get('product_id');
|
$product_id = $this->request->get('product_id');
|
||||||
$ids = StoreProduct::where('store_name', 'like', '%' . $product_id . '%')->withTrashed()->column('id');
|
$ids = StoreProduct::where('store_name', 'like', '%' . $product_id . '%')->column('id');
|
||||||
if ($ids) {
|
if ($ids) {
|
||||||
$this->searchWhere[] = ['product_id', 'in', $ids];
|
$this->searchWhere[] = ['product_id', 'in', $ids];
|
||||||
$this->ids = $ids;
|
$this->ids = $ids;
|
||||||
@ -64,7 +64,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
}
|
}
|
||||||
if ($this->request->get('bar_code')) {
|
if ($this->request->get('bar_code')) {
|
||||||
$bar_code = $this->request->get('bar_code');
|
$bar_code = $this->request->get('bar_code');
|
||||||
$ids = StoreProduct::where('bar_code', 'like', '%' . $bar_code . '%')->withTrashed()->column('id');
|
$ids = StoreProduct::where('bar_code', 'like', '%' . $bar_code . '%')->column('id');
|
||||||
if ($ids) {
|
if ($ids) {
|
||||||
$this->searchWhere[] = ['product_id', 'in', $ids];
|
$this->searchWhere[] = ['product_id', 'in', $ids];
|
||||||
$this->ids = $ids;
|
$this->ids = $ids;
|
||||||
@ -76,7 +76,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
->field(['id', 'code','pay_type','oid','admin_id','supplier_id', 'store_id', 'warehouse_id', 'product_id', 'financial_pm', 'batch', 'nums', 'price', 'purchase', 'cost', 'total_price', 'manufacture', 'expiration_date', 'status', 'mark', 'create_time','is_pay'])
|
->field(['id', 'code','pay_type','oid','admin_id','supplier_id', 'store_id', 'warehouse_id', 'product_id', 'financial_pm', 'batch', 'nums', 'price', 'purchase', 'cost', 'total_price', 'manufacture', 'expiration_date', 'status', 'mark', 'create_time','is_pay'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->withTrashed()
|
// ->withTrashed()
|
||||||
->select()->each(function ($item) {
|
->select()->each(function ($item) {
|
||||||
$item->store_name = '';
|
$item->store_name = '';
|
||||||
$item->image = '';
|
$item->image = '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user