['project_id'], ]; } /** * @notes 获取成本调整列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/01/17 13:43 */ public function lists(): array { return ProjectCostAdjustment::where($this->searchWhere) ->field(['id', 'project_id', 'adjust_date', 'adjust_amount', 'remark', 'annex']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; return $data; }) ->toArray(); } /** * @notes 获取成本调整数量 * @return int * @author likeadmin * @date 2024/01/17 13:43 */ public function count(): int { return ProjectCostAdjustment::where($this->searchWhere)->count(); } }