['theme', 'code', 'create_user'], ]; } /** * @notes 获取财务管理--费用申请列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/03/27 14:53 */ public function lists(): array { $params = $this->request->get(); $where = []; if (!empty($params['create_time'])) { $date = explode(',', $params['create_time']); $where[] = ['create_time', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]]; } return FinancialFeeApplication::withoutField('update_time,delete_time')->where($this->searchWhere)->where($where) ->field(['id', 'theme', 'code', 'days', 'remark', 'create_user', 'create_time']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($data) { $data['total_bill_num'] = FinancialFeeApplicationDetail::where('fee_application_id', $data['id'])->sum('bill_num'); $data['total_amount'] = FinancialFeeApplicationDetail::where('fee_application_id', $data['id'])->sum('amount'); }) ->toArray(); } /** * @notes 获取财务管理--费用申请数量 * @return int * @author likeadmin * @date 2024/03/27 14:53 */ public function count(): int { $params = $this->request->get(); $where = []; if (!empty($params['create_time'])) { $date = explode(',', $params['create_time']); $where[] = ['create_time', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]]; } return FinancialFeeApplication::where($this->searchWhere)->where($where)->count(); } }