['cost_project_id'], '%like%' => ['superior_sort', 'name'], ]; } /** * @notes 获取造价项目台账列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/02/21 09:23 */ public function lists(): array { $task_allocation = $this->request->param('task_allocation', 0); // 筛选出关联了任务类别的项目 if ($task_allocation == 1) { return CostProject::alias('p') ->join('task_type t', 'p.id=t.cost_project_id') ->where($this->searchWhere) ->field('p.*') ->limit($this->limitOffset, $this->limitLength) ->with(['contract']) ->order(['id' => 'desc']) ->select() ->toArray(); } return CostProject::where($this->searchWhere) ->field(['id', 'project_num', 'project_name', 'contract_id', 'types', 'industry', 'province', 'city', 'address', 'starting', 'endtime', 'jhgq', 'depar', 'principal', 'person', 'invest', 'budget', 'cost', 'approval', 'aunit', 'Acontact', 'acontactnum', 'date', 'generalize', 'note', 'remark', 'annex']) ->limit($this->limitOffset, $this->limitLength) ->with(['contract']) ->order(['id' => 'desc']) ->select() ->toArray(); } /** * @notes 获取造价项目台账数量 * @return int * @author likeadmin * @date 2024/02/21 09:23 */ public function count(): int { $task_allocation = $this->request->param('task_allocation', 0); // 筛选出关联了任务类别的项目 if ($task_allocation == 1) { return CostProject::alias('p')->join('task_type t', 'p.id=t.cost_project_id')->where($this->searchWhere)->count(); } return CostProject::where($this->searchWhere)->count(); } }