lihaiMiddleOffice/app/psi/lists/WarehouseProductLists.php

66 lines
1.6 KiB
PHP

<?php
namespace app\psi\lists;
use app\common\lists\BaseDataLists;
use app\common\model\WarehouseProduct;
use app\common\lists\ListsSearchInterface;
/**
* PsiWarehouseProduct列表
* Class WarehouseProductLists
* @package app\psi\lists
*/
class WarehouseProductLists extends BaseDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author admin
* @date 2025/03/10 11:08
*/
public function setSearch(): array
{
return [
'=' => ['warehouse_id', 'supplier_id', 'store_id', 'order_type', 'product_id', 'oid', 'code', 'pay_type', 'status'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author admin
* @date 2025/03/10 11:08
*/
public function lists(): array
{
return WarehouseProduct::where($this->searchWhere)
->field(['id', 'warehouse_id', 'supplier_id', 'store_id', 'order_type', 'product_id', 'unit', 'oid', 'code', 'nums', 'refund_nums', 'before_nums', 'after_nums', 'mark', 'total_price', 'purchase', 'pay_type', 'status'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author admin
* @date 2025/03/10 11:08
*/
public function count(): int
{
return WarehouseProduct::where($this->searchWhere)->count();
}
}