['c.org_id', 'c.dept_id', 'c.customer_id', 'c.contract_name', 'c.contract_type', 'c.contract_code'], ]; } /** * @notes 获取项目合同列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/02 17:19 */ public function lists(): array { return Db::name('Contract')->alias('c') ->where($this->searchWhere) ->whereNull('c.delete_time') ->leftJoin('bid_buy_bidding_document bbbd','bbbd.id = c.buy_bidding_document_id') ->leftJoin('orgs o','o.id = c.org_id') ->leftJoin('dept d','d.id = c.dept_id') ->leftJoin('project p','p.id = bbbd.project_id') ->leftJoin('custom ct','ct.id = c.customer_id') ->field('c.*, d.name as dept_name, o.name as org_name, bbbd.project_id, p.name as project_name, p.project_code, ct.name as customer_name') ->limit($this->limitOffset, $this->limitLength) ->order(['c.id' => 'desc']) ->select()->each(function($item, $key){ //关联数据后续添加 $item['approve_no'] = '付款单号'; $item['approve_step'] = '流程步骤'; $item['approve_settle_status'] = 1; return $item; }) ->toArray(); } /** * @notes 获取项目合同数量 * @return int * @author likeadmin * @date 2023/12/02 17:19 */ public function count(): int { return Db::name('Contract')->alias('c') ->where($this->searchWhere) ->whereNull('c.delete_time') ->leftJoin('bid_buy_bidding_document bbbd','c.id = c.buy_bidding_document_id') ->leftJoin('project p','p.id = bbbd.project_id') ->leftJoin('custom ct','ct.id = c.customer_id')->count(); } }