['rb.org_id', 'rb.dept_id', 'rb.acceptance_bill_id'], ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/20 11:01 */ public function lists(): array { return Db::name('RedemptionBill')->alias('rb') ->where($this->searchWhere) ->whereNull('rb.delete_time') ->leftJoin('orgs o','o.id = rb.org_id') ->leftJoin('dept d','d.id = rb.dept_id') ->leftJoin('acceptance_bill ab','ab.id = rb.acceptance_bill_id') ->leftJoin('bank_account ba','ba.id = ab.bank_account_id') ->field('rb.*, d.name as dept_name, o.name as org_name, ab.receipt_date, ab.bill_sn, ab.bill_type, ab.draft_acceptance_bank, ab.bill_due_date, ba.deposit_bank, ba.account_name, ba.account') ->limit($this->limitOffset, $this->limitLength) ->order(['rb.id' => 'desc']) ->select()->each(function($item, $key){ //关联数据后续添加 return $item; }) ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2023/12/20 11:01 */ public function count(): int { return Db::name('RedemptionBill')->alias('rb') ->where($this->searchWhere) ->whereNull('rb.delete_time') ->leftJoin('orgs o','o.id = rb.org_id') ->leftJoin('dept d','d.id = rb.dept_id') ->leftJoin('acceptance_bill ab','ab.id = rb.acceptance_bill_id')->count(); } }