['business_nature', 'industry_nature', 'fund_sources', 'const_area'], '%like%' => ['contract_name', 'contract_num', 'part_a', 'part_b'], ]; } /** * @notes 获取待立项造价项目列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/02/20 14:16 */ public function lists(): array { return CostApprovedProject::where($this->searchWhere) ->field(['id', 'contract_name', 'contract_num', 'part_a', 'part_b', 'business_nature', 'industry_nature', 'fund_sources', 'const_area', 'project_money', 'start_date', 'end_date', 'dept', 'regulators', 'project_director']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $data['business_nature_text'] = $data->business_nature_text; $data['industry_nature_text'] = $data->industry_nature_text; $data['fund_sources_text'] = $data->fund_sources_text; $data['const_area_text'] = $data->const_area_text; }) ->toArray(); } /** * @notes 获取待立项造价项目数量 * @return int * @author likeadmin * @date 2024/02/20 14:16 */ public function count(): int { return CostApprovedProject::where($this->searchWhere)->count(); } }