erp/app/admin/lists/goods/CodeLists.php
2024-04-23 18:03:12 +08:00

65 lines
1.4 KiB
PHP

<?php
namespace app\admin\lists\goods;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\goods\Code;
use app\common\lists\ListsSearchInterface;
/**
* 条码管理列表
* Class CodeLists
* @package app\admin\listsgoods
*/
class CodeLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function setSearch(): array
{
return [
'=' => ['name', 'py', 'code', 'type', 'data', 'more', '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 10:54
*/
public function lists(): array
{
return Code::where($this->searchWhere)
->field(['id', 'name', 'py', 'code', 'type', 'data', 'more', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取条码管理数量
* @return int
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function count(): int
{
return Code::where($this->searchWhere)->count();
}
}