['payment_type', 'apply_date','project_id'], '%like%' => ['payment_code'], ]; } /** * @notes 获取工资付款列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/27 16:08 */ public function lists(): array { return ProjectSalaryPayment::where($this->searchWhere) ->field(['id', 'payment_code', 'project_id', 'payment_type', 'apply_date', 'remark', 'annex']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty(); $item['project_name'] = $project['name']; $item['project_code'] = $project['project_code']; //总工资付款 $item['total_amount'] = ProjectSalaryDetail::where('salary_payment_id',$item['id'])->sum('apply_amount'); return $item; }) ->toArray(); } /** * @notes 获取工资付款数量 * @return int * @author likeadmin * @date 2023/12/27 16:08 */ public function count(): int { return ProjectSalaryPayment::where($this->searchWhere)->count(); } }