67 lines
1.4 KiB
PHP
67 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace app\admin\lists;
|
|
|
|
|
|
use app\admin\lists\BaseAdminDataLists;
|
|
use app\common\model\ProjectDishes;
|
|
use app\common\lists\ListsSearchInterface;
|
|
|
|
|
|
/**
|
|
* ProjectDishes列表
|
|
* Class ProjectDishesLists
|
|
* @package app\admin\lists
|
|
*/
|
|
class ProjectDishesLists extends BaseAdminDataLists implements ListsSearchInterface
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 设置搜索条件
|
|
* @return \string[][]
|
|
* @author likeadmin
|
|
* @date 2025/07/16 15:09
|
|
*/
|
|
public function setSearch(): array
|
|
{
|
|
return [
|
|
'=' => ['project_id', 'dishes_id'],
|
|
];
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取列表
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @author likeadmin
|
|
* @date 2025/07/16 15:09
|
|
*/
|
|
public function lists(): array
|
|
{
|
|
return ProjectDishes::where($this->searchWhere)
|
|
->with(['dishes', 'project'])
|
|
->field(['id', 'project_id', 'dishes_id', 'consume_time', 'create_time'])
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
->order(['id' => 'desc'])
|
|
->select()
|
|
->toArray();
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取数量
|
|
* @return int
|
|
* @author likeadmin
|
|
* @date 2025/07/16 15:09
|
|
*/
|
|
public function count(): int
|
|
{
|
|
return ProjectDishes::where($this->searchWhere)->count();
|
|
}
|
|
|
|
}
|