['project_id', 'material_entry_id'], '%like%' => ['code', 'witness', 'sampler'], ]; } /** * @notes 获取工程监理--见证取样列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/02/29 09:22 */ public function lists(): array { return SupervisionWitnessSampling::withoutField('create_user,create_time,update_time,delete_time')->where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty(); $material_entry = SupervisionMaterialEntry::field('company_id,enter_time')->where('id',$data['material_entry_id'])->findOrEmpty(); $company = SupervisionParticipatingUnits::field('unit_name')->where('id',$material_entry['company_id'])->findOrEmpty(); $data['project_name'] = $project['project_name']; $data['company_name'] = $company['unit_name']; $data['enter_time'] = $material_entry['enter_time']; }) ->toArray(); } /** * @notes 获取工程监理--见证取样数量 * @return int * @author likeadmin * @date 2024/02/29 09:22 */ public function count(): int { return SupervisionWitnessSamplingDetail::where($this->searchWhere)->count(); } }