From 5fa8c06beeed6d5ced0b8eafaf4ff80a50899a19 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Fri, 23 Feb 2024 11:22:44 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E9=A1=B9=E7=9B=AE=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectRectificationController.php | 108 ++++++++++++++ .../ProjectRectificationLists.php | 77 ++++++++++ .../ProjectRectificationLogic.php | 132 ++++++++++++++++++ .../ProjectRectificationValidate.php | 94 +++++++++++++ .../ProjectRectification.php | 34 +++++ 5 files changed, 445 insertions(+) create mode 100644 app/adminapi/controller/project_process_management/ProjectRectificationController.php create mode 100644 app/adminapi/lists/project_process_management/ProjectRectificationLists.php create mode 100644 app/adminapi/logic/project_process_management/ProjectRectificationLogic.php create mode 100644 app/adminapi/validate/project_process_management/ProjectRectificationValidate.php create mode 100644 app/common/model/project_process_management/ProjectRectification.php diff --git a/app/adminapi/controller/project_process_management/ProjectRectificationController.php b/app/adminapi/controller/project_process_management/ProjectRectificationController.php new file mode 100644 index 000000000..874f8194f --- /dev/null +++ b/app/adminapi/controller/project_process_management/ProjectRectificationController.php @@ -0,0 +1,108 @@ +dataLists(new ProjectRectificationLists()); + } + + + /** + * @notes 添加 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function add() + { + $params = (new ProjectRectificationValidate())->post()->goCheck('add'); + $result = ProjectRectificationLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(ProjectRectificationLogic::getError()); + } + + + /** + * @notes 编辑 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function edit() + { + $params = (new ProjectRectificationValidate())->post()->goCheck('edit'); + $result = ProjectRectificationLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(ProjectRectificationLogic::getError()); + } + + + /** + * @notes 删除 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function delete() + { + $params = (new ProjectRectificationValidate())->post()->goCheck('delete'); + ProjectRectificationLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function detail() + { + $params = (new ProjectRectificationValidate())->goCheck('detail'); + $result = ProjectRectificationLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/adminapi/lists/project_process_management/ProjectRectificationLists.php b/app/adminapi/lists/project_process_management/ProjectRectificationLists.php new file mode 100644 index 000000000..42a581946 --- /dev/null +++ b/app/adminapi/lists/project_process_management/ProjectRectificationLists.php @@ -0,0 +1,77 @@ + ['num', 'project', 'project_num'], + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function lists(): array + { + return ProjectRectification::where($this->searchWhere) + ->field(['id', 'dataid', 'num', 'project', 'project_num', 'wt_unit', 'xm_master', 'zx_type', 'zg_master', 'dj_person', 'apptime', 'problem', 'deal_desc']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function count(): int + { + return ProjectRectification::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/adminapi/logic/project_process_management/ProjectRectificationLogic.php b/app/adminapi/logic/project_process_management/ProjectRectificationLogic.php new file mode 100644 index 000000000..a64910de0 --- /dev/null +++ b/app/adminapi/logic/project_process_management/ProjectRectificationLogic.php @@ -0,0 +1,132 @@ + $params['dataid'], + 'num' => $params['num'], + 'project' => $params['project'], + 'project_num' => $params['project_num'], + 'wt_unit' => $params['wt_unit'], + 'xm_master' => $params['xm_master'], + 'zx_type' => $params['zx_type'], + 'zg_master' => $params['zg_master'], + 'dj_person' => $params['dj_person'], + 'apptime' => $params['apptime'], + 'problem' => $params['problem'], + 'deal_desc' => $params['deal_desc'], + 'remark' => $params['remark'], + 'annex' => $params['annex'], + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + ProjectRectification::where('id', $params['id'])->update([ + 'dataid' => $params['dataid'], + 'num' => $params['num'], + 'project' => $params['project'], + 'project_num' => $params['project_num'], + 'wt_unit' => $params['wt_unit'], + 'xm_master' => $params['xm_master'], + 'zx_type' => $params['zx_type'], + 'zg_master' => $params['zg_master'], + 'dj_person' => $params['dj_person'], + 'apptime' => $params['apptime'], + 'problem' => $params['problem'], + 'deal_desc' => $params['deal_desc'], + 'remark' => $params['remark'], + 'annex' => $params['annex'], + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public static function delete(array $params): bool + { + return ProjectRectification::destroy($params['id']); + } + + + /** + * @notes 获取详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public static function detail($params): array + { + return ProjectRectification::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/ProjectRectificationValidate.php b/app/adminapi/validate/project_process_management/ProjectRectificationValidate.php new file mode 100644 index 000000000..4bf125b58 --- /dev/null +++ b/app/adminapi/validate/project_process_management/ProjectRectificationValidate.php @@ -0,0 +1,94 @@ + 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return ProjectRectificationValidate + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectRectificationValidate + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProjectRectificationValidate + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return ProjectRectificationValidate + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file diff --git a/app/common/model/project_process_management/ProjectRectification.php b/app/common/model/project_process_management/ProjectRectification.php new file mode 100644 index 000000000..16e8a8377 --- /dev/null +++ b/app/common/model/project_process_management/ProjectRectification.php @@ -0,0 +1,34 @@ +