request->get(); $where = []; if(!empty($params['task_allocation_num'])){ $task_allocation_ids = TaskAllocation::where('num','like','%'.$params['task_allocation_num'].'%')->column('id'); $where[] = ['task_allocation_id','in',$task_allocation_ids]; } return TaskDetail::where($this->searchWhere)->where($where) ->with(['taskTypeInfo', 'taskAllocation']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $task_allocation = TaskAllocation::field('num')->where('id',$data['task_allocation_id'])->findOrEmpty(); $data['task_allocation_num'] = $task_allocation['num']; }) ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2024/02/22 11:58 */ public function count(): int { $params = $this->request->get(); $where = []; if(!empty($params['task_allocation_num'])){ $task_allocation_ids = TaskAllocation::where('num','like','%'.$params['task_allocation_num'].'%')->column('id'); $where[] = ['task_allocation_id','in',$task_allocation_ids]; } return TaskDetail::where($this->searchWhere)->where($where)->count(); } }