['project_id', 'labor_budget_id'], ]; } /** * @notes 获取人工预算明细列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/01/16 09:26 */ public function lists(): array { return ProjectLaborBudgetDetail::where($this->searchWhere) ->field('id,project_id,labor_budget_id,job_type_id,desc,unit,num,price,amount,remark') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $labor_budget = ProjectLaborBudget::field('labor_budget_code')->where('id',$data['labor_budget_id'])->findOrEmpty(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $job_type = ProjectJobType::field('type_name')->where('id',$data['job_type_id'])->findOrEmpty(); $data['labor_budget_code'] = $labor_budget['labor_budget_code']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['job_type_name'] = $job_type['type_name']; return $data; }) ->toArray(); } /** * @notes 获取人工预算明细数量 * @return int * @author likeadmin * @date 2024/01/16 09:26 */ public function count(): int { return ProjectLaborBudgetDetail::where($this->searchWhere)->count(); } }