From 2b529a27c8c16f0d4f093fdab1eb5b41dc62abda Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Wed, 7 Jan 2026 10:57:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E5=93=81=E5=80=9F=E7=94=A8=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/InvRequisitionService.php | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/app/common/service/InvRequisitionService.php b/app/common/service/InvRequisitionService.php index e7bf1a7..bd1b848 100644 --- a/app/common/service/InvRequisitionService.php +++ b/app/common/service/InvRequisitionService.php @@ -35,6 +35,42 @@ class InvRequisitionService return new $this->validator; } + /** + * 构造 CrudUtil 查询配置 + */ + protected function buildQueryConfig(Request $request, string $scene = 'default'): array + { + $p = $request->all(); + + $config = []; + $config['model'] = $this->modelClass; + switch ($scene) { + case 'default': + $config['where']['status'] = 1; + $config['order']['sort'] = 'desc'; + $config['order']['id'] = 'desc'; + break; + case 'index': + $config['where']['applicant_id'] = $request->user->uid; + $config['order']['sort'] = 'desc'; + $config['order']['id'] = 'desc'; + break; + case 'show': + $config['where']['id'] = $p['id']; + $config['where']['status'] = 1; + break; + case 'store': + break; + case 'update': + $config['where']['id'] = $p['id']; + break; + case 'destroy': + $config['where']['id'] = $p['id']; + break; + } + + return $config; + } /** * 创建物品申请 前置