['ab.org_id', 'ab.dept_id', 'ab.customer_id', 'ab.project_id', 'ab.contract_id', 'ab.bill_sn', 'ab.bank_account_id', 'ab.bill_type'], ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/19 15:18 */ public function lists(): array { return Db::name('AcceptanceBill')->alias('ab') ->where($this->searchWhere) ->whereNull('ab.delete_time') ->leftJoin('orgs o','o.id = ab.org_id') ->leftJoin('dept d','d.id = ab.dept_id') ->leftJoin('project p','p.id = ab.project_id') ->leftJoin('contract c','c.id = ab.contract_id') ->leftJoin('custom ct','ct.id = ab.customer_id') ->leftJoin('bank_account ba','ba.id = ab.bank_account_id') ->field('ab.*, d.name as dept_name, o.name as org_name, ct.name as customer_name, p.name as project_name, c.contract_code, c.contract_name, ba.deposit_bank, ba.account_name, ba.account') ->limit($this->limitOffset, $this->limitLength) ->order(['ab.id' => 'desc']) ->select()->each(function($item, $key){ //关联数据后续添加 $item['supplier_name'] = '供应商名称'; $item['approve_no'] = '付款单号'; $item['approve_step'] = '流程步骤'; $item['approve_settle_status'] = 1; $item['pay_amount'] = 1; $item['cash_amount'] = 2; $item['balance'] = 3; return $item; }) ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2023/12/19 15:18 */ public function count(): int { return Db::name('AcceptanceBill')->alias('ab') ->where($this->searchWhere) ->whereNull('ab.delete_time') ->leftJoin('orgs o','o.id = ab.org_id') ->leftJoin('dept d','d.id = ab.dept_id') ->leftJoin('project p','p.id = ab.project_id') ->leftJoin('contract c','c.id = ab.contract_id') ->leftJoin('custom ct','ct.id = ab.customer_id')->count(); } }