likang 2 年之前
父节点
当前提交
47e5f711d1
共有 2 个文件被更改,包括 72 次插入2 次删除
  1. 69 0
      catch/hydraulic/controller/WrenchCheckRecord.php
  2. 3 2
      catch/hydraulic/route.php

+ 69 - 0
catch/hydraulic/controller/WrenchCheckRecord.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace catchAdmin\hydraulic\controller;
+
+use catcher\base\CatchRequest as Request;
+use catcher\CatchResponse;
+use catcher\base\CatchController;
+use catchAdmin\hydraulic\model\WrenchCheckRecord as wrenchCheckRecordModel;
+
+class WrenchCheckRecord extends CatchController
+{
+    protected $wrenchCheckRecordModel;
+    
+    public function __construct(WrenchCheckRecordModel $wrenchCheckRecordModel)
+    {
+        $this->wrenchCheckRecordModel = $wrenchCheckRecordModel;
+    }
+    
+    /**
+     * 列表
+     * @time 2022年06月10日 16:59
+     * @param Request $request 
+     */
+    public function index(Request $request) : \think\Response
+    {
+        return CatchResponse::paginate($this->wrenchCheckRecordModel->getList());
+    }
+    
+    /**
+     * 保存信息
+     * @time 2022年06月10日 16:59
+     * @param Request $request 
+     */
+    public function save(Request $request) : \think\Response
+    {
+        return CatchResponse::success($this->wrenchCheckRecordModel->storeBy($request->post()));
+    }
+    
+    /**
+     * 读取
+     * @time 2022年06月10日 16:59
+     * @param $id 
+     */
+    public function read($id) : \think\Response
+    {
+        return CatchResponse::success($this->wrenchCheckRecordModel->findBy($id));
+    }
+    
+    /**
+     * 更新
+     * @time 2022年06月10日 16:59
+     * @param Request $request 
+     * @param $id
+     */
+    public function update(Request $request, $id) : \think\Response
+    {
+        return CatchResponse::success($this->wrenchCheckRecordModel->updateBy($id, $request->post()));
+    }
+    
+    /**
+     * 删除
+     * @time 2022年06月10日 16:59
+     * @param $id
+     */
+    public function delete($id) : \think\Response
+    {
+        return CatchResponse::success($this->wrenchCheckRecordModel->deleteBy($id));
+    }
+}

+ 3 - 2
catch/hydraulic/route.php

@@ -21,5 +21,6 @@ $router->group(function () use ($router){
 	//获取维保记录映射
 	 $router->get('get_mainten_option', '\catchAdmin\hydraulic\controller\Maintenance@getMaintenOption');
 	$router->resource('maintenance_mapper', '\catchAdmin\hydraulic\controller\Maintenance');
-})->middleware('auth');
-
+	// wrenchCheckRecord路由
+	$router->resource('wrenchCheckRecord', '\catchAdmin\hydraulic\controller\WrenchCheckRecord');
+})->middleware('auth');