66 lines
1.6 KiB
PHP
66 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace app\admin\lists\goods;
|
|
|
|
|
|
use app\admin\lists\BaseAdminDataLists;
|
|
use app\common\model\goods\Goods;
|
|
use app\common\lists\ListsSearchInterface;
|
|
|
|
|
|
/**
|
|
* 商品列表列表
|
|
* Class GoodsLists
|
|
* @package app\admin\listsgoods
|
|
*/
|
|
class GoodsLists extends BaseAdminDataLists implements ListsSearchInterface
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 设置搜索条件
|
|
* @return \string[][]
|
|
* @author likeadmin
|
|
* @date 2024/04/23 11:28
|
|
*/
|
|
public function setSearch(): array
|
|
{
|
|
return [
|
|
'=' => ['name', 'class', 'brand', 'unit', 'code', 'warehouse', 'retail_name', 'sort'],
|
|
];
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取商品列表列表
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @author likeadmin
|
|
* @date 2024/04/23 11:28
|
|
*/
|
|
public function lists(): array
|
|
{
|
|
return Goods::where($this->searchWhere)
|
|
// ->field(['id', 'name', 'py', 'number', 'spec', 'class', 'brand', 'unit', 'buy', 'sell', 'retail', 'code', 'warehouse', 'location', 'stocktip', 'retail_name', 'imgs', 'data', 'sort'])
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
->with(['className','brandName','unitName','warehouseName'])
|
|
->order(['id' => 'desc'])
|
|
->select()
|
|
->toArray();
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取商品列表数量
|
|
* @return int
|
|
* @author likeadmin
|
|
* @date 2024/04/23 11:28
|
|
*/
|
|
public function count(): int
|
|
{
|
|
return Goods::where($this->searchWhere)->count();
|
|
}
|
|
|
|
} |