['project_id', 'bidding_project_fund_source', 'bid_type', 'is_margin'], '%like%' => ['code'] ]; } /** * @notes 获取投标决策列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/11/27 18:14 */ public function lists(): array { $params = $this->request->get(['project_name','custom_name']); $where = []; if(isset($params['project_name']) && $params['project_name'] != ''){ $project_ids = Project::where('name','like','%'.$params['project_name'].'%')->column('id'); $where[] = ['project_id','in',$project_ids]; } if(isset($params['custom_name']) && $params['custom_name'] != ''){ $custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id'); $project_ids = Project::where('custom_id','in',$custom_ids)->column('id'); $where[] = ['project_id','in',$project_ids]; } return BidBiddingDecision::where($this->searchWhere)->where($where)->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $project = Project::field('custom_id,name,project_code')->where('id',$item['project_id'])->findOrEmpty(); $custom = Custom::field('id,name')->where('id',$project['custom_id'])->findOrEmpty(); $item['project_name'] = $project['name']; $item['project_code'] = $project['project_code']; $item['custom_id'] = $custom['id']; $item['custom_name'] = $custom['name']; $item['bidding_project_fund_source'] = $item->bidding_project_fund_source_text; $item['bid_type'] = $item->bid_type_text; $item['is_margin'] = $item->is_margin_text; $item['is_internal_resources'] = $item->is_internal_resources_text; $item['project_assurance'] = $item->project_assurance_text; unset($item['org_id'],$item['dept_id'],$item['delete_time']); return $item; }) ->toArray(); } /** * @notes 获取投标决策数量 * @return int * @author likeadmin * @date 2023/11/27 18:14 */ public function count(): int { $params = $this->request->get(['project_name','custom_name']); $where = []; if(isset($params['project_name']) && $params['project_name'] != ''){ $project_ids = Project::where('name','like','%'.$params['project_name'].'%')->column('id'); $where[] = ['project_id','in',$project_ids]; } if(isset($params['custom_name']) && $params['custom_name'] != ''){ $custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id'); $project_ids = Project::where('custom_id','in',$custom_ids)->column('id'); $where[] = ['project_id','in',$project_ids]; } return BidBiddingDecision::where($this->searchWhere)->where($where)->count(); } }