['project_id', 'cost_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 14:32 */ public function lists(): array { return ProjectCostBudgetDetail::where($this->searchWhere) ->field('id,project_id,cost_budget_id,project_cost_temp_id,unit,amount,standard,remark') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $cost_budget = ProjectCostBudget::field('cost_budget_code')->where('id',$data['cost_budget_id'])->findOrEmpty(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $project_cost_temp = ProjectCostTempSet::field('first_level_subject,second_level_subject,third_level_subject,is_travel')->where('id',$data['project_cost_temp_id'])->findOrEmpty(); $data['cost_budget_code'] = $cost_budget['cost_budget_code']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['first_level_subject'] = $project_cost_temp['first_level_subject']; $data['second_level_subject'] = $project_cost_temp['second_level_subject']; $data['third_level_subject'] = $project_cost_temp['third_level_subject']; $data['is_travel'] = $project_cost_temp['is_travel']; $data['is_travel_text'] = $project_cost_temp->is_travel_text; return $data; }) ->toArray(); } /** * @notes 获取费用预算明细数量 * @return int * @author likeadmin * @date 2024/01/16 14:32 */ public function count(): int { return ProjectCostBudgetDetail::where($this->searchWhere)->count(); } }