['project_id', 'directory_id'], '%like%' => ['title'], ]; } /** * @notes 获取项目咨询--总控管理列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/03/11 14:44 */ public function lists(): array { return ConsultControl::where($this->searchWhere) ->field(['id', 'project_id', 'title', 'directory_id', 'subdirectory_id']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $project = ConsultProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty(); $directory = ConsultDirectory::field('name')->where('id',$data['directory_id'])->findOrEmpty(); $subdirectory = ConsultSubdirectory::field('name')->where('id',$data['subdirectory_id'])->findOrEmpty(); $data['project_name'] = $project['project_name']; $data['directory_name'] = $directory['name']; $data['subdirectory_name'] = $subdirectory['name']; }) ->toArray(); } /** * @notes 获取项目咨询--总控管理数量 * @return int * @author likeadmin * @date 2024/03/11 14:44 */ public function count(): int { return ConsultControl::where($this->searchWhere)->count(); } }