['cost_subject_id', 'cost_budget_adjust_id'], ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/18 15:06 */ public function lists(): array { return Db::name('CostBudgetAdjustDetail')->alias('cbad') ->where($this->searchWhere) ->whereNull('cbad.delete_time') ->leftJoin('cost_subject cs','cs.id = cbad.cost_subject_id') ->leftJoin('cost_budget_adjust cbd','cbd.id = cbad.cost_budget_adjust_id') ->leftJoin('orgs o','o.id = cbd.org_id') ->leftJoin('dept d','d.id = cbd.dept_id') ->field('cbad.*, d.name as dept_name, o.name as org_name, cbd.years, cbd.document_preparation_time, cs.sn, cs.subject1, cs.subject2') ->limit($this->limitOffset, $this->limitLength) ->order(['cbad.id' => 'desc']) ->select()->each(function($item, $key){ return $item; }) ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2023/12/18 15:06 */ public function count(): int { return Db::name('CostBudgetAdjustDetail')->alias('cbad') ->where($this->searchWhere) ->whereNull('cbad.delete_time') ->leftJoin('cost_subject cs','cs.id = cbad.cost_subject_id') ->leftJoin('cost_budget_adjust cbd','cbd.id = cbad.cost_budget_adjust_id') ->leftJoin('orgs o','o.id = cbd.org_id') ->leftJoin('dept d','d.id = cbd.dept_id')->count(); } }