multi-store/app/admin/lists/warehouse/WarehouseLists.php

65 lines
1.4 KiB
PHP

<?php
namespace app\admin\lists\warehouse;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\warehouse\Warehouse;
use app\common\lists\ListsSearchInterface;
/**
* 仓库信息列表
* Class WarehouseLists
* @package app\admin\listswarehouse
*/
class WarehouseLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author admin
* @date 2024/07/31 16:10
*/
public function setSearch(): array
{
return [
'=' => ['name', 'contacts', 'tel'],
];
}
/**
* @notes 获取仓库信息列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author admin
* @date 2024/07/31 16:10
*/
public function lists(): array
{
return Warehouse::where($this->searchWhere)
->field(['id', 'name', 'code', 'contacts', 'tel', 'address', 'notes', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取仓库信息数量
* @return int
* @author admin
* @date 2024/07/31 16:10
*/
public function count(): int
{
return Warehouse::where($this->searchWhere)->count();
}
}