['fia.customer_id', 'fia.contract_id', 'fia.invoicing_company_name'], ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/13 15:01 */ public function lists(): array { return Db::name('FinanceInvoiceApply')->alias('fia') ->where($this->searchWhere) ->whereNull('fia.delete_time') ->leftJoin('contract c','c.id = fia.contract_id') ->leftJoin('bid_buy_bidding_document bbbd','bbbd.id = c.buy_bidding_document_id') ->leftJoin('project p','p.id = bbbd.project_id') ->leftJoin('custom ct','ct.id = fia.customer_id') ->field('fia.*, bbbd.project_id, p.name as project_name, p.project_code, ct.name as customer_name') ->limit($this->limitOffset, $this->limitLength) ->order(['fia.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/13 15:01 */ public function count(): int { return Db::name('FinanceInvoiceApply')->alias('fia') ->where($this->searchWhere) ->whereNull('fia.delete_time') ->leftJoin('contract c','c.id = fia.contract_id') ->leftJoin('bid_buy_bidding_document bbbd','bbbd.id = c.buy_bidding_document_id') ->leftJoin('project p','p.id = bbbd.project_id') ->leftJoin('custom ct','ct.id = fia.customer_id')->count(); } }