['project_type', 'project_content', 'project_estimation', 'estimated_construction', 'bidding_time', 'bidding_method', 'contacts', 'position', 'telephone', 'department', 'person', 'relationship', 'discovery_time', 'information_sources', 'competitor', 'construction_funds_sources', 'construction_payment_method', 'construction_financial_status', 'construction_recognition', 'my_construction_recognition', 'strategic_significance', 'industry', 'unit_nature', 'annex', 'status'], '%like%' => ['project_code','project_address'] ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/11/12 14:30 */ public function lists(): array { $params = $this->request->param(); $condition = []; if(isset($params['custom_id']) && $params['custom_id'] != ''){ $customIds = Custom::where('name','like','%'.$params['custom_id'].'%')->column('id'); $condition[] = ['custom_id','in',$customIds]; } return Project::where($this->searchWhere)->where($condition) ->field(['id', 'custom_id', 'project_type', 'project_code', 'project_content', 'project_estimation', 'project_address', 'estimated_construction', 'bidding_time', 'bidding_method', 'contacts', 'position', 'telephone', 'department', 'person', 'relationship', 'discovery_time', 'information_sources', 'competitor', 'construction_funds_sources', 'construction_payment_method', 'construction_financial_status', 'construction_recognition', 'my_construction_recognition', 'strategic_significance', 'industry', 'unit_nature', 'annex', 'status']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $custom = Custom::field('name')->where('id',$item['custom_id'])->findOrEmpty(); $item['custom_name'] = $custom->isEmpty() ? '' : $custom['name']; return $item; }) ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2023/11/12 14:30 */ public function count(): int { return Project::where($this->searchWhere)->count(); } }