['scn.subcontracting_contract_id', 'scn.negotiation_name', 'scn.negotiation_no', 'scn.negotiation_type'], ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/12 17:21 */ public function lists(): array { return Db::name('SubcontractingContractNegotiation')->alias('scn') ->where($this->searchWhere) ->whereNull('scn.delete_time') ->leftJoin('orgs o','o.id = scn.org_id') ->leftJoin('dept d','d.id = scn.dept_id') ->leftJoin('procurement_contract pc','pc.id = scn.subcontracting_contract_id') ->leftJoin('project p','p.id = pc.project_id') ->field('scn.*, d.name as dept_name, o.name as org_name, p.name as project_name, p.project_code, pc.contract_no, pc.contract_name') ->limit($this->limitOffset, $this->limitLength) ->order(['scn.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/12 17:21 */ public function count(): int { return Db::name('SubcontractingContractNegotiation')->alias('scn') ->where($this->searchWhere) ->whereNull('scn.delete_time') ->leftJoin('orgs o','o.id = scn.org_id') ->leftJoin('dept d','d.id = scn.dept_id') ->leftJoin('procurement_contract pc','pc.id = scn.subcontracting_contract_id') ->leftJoin('project p','p.id = pc.project_id')->count(); } }